Fix
This commit is contained in:
parent
66df1c294a
commit
605cfdef56
@ -12,6 +12,6 @@ namespace OrdersContracts.BindingModels
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Info { get; set; }
|
public string Info { get; set; }
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
public int? Amount { get; set; }
|
public string? Amount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ namespace OrdersDatabaseImplement.Implements
|
|||||||
return new OrderViewModel
|
return new OrderViewModel
|
||||||
{
|
{
|
||||||
Id = order.Id,
|
Id = order.Id,
|
||||||
Amount = order.Amount.ToString(),
|
Amount = order.Amount,
|
||||||
Name = order.Name,
|
Name = order.Name,
|
||||||
Status = order.Status,
|
Status = order.Status,
|
||||||
Info = order.Info
|
Info = order.Info
|
||||||
|
74
WinForms/OrdersDatabaseImplement/Migrations/20231116050328_mig3.Designer.cs
generated
Normal file
74
WinForms/OrdersDatabaseImplement/Migrations/20231116050328_mig3.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
using OrdersDatabaseImplement;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OrdersDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OrdersDatabase))]
|
||||||
|
[Migration("20231116050328_mig3")]
|
||||||
|
partial class mig3
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.11")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("OrdersDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Amount")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Info")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Status")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("OrdersDatabaseImplement.Models.Status", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Statuses");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace OrdersDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class mig3 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Amount",
|
||||||
|
table: "Orders",
|
||||||
|
type: "text",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "integer",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "Amount",
|
||||||
|
table: "Orders",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "text",
|
||||||
|
oldNullable: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
// <auto-generated />
|
// <auto-generated />
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
@ -30,8 +29,8 @@ namespace OrdersDatabaseImplement.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int?>("Amount")
|
b.Property<string>("Amount")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("Info")
|
b.Property<string>("Info")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
@ -19,6 +19,6 @@ namespace OrdersDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
public int? Amount { get; set; }
|
public string? Amount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
WinForms/WinForms/FormMain.Designer.cs
generated
29
WinForms/WinForms/FormMain.Designer.cs
generated
@ -40,9 +40,9 @@ namespace WinForms
|
|||||||
this.сохранитьВПдфToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.сохранитьВПдфToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.статусыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.статусыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.wordText1 = new VisualCompLib.Components.WordText(this.components);
|
this.wordText1 = new VisualCompLib.Components.WordText(this.components);
|
||||||
this.excelChart1 = new UnvisableComponents.ExcelChart(this.components);
|
this.excelChart = new UnvisableComponents.ExcelChart(this.components);
|
||||||
this.componentDocumentWithTableMultiHeaderPdf1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf(this.components);
|
this.componentDocumentWithTableMultiHeaderPdf1 = new ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf(this.components);
|
||||||
this.myTreeView1 = new VisableComponents.MyTreeView();
|
this.TreeView = new VisableComponents.MyTreeView();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -118,27 +118,26 @@ namespace WinForms
|
|||||||
//
|
//
|
||||||
// myTreeView1
|
// myTreeView1
|
||||||
//
|
//
|
||||||
this.myTreeView1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.TreeView.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.myTreeView1.BackColor = System.Drawing.SystemColors.ControlDark;
|
this.TreeView.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||||
this.myTreeView1.Location = new System.Drawing.Point(12, 13);
|
this.TreeView.Location = new System.Drawing.Point(12, 13);
|
||||||
this.myTreeView1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
this.TreeView.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
this.myTreeView1.MinimumSize = new System.Drawing.Size(200, 200);
|
this.TreeView.MinimumSize = new System.Drawing.Size(200, 200);
|
||||||
this.myTreeView1.Name = "myTreeView1";
|
this.TreeView.Name = "TreeView";
|
||||||
this.myTreeView1.Size = new System.Drawing.Size(658, 372);
|
this.TreeView.Size = new System.Drawing.Size(658, 372);
|
||||||
this.myTreeView1.TabIndex = 1;
|
this.TreeView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(682, 398);
|
this.ClientSize = new System.Drawing.Size(682, 398);
|
||||||
this.Controls.Add(this.myTreeView1);
|
this.Controls.Add(this.TreeView);
|
||||||
this.Name = "FormMain";
|
this.Name = "FormMain";
|
||||||
this.Text = "Заказы";
|
this.Text = "Заказы";
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
this.contextMenuStrip1.ResumeLayout(false);
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -153,10 +152,8 @@ namespace WinForms
|
|||||||
private ToolStripMenuItem статусыToolStripMenuItem;
|
private ToolStripMenuItem статусыToolStripMenuItem;
|
||||||
|
|
||||||
private VisualCompLib.Components.WordText wordText1;
|
private VisualCompLib.Components.WordText wordText1;
|
||||||
private UnvisableComponents.ExcelChart excelChart1;
|
private UnvisableComponents.ExcelChart excelChart;
|
||||||
//private Lab2.ChartComponent excelChart1;
|
|
||||||
|
|
||||||
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf componentDocumentWithTableMultiHeaderPdf1;
|
private ComponentsLibraryNet60.DocumentWithTable.ComponentDocumentWithTableMultiHeaderPdf componentDocumentWithTableMultiHeaderPdf1;
|
||||||
private VisableComponents.MyTreeView myTreeView1;
|
private VisableComponents.MyTreeView TreeView;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using ComponentsLibraryNet60.DocumentWithTable;
|
using ComponentsLibraryNet60.DocumentWithTable;
|
||||||
using ComponentsLibraryNet60.Models;
|
using ComponentsLibraryNet60.Models;
|
||||||
|
using ControlsLibraryNet60.Input;
|
||||||
using OrdersContracts.BindingModels;
|
using OrdersContracts.BindingModels;
|
||||||
using OrdersContracts.BusinessLogicContracts;
|
using OrdersContracts.BusinessLogicContracts;
|
||||||
using OrdersContracts.ViewModels;
|
using OrdersContracts.ViewModels;
|
||||||
@ -27,7 +28,7 @@ namespace WinForms
|
|||||||
_statusLogic = statusLogic;
|
_statusLogic = statusLogic;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
List<string> stringToHierachy = new List<string>() { "Status", "Amount", "Id", "Name" };
|
List<string> stringToHierachy = new List<string>() { "Status", "Amount", "Id", "Name" };
|
||||||
myTreeView1.addToHierarchy(stringToHierachy);
|
TreeView.addToHierarchy(stringToHierachy);
|
||||||
ContextMenuStrip = contextMenuStrip1;
|
ContextMenuStrip = contextMenuStrip1;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -44,7 +45,7 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
if (list[i].Amount == null || list[i].Amount == "") { list[i].Amount = "Заказы, оплаченные скидками"; }
|
if (list[i].Amount == null || list[i].Amount == "") { list[i].Amount = "Заказы, оплаченные скидками"; }
|
||||||
}
|
}
|
||||||
myTreeView1.LoadTree(list);
|
TreeView.LoadTree(list);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -67,7 +68,8 @@ namespace WinForms
|
|||||||
var service = Program.ServiceProvider?.GetService(typeof(FormOrder));
|
var service = Program.ServiceProvider?.GetService(typeof(FormOrder));
|
||||||
if (!(service is FormOrder form)) return;
|
if (!(service is FormOrder form)) return;
|
||||||
|
|
||||||
var selectedOrder = myTreeView1.GetNode(typeof(OrderBindingModel));
|
var selectedOrder = TreeView.GetNode(typeof(OrderBindingModel));//ошибка
|
||||||
|
|
||||||
if (selectedOrder != null)
|
if (selectedOrder != null)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id);
|
form.Id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id);
|
||||||
@ -78,7 +80,7 @@ namespace WinForms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Выберите клиента для редактирования");
|
MessageBox.Show("Выберите заказ для редактирования");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +88,7 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var selectedOrder = myTreeView1.GetNode(typeof(OrderBindingModel));
|
var selectedOrder = TreeView.GetNode(typeof(OrderBindingModel));
|
||||||
int id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id);
|
int id = Convert.ToInt32((selectedOrder as OrderBindingModel).Id);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -120,7 +122,7 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
if (item.Amount == null || item.Amount == "")
|
if (item.Amount == null || item.Amount == "")
|
||||||
{
|
{
|
||||||
string orders = string.Concat("ФИО: ", item.Name, " Описание: ", item.Info);
|
string orders = string.Concat("ФИО заказчика: ", item.Name, " Описание: ", item.Info);
|
||||||
textList.Add(orders);
|
textList.Add(orders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,7 +130,6 @@ namespace WinForms
|
|||||||
wordText1.CreateWordText(new(fileName, "Заказы, которые были оплачены скидками", textArray));
|
wordText1.CreateWordText(new(fileName, "Заказы, которые были оплачены скидками", textArray));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createExcel()
|
private void createExcel()
|
||||||
{
|
{
|
||||||
string fileName = "";
|
string fileName = "";
|
||||||
@ -153,7 +154,7 @@ namespace WinForms
|
|||||||
}
|
}
|
||||||
dates.Add((statuses[i].Name, counter));
|
dates.Add((statuses[i].Name, counter));
|
||||||
}
|
}
|
||||||
excelChart1.Load(new ChartInfo
|
excelChart.Load(new ChartInfo
|
||||||
{
|
{
|
||||||
Path = fileName,
|
Path = fileName,
|
||||||
Title = "Статусы заказов",
|
Title = "Статусы заказов",
|
||||||
@ -179,7 +180,7 @@ namespace WinForms
|
|||||||
var orders = _orderLogic.Read(null);
|
var orders = _orderLogic.Read(null);
|
||||||
for (int i = 0; i < orders.Count; i++)
|
for (int i = 0; i < orders.Count; i++)
|
||||||
{
|
{
|
||||||
if (orders[i].Amount == null || orders[i].Amount == "") { orders[i].Amount = "нет2"; }
|
if (orders[i].Amount == null || orders[i].Amount == "") { orders[i].Amount = "Заказы оплачен скидками"; }
|
||||||
}
|
}
|
||||||
componentDocumentWithTableMultiHeaderPdf1.CreateDoc(new ComponentDocumentWithTableHeaderDataConfig<OrderViewModel>
|
componentDocumentWithTableMultiHeaderPdf1.CreateDoc(new ComponentDocumentWithTableHeaderDataConfig<OrderViewModel>
|
||||||
{
|
{
|
||||||
@ -196,14 +197,12 @@ namespace WinForms
|
|||||||
Data = orders
|
Data = orders
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void статусыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void статусыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormStatus));
|
var service = Program.ServiceProvider?.GetService(typeof(FormStatus));
|
||||||
if (!(service is FormStatus form)) return;
|
if (!(service is FormStatus form)) return;
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void сохранитьВПдфToolStripMenuItem_Click(object sender, EventArgs e)
|
private void сохранитьВПдфToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CreatePdf();
|
CreatePdf();
|
||||||
@ -213,12 +212,10 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
createExcel();
|
createExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void сохранитьВВордToolStripMenuItem_Click(object sender, EventArgs e)
|
private void сохранитьВВордToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CreateWord();
|
CreateWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
|
private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DeleteElement();
|
DeleteElement();
|
||||||
@ -228,7 +225,6 @@ namespace WinForms
|
|||||||
{
|
{
|
||||||
UpdateElement();
|
UpdateElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
|
private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AddNewElement();
|
AddNewElement();
|
||||||
|
@ -80,7 +80,7 @@ namespace WinForms
|
|||||||
MessageBox.Show("Заполните описание", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("Заполните описание", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int? amount = controlInputNullableInt1.Value;
|
string? amount = controlInputNullableInt1.Value.ToString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user