From 57a28d9baf5ea8d17a5227e575cf4c6504bd011c Mon Sep 17 00:00:00 2001 From: the Date: Tue, 25 Jun 2024 13:14:23 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=B0=D1=82=D1=8B=20=D0=B8=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=B2=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BusinessLogic/BusinessLogic/SupplyLogic.cs | 8 + .../OfficePackage/AbstractSaveToPdf.cs | 5 +- Contracts/BindingModels/SupplyBindingModel.cs | 2 + Contracts/ViewModels/SupplyViewModel.cs | 2 + DataModels/Models/ISupply.cs | 2 + ...20240625085945_dates_migration.Designer.cs | 496 ++++++++++++++++++ .../20240625085945_dates_migration.cs | 60 +++ .../Migrations/DatabaseModelSnapshot.cs | 19 + DatabaseImplement/Models/Supply.cs | 8 + WinFormsApp/FormMain.Designer.cs | 15 +- WinFormsApp/FormMain.cs | 11 +- 11 files changed, 625 insertions(+), 3 deletions(-) create mode 100644 DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs create mode 100644 DatabaseImplement/Migrations/20240625085945_dates_migration.cs diff --git a/BusinessLogic/BusinessLogic/SupplyLogic.cs b/BusinessLogic/BusinessLogic/SupplyLogic.cs index b246c0d..03df5ff 100644 --- a/BusinessLogic/BusinessLogic/SupplyLogic.cs +++ b/BusinessLogic/BusinessLogic/SupplyLogic.cs @@ -111,6 +111,14 @@ namespace BusinessLogic.BusinessLogic return false; } model.Status = newStatus; + if (newStatus == SupplyStatus.Arriving) + { + model.DateArriving = DateTime.UtcNow; + } + if (newStatus == SupplyStatus.Completed) + { + model.DateComplete = DateTime.UtcNow; + } if (_supplyStorage.Update(model) == null) { model.Status--; diff --git a/BusinessLogic/OfficePackage/AbstractSaveToPdf.cs b/BusinessLogic/OfficePackage/AbstractSaveToPdf.cs index 8d7a2fc..5b58544 100644 --- a/BusinessLogic/OfficePackage/AbstractSaveToPdf.cs +++ b/BusinessLogic/OfficePackage/AbstractSaveToPdf.cs @@ -3,6 +3,7 @@ using BusinessLogic.OfficePackage.HelperEnums; using BusinessLogic.OfficePackage.HelperModels; using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -20,9 +21,11 @@ namespace BusinessLogic.OfficePackage Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Center }); + string dateArriving = info.Supply.DateArriving.HasValue ? info.Supply.DateArriving.ToString() : "-"; + string dateComplete = info.Supply.DateComplete.HasValue ? info.Supply.DateComplete.ToString() : "-"; CreateParagraph(new PdfParagraph { - Text = $"Поставщик: {info.Supply.SupplierName}\nДата создания поставки: {info.Supply.Date}\nСтатус: {info.Supply.Status}", + Text = $"Поставщик: {info.Supply.SupplierName}\nДата создания поставки: {info.Supply.Date}\nДата отправления поставки: {dateArriving}\nДата получения поставки: {dateComplete}\nСтатус: {info.Supply.Status}", Style = "NormalTitle", ParagraphAlignment = PdfParagraphAlignmentType.Right }); diff --git a/Contracts/BindingModels/SupplyBindingModel.cs b/Contracts/BindingModels/SupplyBindingModel.cs index 44ba57c..61600d3 100644 --- a/Contracts/BindingModels/SupplyBindingModel.cs +++ b/Contracts/BindingModels/SupplyBindingModel.cs @@ -14,6 +14,8 @@ namespace Contracts.BindingModels public string Name { get; set; } = string.Empty; public Guid SupplierId { get; set; } public DateTime Date { get; set; } + public DateTime? DateArriving { get; set; } + public DateTime? DateComplete { get; set; } public double Price { get; set; } public SupplyStatus Status { get; set; } public Dictionary SupplyProducts { get; set; } = new(); diff --git a/Contracts/ViewModels/SupplyViewModel.cs b/Contracts/ViewModels/SupplyViewModel.cs index 08f7046..992a4a6 100644 --- a/Contracts/ViewModels/SupplyViewModel.cs +++ b/Contracts/ViewModels/SupplyViewModel.cs @@ -18,6 +18,8 @@ namespace Contracts.ViewModels public double Price { get; set; } public Dictionary Products { get; set; } = new(); public DateTime Date { get; set; } + public DateTime? DateArriving { get; set; } + public DateTime? DateComplete { get; set; } public SupplyStatus Status { get; set; } } } diff --git a/DataModels/Models/ISupply.cs b/DataModels/Models/ISupply.cs index fff5ab5..4dda0a7 100644 --- a/DataModels/Models/ISupply.cs +++ b/DataModels/Models/ISupply.cs @@ -13,6 +13,8 @@ namespace DataModels.Models double Price { get; } Guid SupplierId { get; } DateTime Date { get; } + DateTime? DateArriving { get; } + DateTime? DateComplete { get; } SupplyStatus Status { get; } Dictionary SupplyProducts { get; } } diff --git a/DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs b/DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs new file mode 100644 index 0000000..a814e7a --- /dev/null +++ b/DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs @@ -0,0 +1,496 @@ +// +using System; +using DatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace DatabaseImplement.Migrations +{ + [DbContext(typeof(Database))] + [Migration("20240625085945_dates_migration")] + partial class dates_migration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.6") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DatabaseImplement.Models.MediaFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Location") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("MediaFiles"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("integer"); + + b.Property("IsBeingSold") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("double precision"); + + b.Property("Rate") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Purchase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DatePurchase") + .HasColumnType("timestamp with time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Purchases"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.PurchaseProducts", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("PurchaseId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("PurchaseId"); + + b.ToTable("PurchaseProducts"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Sell", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DateSell") + .HasColumnType("timestamp with time zone"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Sells"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SellProducts", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("SellId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("SellId"); + + b.ToTable("SellProducts"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Deals") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SupplierProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("SupplierId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("SupplierId"); + + b.ToTable("SupplierProducts"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Supply", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .HasColumnType("timestamp with time zone"); + + b.Property("DateArriving") + .HasColumnType("timestamp with time zone"); + + b.Property("DateComplete") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Price") + .HasColumnType("double precision"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("SupplierId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SupplierId"); + + b.ToTable("Supplies"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SupplyDoc", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("SupplyId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.ToTable("SupplyDocs"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SupplyProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("SupplyId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("SupplyId"); + + b.ToTable("SupplyProducts"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Birthday") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("OnlyImportantMails") + .HasColumnType("boolean"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("SecondName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.MediaFile", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Purchase", b => + { + b.HasOne("DatabaseImplement.Models.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.PurchaseProducts", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany("PurchaseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseImplement.Models.Purchase", "Purchase") + .WithMany("Products") + .HasForeignKey("PurchaseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Purchase"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Sell", b => + { + b.HasOne("DatabaseImplement.Models.User", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SellProducts", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany("SellProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseImplement.Models.Sell", "Sell") + .WithMany("Products") + .HasForeignKey("SellId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Sell"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SupplierProduct", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseImplement.Models.Supplier", "Supplier") + .WithMany("Products") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Supply", b => + { + b.HasOne("DatabaseImplement.Models.Supplier", "Supplier") + .WithMany() + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.SupplyProduct", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseImplement.Models.Supply", "Supply") + .WithMany("Products") + .HasForeignKey("SupplyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supply"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.User", b => + { + b.HasOne("DatabaseImplement.Models.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Product", b => + { + b.Navigation("PurchaseProducts"); + + b.Navigation("SellProducts"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Purchase", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Sell", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Supplier", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("DatabaseImplement.Models.Supply", b => + { + b.Navigation("Products"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DatabaseImplement/Migrations/20240625085945_dates_migration.cs b/DatabaseImplement/Migrations/20240625085945_dates_migration.cs new file mode 100644 index 0000000..c228ce6 --- /dev/null +++ b/DatabaseImplement/Migrations/20240625085945_dates_migration.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DatabaseImplement.Migrations +{ + /// + public partial class dates_migration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DateArriving", + table: "Supplies", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.AddColumn( + name: "DateComplete", + table: "Supplies", + type: "timestamp with time zone", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_MediaFiles_ProductId", + table: "MediaFiles", + column: "ProductId"); + + migrationBuilder.AddForeignKey( + name: "FK_MediaFiles_Products_ProductId", + table: "MediaFiles", + column: "ProductId", + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_MediaFiles_Products_ProductId", + table: "MediaFiles"); + + migrationBuilder.DropIndex( + name: "IX_MediaFiles_ProductId", + table: "MediaFiles"); + + migrationBuilder.DropColumn( + name: "DateArriving", + table: "Supplies"); + + migrationBuilder.DropColumn( + name: "DateComplete", + table: "Supplies"); + } + } +} diff --git a/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs b/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs index 1d1117b..013f054 100644 --- a/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs +++ b/DatabaseImplement/Migrations/DatabaseModelSnapshot.cs @@ -41,6 +41,8 @@ namespace DatabaseImplement.Migrations b.HasKey("Id"); + b.HasIndex("ProductId"); + b.ToTable("MediaFiles"); }); @@ -226,6 +228,12 @@ namespace DatabaseImplement.Migrations b.Property("Date") .HasColumnType("timestamp with time zone"); + b.Property("DateArriving") + .HasColumnType("timestamp with time zone"); + + b.Property("DateComplete") + .HasColumnType("timestamp with time zone"); + b.Property("Name") .IsRequired() .HasColumnType("text"); @@ -326,6 +334,17 @@ namespace DatabaseImplement.Migrations b.ToTable("Users"); }); + modelBuilder.Entity("DatabaseImplement.Models.MediaFile", b => + { + b.HasOne("DatabaseImplement.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + modelBuilder.Entity("DatabaseImplement.Models.Purchase", b => { b.HasOne("DatabaseImplement.Models.User", "User") diff --git a/DatabaseImplement/Models/Supply.cs b/DatabaseImplement/Models/Supply.cs index 060d97c..2d65060 100644 --- a/DatabaseImplement/Models/Supply.cs +++ b/DatabaseImplement/Models/Supply.cs @@ -25,6 +25,8 @@ namespace DatabaseImplement.Models public Guid SupplierId { get; set; } [Required] public DateTime Date { get; set; } + public DateTime? DateArriving { get; private set; } + public DateTime? DateComplete { get; private set; } [Required] public SupplyStatus Status { get; set; } = SupplyStatus.Pending; private Dictionary? _supplyProducts = null; @@ -53,6 +55,8 @@ namespace DatabaseImplement.Models Name = model.Name, Price = model.Price, Date = model.Date, + DateArriving = model.DateArriving, + DateComplete = model.DateComplete, SupplierId = model.SupplierId, Products = model.SupplyProducts.Select(x => new SupplyProduct @@ -66,6 +70,8 @@ namespace DatabaseImplement.Models public void Update(SupplyBindingModel model) { Status = model.Status; + DateArriving = model.DateArriving; + DateComplete = model.DateComplete; } public SupplyViewModel GetViewModel { @@ -80,6 +86,8 @@ namespace DatabaseImplement.Models Products = SupplyProducts, SupplierId = SupplierId, Date = Date, + DateArriving = DateArriving, + DateComplete = DateComplete, Status = Status, SupplierName = Supplier.Name, }; diff --git a/WinFormsApp/FormMain.Designer.cs b/WinFormsApp/FormMain.Designer.cs index 60d391b..2f38434 100644 --- a/WinFormsApp/FormMain.Designer.cs +++ b/WinFormsApp/FormMain.Designer.cs @@ -40,6 +40,7 @@ buttonPrintReport = new Button(); printPreviewDialog = new PrintPreviewDialog(); printDialog = new PrintDialog(); + buttonRefresh = new Button(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); menuStrip1.SuspendLayout(); SuspendLayout(); @@ -118,7 +119,7 @@ // // buttonPrintReport // - buttonPrintReport.Location = new Point(707, 274); + buttonPrintReport.Location = new Point(707, 261); buttonPrintReport.Name = "buttonPrintReport"; buttonPrintReport.Size = new Size(154, 44); buttonPrintReport.TabIndex = 6; @@ -140,11 +141,22 @@ // printDialog.UseEXDialog = true; // + // buttonRefresh + // + buttonRefresh.Location = new Point(707, 325); + buttonRefresh.Name = "buttonRefresh"; + buttonRefresh.Size = new Size(154, 47); + buttonRefresh.TabIndex = 7; + buttonRefresh.Text = "Обновить"; + buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += buttonRefresh_Click; + // // FormMain // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(901, 384); + Controls.Add(buttonRefresh); Controls.Add(buttonPrintReport); Controls.Add(buttonCreateReport); Controls.Add(buttonSupplyStatusCompleted); @@ -176,5 +188,6 @@ private Button buttonPrintReport; private PrintPreviewDialog printPreviewDialog; private PrintDialog printDialog; + private Button buttonRefresh; } } \ No newline at end of file diff --git a/WinFormsApp/FormMain.cs b/WinFormsApp/FormMain.cs index 3608e2f..da7e521 100644 --- a/WinFormsApp/FormMain.cs +++ b/WinFormsApp/FormMain.cs @@ -50,6 +50,8 @@ namespace WinFormsApp if (list != null) { dataGridView.DataSource = list; + dataGridView.Columns["SupplierId"].Visible = false; + dataGridView.Columns["Products"].Visible = false; } _logger.LogInformation("Загрузка поставок"); } @@ -125,7 +127,9 @@ namespace WinFormsApp var operationResult = _supplyLogic.StatusUpdate(new SupplyBindingModel { Id = id, - Status = (SupplyStatus)dataGridView.SelectedRows[0].Cells["Status"].Value + Status = (SupplyStatus)dataGridView.SelectedRows[0].Cells["Status"].Value, + DateArriving = (DateTime?)dataGridView.SelectedRows[0].Cells["DateArriving"].Value, + DateComplete = (DateTime?)dataGridView.SelectedRows[0].Cells["DateComplete"].Value, }, SupplyStatus.Completed); if (!operationResult) { @@ -179,5 +183,10 @@ namespace WinFormsApp IronPrint.Printer.PrintAsync(dialog.FileName); } } + + private void buttonRefresh_Click(object sender, EventArgs e) + { + LoadData(); + } } }