From a97cf5f041eeec419f769b71d41f5dfcb4195d20 Mon Sep 17 00:00:00 2001 From: "a.puchkina" Date: Wed, 15 May 2024 10:59:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B1=D1=8B=D0=BB=D0=BE!=20=D0=B3=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OrderLogic.cs | 8 +++- .../SearchModels/OrderSearchModel.cs | 2 + .../Implement/OrderStorage.cs | 36 +++++++++++++++-- ... 20240515053955_InitialCreate.Designer.cs} | 39 +++++++++++++------ ...ate.cs => 20240515053955_InitialCreate.cs} | 25 ++++++++---- .../TransportLogisticDatabaseModelSnapshot.cs | 37 ++++++++++++------ .../Models/Customer.cs | 2 +- .../Models/Good.cs | 2 + .../Models/Order.cs | 18 +++++---- .../Models/Storage.cs | 6 ++- .../TransportLogisticDatabase.cs | 2 +- .../TransportLogisticForm/FormCreateOrder.cs | 20 ++++++---- .../FormGood.Designer.cs | 4 +- .../FormMain.Designer.cs | 12 +++--- .../TransportLogisticForm/FormMain.cs | 4 +- .../TransportLogisticForm/FormOrderGoods.cs | 2 +- .../FormOrderTransports.cs | 2 +- 17 files changed, 154 insertions(+), 67 deletions(-) rename TransportLogistic/TransportLogisticDatabaseImplement/Migrations/{20240514175153_InitialCreate.Designer.cs => 20240515053955_InitialCreate.Designer.cs} (90%) rename TransportLogistic/TransportLogisticDatabaseImplement/Migrations/{20240514175153_InitialCreate.cs => 20240515053955_InitialCreate.cs} (91%) diff --git a/TransportLogistic/TransportLogisticBusinessLogic/OrderLogic.cs b/TransportLogistic/TransportLogisticBusinessLogic/OrderLogic.cs index f80e74a..3928374 100644 --- a/TransportLogistic/TransportLogisticBusinessLogic/OrderLogic.cs +++ b/TransportLogistic/TransportLogisticBusinessLogic/OrderLogic.cs @@ -66,8 +66,12 @@ namespace TransportLogisticBusinessLogic throw new InvalidOperationException("Текущий статус заказа не может быть переведен в выбранный"); } model.Status = status; - if (model.Status == OrderStatus.Доставлен) model.DateDelivered = DateTime.Now; - _orderStorage.Update(model); + if (model.Status == OrderStatus.Выдан) model.DateDelivered = DateTime.Now; + if (_orderStorage.Update(model) == null) + { + model.Status--; + return false; + } return true; } diff --git a/TransportLogistic/TransportLogisticContracts/SearchModels/OrderSearchModel.cs b/TransportLogistic/TransportLogisticContracts/SearchModels/OrderSearchModel.cs index 24a9da5..6204b56 100644 --- a/TransportLogistic/TransportLogisticContracts/SearchModels/OrderSearchModel.cs +++ b/TransportLogistic/TransportLogisticContracts/SearchModels/OrderSearchModel.cs @@ -4,5 +4,7 @@ { public int? Id { get; set; } public int? CustomerId { get; set; } + public DateTime? DateCreate { get; set; } + public DateTime? DateDelivered { get; set;} } } diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Implement/OrderStorage.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Implement/OrderStorage.cs index 7fccd5b..d9fc2ac 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Implement/OrderStorage.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Implement/OrderStorage.cs @@ -14,6 +14,9 @@ namespace TransportLogisticDatabaseImplement.Implement { using var context = new TransportLogisticDatabase(); return context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .Include(x => x.Transports) .ThenInclude(x => x.Transport) .Include(x => x.Goods) @@ -29,6 +32,9 @@ namespace TransportLogisticDatabaseImplement.Implement if (model.Id.HasValue) { return context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .Include(x => x.Transports) .ThenInclude(x => x.Transport) .Include(x => x.Goods) @@ -41,6 +47,9 @@ namespace TransportLogisticDatabaseImplement.Implement else if (model.CustomerId.HasValue) { return context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .Include(x => x.Transports) .ThenInclude(x => x.Transport) .Include(x => x.Goods) @@ -61,6 +70,9 @@ namespace TransportLogisticDatabaseImplement.Implement } using var context = new TransportLogisticDatabase(); return context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .Include(x => x.Transports) .ThenInclude(x => x.Transport) .Include(x => x.Goods) @@ -79,7 +91,15 @@ namespace TransportLogisticDatabaseImplement.Implement } context.Orders.Add(newOrder); context.SaveChanges(); - return newOrder.GetViewModel; + return context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) + .Include(x => x.Transports) + .ThenInclude(x => x.Transport) + .Include(x => x.Goods) + .ThenInclude(x => x.Good) + .FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel; } public OrderViewModel? Update(OrderBindingModel model) @@ -95,10 +115,12 @@ namespace TransportLogisticDatabaseImplement.Implement } order.Update(model); context.SaveChanges(); - order.UpdateTransports(context, model); - order.UpdateGoods(context, model); transaction.Commit(); - return order.GetViewModel; + return context.Orders.Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) + .Include(x => x.Transports) + .Include(x => x.Goods).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; } catch { @@ -111,12 +133,18 @@ namespace TransportLogisticDatabaseImplement.Implement { using var context = new TransportLogisticDatabase(); var element = context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .Include(x => x.Transports) .Include(x => x.Goods) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { var deletedElement = context.Orders + .Include(x => x.StartStorage) + .Include(x => x.FinishStorage) + .Include(x => x.Customer) .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; context.Orders.Remove(element); diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.Designer.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.Designer.cs similarity index 90% rename from TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.Designer.cs rename to TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.Designer.cs index 89d7e98..6311cb3 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.Designer.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using TransportLogisticDatabaseImplement; namespace TransportLogisticDatabaseImplement.Migrations { [DbContext(typeof(TransportLogisticDatabase))] - [Migration("20240514175153_InitialCreate")] + [Migration("20240515053955_InitialCreate")] partial class InitialCreate { /// @@ -100,14 +100,13 @@ namespace TransportLogisticDatabaseImplement.Migrations b.Property("Status") .HasColumnType("int"); - b.Property("StorageId") - .HasColumnType("int"); - b.HasKey("Id"); b.HasIndex("CustomerId"); - b.HasIndex("StorageId"); + b.HasIndex("FinishStorageId"); + + b.HasIndex("StartStorageId"); b.ToTable("Orders"); }); @@ -207,15 +206,29 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b => { - b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", null) - .WithMany("Order") + b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer") + .WithMany("Orders") .HasForeignKey("CustomerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", null) - .WithMany("Orders") - .HasForeignKey("StorageId"); + b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "FinishStorage") + .WithMany("FinishOrders") + .HasForeignKey("FinishStorageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "StartStorage") + .WithMany("StartOrders") + .HasForeignKey("StartStorageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + + b.Navigation("FinishStorage"); + + b.Navigation("StartStorage"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b => @@ -258,7 +271,7 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b => { - b.Navigation("Order"); + b.Navigation("Orders"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b => @@ -275,7 +288,9 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b => { - b.Navigation("Orders"); + b.Navigation("FinishOrders"); + + b.Navigation("StartOrders"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b => diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.cs similarity index 91% rename from TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.cs rename to TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.cs index cf3f15e..1cb0f7a 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240514175153_InitialCreate.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/20240515053955_InitialCreate.cs @@ -80,8 +80,7 @@ namespace TransportLogisticDatabaseImplement.Migrations DateDelivered = table.Column(type: "datetime2", nullable: true), StartStorageId = table.Column(type: "int", nullable: false), FinishStorageId = table.Column(type: "int", nullable: false), - CustomerId = table.Column(type: "int", nullable: false), - StorageId = table.Column(type: "int", nullable: true) + CustomerId = table.Column(type: "int", nullable: false) }, constraints: table => { @@ -93,10 +92,17 @@ namespace TransportLogisticDatabaseImplement.Migrations principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_Orders_Storages_StorageId", - column: x => x.StorageId, + name: "FK_Orders_Storages_FinishStorageId", + column: x => x.FinishStorageId, principalTable: "Storages", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + table.ForeignKey( + name: "FK_Orders_Storages_StartStorageId", + column: x => x.StartStorageId, + principalTable: "Storages", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); }); migrationBuilder.CreateTable( @@ -169,9 +175,14 @@ namespace TransportLogisticDatabaseImplement.Migrations column: "CustomerId"); migrationBuilder.CreateIndex( - name: "IX_Orders_StorageId", + name: "IX_Orders_FinishStorageId", table: "Orders", - column: "StorageId"); + column: "FinishStorageId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_StartStorageId", + table: "Orders", + column: "StartStorageId"); migrationBuilder.CreateIndex( name: "IX_OrderTransports_OrderId", diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/TransportLogisticDatabaseModelSnapshot.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/TransportLogisticDatabaseModelSnapshot.cs index 2839f38..f8c4b61 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/TransportLogisticDatabaseModelSnapshot.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Migrations/TransportLogisticDatabaseModelSnapshot.cs @@ -97,14 +97,13 @@ namespace TransportLogisticDatabaseImplement.Migrations b.Property("Status") .HasColumnType("int"); - b.Property("StorageId") - .HasColumnType("int"); - b.HasKey("Id"); b.HasIndex("CustomerId"); - b.HasIndex("StorageId"); + b.HasIndex("FinishStorageId"); + + b.HasIndex("StartStorageId"); b.ToTable("Orders"); }); @@ -204,15 +203,29 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b => { - b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", null) - .WithMany("Order") + b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer") + .WithMany("Orders") .HasForeignKey("CustomerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", null) - .WithMany("Orders") - .HasForeignKey("StorageId"); + b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "FinishStorage") + .WithMany("FinishOrders") + .HasForeignKey("FinishStorageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "StartStorage") + .WithMany("StartOrders") + .HasForeignKey("StartStorageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + + b.Navigation("FinishStorage"); + + b.Navigation("StartStorage"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b => @@ -255,7 +268,7 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Customer", b => { - b.Navigation("Order"); + b.Navigation("Orders"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Good", b => @@ -272,7 +285,9 @@ namespace TransportLogisticDatabaseImplement.Migrations modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Storage", b => { - b.Navigation("Orders"); + b.Navigation("FinishOrders"); + + b.Navigation("StartOrders"); }); modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Transport", b => diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Customer.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Customer.cs index 9a80d10..cca1adc 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Customer.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Customer.cs @@ -18,7 +18,7 @@ namespace TransportLogisticDatabaseImplement.Models public string Email { get; private set; } = string.Empty; [ForeignKey("CustomerId")] - public virtual List Order { get; set; } = new(); + public virtual List Orders { get; set; } = new(); public static Customer? Create(CustomerBindingModel model) { diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Good.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Good.cs index eee1fdd..18a1cbc 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Good.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Good.cs @@ -11,7 +11,9 @@ namespace TransportLogisticDatabaseImplement.Models public int Id { get; private set; } [Required] public string Name { get; private set; } = string.Empty; + [Required] public double Weight { get; private set; } + [Required] public string Size { get; private set; } = string.Empty; [ForeignKey("GoodId")] diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Order.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Order.cs index 2140acb..334494c 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Order.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Order.cs @@ -10,19 +10,20 @@ namespace TransportLogisticDatabaseImplement.Models public class Order : IOrderModel { public int Id { get; set; } - [Required] public OrderStatus Status { get; set; } - [Required] public DateTime DateCreate { get; set; } - public DateTime? DateDelivered { get; set; } + [Required] public int StartStorageId { get; set; } - [Required] + [InverseProperty("StartOrders")] + public virtual Storage StartStorage { get; set; } public int FinishStorageId { get; set; } - [Required] + [InverseProperty("FinishOrders")] + public virtual Storage FinishStorage { get; set; } public int CustomerId { get; set; } + public virtual Customer Customer { get; set; } [Required] private Dictionary? _orderTransports = null; @@ -60,8 +61,8 @@ namespace TransportLogisticDatabaseImplement.Models } [ForeignKey("OrderId")] public virtual List Goods { get; set; } = new(); - - public static Order? Create(TransportLogisticDatabase context, OrderBindingModel? model) + + public static Order? Create(TransportLogisticDatabase context, OrderBindingModel model) { if (model == null) { @@ -107,8 +108,11 @@ namespace TransportLogisticDatabaseImplement.Models DateCreate = DateCreate, DateDelivered = DateDelivered, StartStorageId = StartStorageId, + StartStorageName = StartStorage.Name, FinishStorageId = FinishStorageId, + FinishStorageName = FinishStorage.Name, CustomerId = CustomerId, + CustomerName = Customer.Lastname, OrderTransports = OrderTransports, OrderGoods = OrderGoods }; diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Storage.cs b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Storage.cs index 36ea203..7edd6cc 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/Models/Storage.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/Models/Storage.cs @@ -16,8 +16,10 @@ namespace TransportLogisticDatabaseImplement.Models [Required] public string Address { get; private set; } = string.Empty; - [ForeignKey("StorageId")] - public virtual List Orders{ get; set; } = new(); + [InverseProperty("StartStorage")] + public virtual List StartOrders { get; set; } = new(); + [InverseProperty("FinishStorage")] + public virtual List FinishOrders { get; set; } = new(); public static Storage? Create(StorageBindingModel model) { diff --git a/TransportLogistic/TransportLogisticDatabaseImplement/TransportLogisticDatabase.cs b/TransportLogistic/TransportLogisticDatabaseImplement/TransportLogisticDatabase.cs index 72096b5..77e6ad2 100644 --- a/TransportLogistic/TransportLogisticDatabaseImplement/TransportLogisticDatabase.cs +++ b/TransportLogistic/TransportLogisticDatabaseImplement/TransportLogisticDatabase.cs @@ -9,7 +9,7 @@ namespace TransportLogisticDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=TransportLogisticDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True" + optionsBuilder.UseSqlServer(@"Data Source=PC-Anna\SQLEXPRESS;Initial Catalog=TransportLogisticDatabase2;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True" ); } base.OnConfiguring(optionsBuilder); diff --git a/TransportLogistic/TransportLogisticForm/FormCreateOrder.cs b/TransportLogistic/TransportLogisticForm/FormCreateOrder.cs index ad5fb12..94c2ce9 100644 --- a/TransportLogistic/TransportLogisticForm/FormCreateOrder.cs +++ b/TransportLogistic/TransportLogisticForm/FormCreateOrder.cs @@ -105,7 +105,7 @@ namespace TransportLogisticForm dataGridView.Rows.Clear(); foreach (var pc in _orderGoods) { - dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.Name, pc.Value.Item2 }); + dataGridView1.Rows.Add(new object[] { pc.Key, pc.Value.Item1.Name, pc.Value.Item2 }); } foreach (var pc in _orderTransports) { @@ -140,12 +140,16 @@ namespace TransportLogisticForm } try { - var operationResult = _logicO.CreateOrder(new OrderBindingModel + var model = new OrderBindingModel { + Id = _id ?? 0, StartStorageId = Convert.ToInt32(comboBoxStart.SelectedValue), FinishStorageId = Convert.ToInt32(comboBoxFinish.SelectedValue), - CustomerId = Convert.ToInt32(comboBoxCustomer.SelectedValue) - }); + CustomerId = Convert.ToInt32(comboBoxCustomer.SelectedValue), + OrderTransports = _orderTransports, + OrderGoods = _orderGoods, + }; + var operationResult = _id.HasValue ? _logicO.Update(model) : _logicO.Create(model); if (!operationResult) { throw new Exception("Ошибка при создании заказа.Дополнительная информация в логах."); @@ -263,12 +267,12 @@ namespace TransportLogisticForm private void button3_Click(object sender, EventArgs e) { - if (dataGridView.SelectedRows.Count == 1) + if (dataGridView1.SelectedRows.Count == 1) { var service = Program.ServiceProvider?.GetService(typeof(FormOrderGoods)); if (service is FormOrderGoods form) { - int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); + int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value); form.Id = id; form.GoodsCount = _orderGoods[id].Item2; if (form.ShowDialog() == DialogResult.OK) @@ -286,13 +290,13 @@ namespace TransportLogisticForm private void button2_Click(object sender, EventArgs e) { - if (dataGridView.SelectedRows.Count == 1) + if (dataGridView1.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { - _orderGoods?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value)); + _orderGoods?.Remove(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value)); } catch (Exception ex) { diff --git a/TransportLogistic/TransportLogisticForm/FormGood.Designer.cs b/TransportLogistic/TransportLogisticForm/FormGood.Designer.cs index 03b4d1b..39b355b 100644 --- a/TransportLogistic/TransportLogisticForm/FormGood.Designer.cs +++ b/TransportLogistic/TransportLogisticForm/FormGood.Designer.cs @@ -76,7 +76,7 @@ // // textBox1 // - textBox1.Location = new Point(98, 107); + textBox1.Location = new Point(98, 65); textBox1.Name = "textBox1"; textBox1.Size = new Size(269, 27); textBox1.TabIndex = 6; @@ -92,7 +92,7 @@ // // textBox2 // - textBox2.Location = new Point(98, 65); + textBox2.Location = new Point(98, 103); textBox2.Name = "textBox2"; textBox2.Size = new Size(269, 27); textBox2.TabIndex = 8; diff --git a/TransportLogistic/TransportLogisticForm/FormMain.Designer.cs b/TransportLogistic/TransportLogisticForm/FormMain.Designer.cs index 6dea0c1..87d8d15 100644 --- a/TransportLogistic/TransportLogisticForm/FormMain.Designer.cs +++ b/TransportLogistic/TransportLogisticForm/FormMain.Designer.cs @@ -67,28 +67,28 @@ namespace TransportLogisticForm // ЗаказчикиToolStripMenuItem // ЗаказчикиToolStripMenuItem.Name = "ЗаказчикиToolStripMenuItem"; - ЗаказчикиToolStripMenuItem.Size = new Size(180, 24); + ЗаказчикиToolStripMenuItem.Size = new Size(152, 24); ЗаказчикиToolStripMenuItem.Text = "Заказчики"; ЗаказчикиToolStripMenuItem.Click += ЗаказчикиToolStripMenuItem_Click; // // ТоварыToolStripMenuItem // ТоварыToolStripMenuItem.Name = "ТоварыToolStripMenuItem"; - ТоварыToolStripMenuItem.Size = new Size(180, 24); + ТоварыToolStripMenuItem.Size = new Size(152, 24); ТоварыToolStripMenuItem.Text = "Товары"; ТоварыToolStripMenuItem.Click += ТоварыToolStripMenuItem_Click; // // СкладыToolStripMenuItem // СкладыToolStripMenuItem.Name = "СкладыToolStripMenuItem"; - СкладыToolStripMenuItem.Size = new Size(180, 24); + СкладыToolStripMenuItem.Size = new Size(152, 24); СкладыToolStripMenuItem.Text = "Склады"; СкладыToolStripMenuItem.Click += СкладыToolStripMenuItem_Click; // // ТранспортToolStripMenuItem // ТранспортToolStripMenuItem.Name = "ТранспортToolStripMenuItem"; - ТранспортToolStripMenuItem.Size = new Size(180, 24); + ТранспортToolStripMenuItem.Size = new Size(152, 24); ТранспортToolStripMenuItem.Text = "Транспорт"; ТранспортToolStripMenuItem.Click += ТранспортToolStripMenuItem_Click; // @@ -126,7 +126,7 @@ namespace TransportLogisticForm buttonTakeOrderInWork.Name = "buttonTakeOrderInWork"; buttonTakeOrderInWork.Size = new Size(205, 53); buttonTakeOrderInWork.TabIndex = 2; - buttonTakeOrderInWork.Text = "Заказ выполняется"; + buttonTakeOrderInWork.Text = "Заказ в пути"; buttonTakeOrderInWork.UseVisualStyleBackColor = true; buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click; // @@ -136,7 +136,7 @@ namespace TransportLogisticForm buttonOrderReady.Name = "buttonOrderReady"; buttonOrderReady.Size = new Size(205, 53); buttonOrderReady.TabIndex = 3; - buttonOrderReady.Text = "Заказ готов"; + buttonOrderReady.Text = "Заказ доставлен"; buttonOrderReady.UseVisualStyleBackColor = true; buttonOrderReady.Click += buttonOrderReady_Click; // diff --git a/TransportLogistic/TransportLogisticForm/FormMain.cs b/TransportLogistic/TransportLogisticForm/FormMain.cs index 87e8fde..1cd0019 100644 --- a/TransportLogistic/TransportLogisticForm/FormMain.cs +++ b/TransportLogistic/TransportLogisticForm/FormMain.cs @@ -33,8 +33,8 @@ namespace TransportLogisticForm dataGridView.Columns["FinishStorageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns["CustomerId"].Visible = false; dataGridView.Columns["CustomerName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - dataGridView.Columns["OrderTransports"].Visible = true; - dataGridView.Columns["OrderGoods"].Visible = true; + dataGridView.Columns["OrderTransports"].Visible = false; + dataGridView.Columns["OrderGoods"].Visible = false; } } catch (Exception ex) diff --git a/TransportLogistic/TransportLogisticForm/FormOrderGoods.cs b/TransportLogistic/TransportLogisticForm/FormOrderGoods.cs index a469957..fa638eb 100644 --- a/TransportLogistic/TransportLogisticForm/FormOrderGoods.cs +++ b/TransportLogistic/TransportLogisticForm/FormOrderGoods.cs @@ -29,6 +29,7 @@ namespace TransportLogisticForm public int GoodsCount { get { return Convert.ToInt32(textBox.Text); } set { textBox.Text = value.ToString(); } } public FormOrderGoods(IGoodLogic logic) { + InitializeComponent(); _list = logic.ReadList(null); if (_list != null) { @@ -37,7 +38,6 @@ namespace TransportLogisticForm comboBox.DataSource = _list; comboBox.SelectedItem = null; } - InitializeComponent(); } private void buttonSave_Click(object sender, EventArgs e) diff --git a/TransportLogistic/TransportLogisticForm/FormOrderTransports.cs b/TransportLogistic/TransportLogisticForm/FormOrderTransports.cs index 525fec9..a2229ec 100644 --- a/TransportLogistic/TransportLogisticForm/FormOrderTransports.cs +++ b/TransportLogistic/TransportLogisticForm/FormOrderTransports.cs @@ -29,6 +29,7 @@ namespace TransportLogisticForm public int TransportsCount { get { return Convert.ToInt32(textBox.Text); } set { textBox.Text = value.ToString(); } } public FormOrderTransports(ITransportLogic logic) { + InitializeComponent(); _list = logic.ReadList(null); if (_list != null) { @@ -37,7 +38,6 @@ namespace TransportLogisticForm comboBox.DataSource = _list; comboBox.SelectedItem = null; } - InitializeComponent(); } private void buttonSave_Click(object sender, EventArgs e)