Даты изменения поставок
This commit is contained in:
parent
a1575b150d
commit
57a28d9baf
@ -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--;
|
||||
|
@ -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
|
||||
});
|
||||
|
@ -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<Guid, (IProduct, int)> SupplyProducts { get; set; } = new();
|
||||
|
@ -18,6 +18,8 @@ namespace Contracts.ViewModels
|
||||
public double Price { get; set; }
|
||||
public Dictionary<Guid, (IProduct, int)> Products { get; set; } = new();
|
||||
public DateTime Date { get; set; }
|
||||
public DateTime? DateArriving { get; set; }
|
||||
public DateTime? DateComplete { get; set; }
|
||||
public SupplyStatus Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -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<Guid, (IProduct, int)> SupplyProducts { get; }
|
||||
}
|
||||
|
496
DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs
generated
Normal file
496
DatabaseImplement/Migrations/20240625085945_dates_migration.Designer.cs
generated
Normal file
@ -0,0 +1,496 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("MediaFiles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Product", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Amount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsBeingSold")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<double>("Rate")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Purchase", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("DatePurchase")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Purchases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.PurchaseProducts", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PurchaseId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("PurchaseId");
|
||||
|
||||
b.ToTable("PurchaseProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Roles");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Sell", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("DateSell")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Sells");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.SellProducts", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SellId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("SellId");
|
||||
|
||||
b.ToTable("SellProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Supplier", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Deals")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.SupplierProduct", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SupplierId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.ToTable("SupplierProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.Supply", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateArriving")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateComplete")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("SupplierId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SupplierId");
|
||||
|
||||
b.ToTable("Supplies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.SupplyDoc", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("SupplyId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("SupplyDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.SupplyProduct", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("SupplyId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.HasIndex("SupplyId");
|
||||
|
||||
b.ToTable("SupplyProducts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("Birthday")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("OnlyImportantMails")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("RoleId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class dates_migration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DateArriving",
|
||||
table: "Supplies",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateArriving")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateComplete")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("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")
|
||||
|
@ -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<Guid, (IProduct, int)>? _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,
|
||||
};
|
||||
|
15
WinFormsApp/FormMain.Designer.cs
generated
15
WinFormsApp/FormMain.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user