ляля формочки
This commit is contained in:
parent
19b0f55a6f
commit
e07e520f57
@ -12,7 +12,7 @@ using TransportLogisticDatabaseImplement;
|
|||||||
namespace TransportLogisticDatabaseImplement.Migrations
|
namespace TransportLogisticDatabaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(TransportLogisticDatabase))]
|
[DbContext(typeof(TransportLogisticDatabase))]
|
||||||
[Migration("20240514142102_InitialCreate")]
|
[Migration("20240514175153_InitialCreate")]
|
||||||
partial class InitialCreate
|
partial class InitialCreate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -100,7 +100,7 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("StorageId")
|
b.Property<int?>("StorageId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
@ -207,21 +207,15 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer")
|
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", null)
|
||||||
.WithMany("Order")
|
.WithMany("Order")
|
||||||
.HasForeignKey("CustomerId")
|
.HasForeignKey("CustomerId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "Storage")
|
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", null)
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("StorageId")
|
.HasForeignKey("StorageId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Customer");
|
|
||||||
|
|
||||||
b.Navigation("Storage");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
@ -81,7 +81,7 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
StartStorageId = table.Column<int>(type: "int", nullable: false),
|
StartStorageId = table.Column<int>(type: "int", nullable: false),
|
||||||
FinishStorageId = table.Column<int>(type: "int", nullable: false),
|
FinishStorageId = table.Column<int>(type: "int", nullable: false),
|
||||||
CustomerId = table.Column<int>(type: "int", nullable: false),
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
||||||
StorageId = table.Column<int>(type: "int", nullable: false)
|
StorageId = table.Column<int>(type: "int", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@ -96,8 +96,7 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
name: "FK_Orders_Storages_StorageId",
|
name: "FK_Orders_Storages_StorageId",
|
||||||
column: x => x.StorageId,
|
column: x => x.StorageId,
|
||||||
principalTable: "Storages",
|
principalTable: "Storages",
|
||||||
principalColumn: "Id",
|
principalColumn: "Id");
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
@ -97,7 +97,7 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
b.Property<int>("Status")
|
b.Property<int>("Status")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("StorageId")
|
b.Property<int?>("StorageId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
@ -204,21 +204,15 @@ namespace TransportLogisticDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", "Customer")
|
b.HasOne("TransportLogisticDatabaseImplement.Models.Customer", null)
|
||||||
.WithMany("Order")
|
.WithMany("Order")
|
||||||
.HasForeignKey("CustomerId")
|
.HasForeignKey("CustomerId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", "Storage")
|
b.HasOne("TransportLogisticDatabaseImplement.Models.Storage", null)
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("StorageId")
|
.HasForeignKey("StorageId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Customer");
|
|
||||||
|
|
||||||
b.Navigation("Storage");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
modelBuilder.Entity("TransportLogisticDatabaseImplement.Models.OrderGood", b =>
|
||||||
|
@ -21,7 +21,6 @@ namespace TransportLogisticDatabaseImplement.Models
|
|||||||
public int StartStorageId { get; set; }
|
public int StartStorageId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int FinishStorageId { get; set; }
|
public int FinishStorageId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int CustomerId { get; set; }
|
public int CustomerId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -55,7 +55,6 @@ namespace TransportLogisticForm
|
|||||||
if (startList != null)
|
if (startList != null)
|
||||||
{
|
{
|
||||||
comboBoxStart.DisplayMember = "Name";
|
comboBoxStart.DisplayMember = "Name";
|
||||||
comboBoxStart.DisplayMember = "Address";
|
|
||||||
comboBoxStart.ValueMember = "Id";
|
comboBoxStart.ValueMember = "Id";
|
||||||
comboBoxStart.DataSource = startList;
|
comboBoxStart.DataSource = startList;
|
||||||
comboBoxStart.SelectedItem = null;
|
comboBoxStart.SelectedItem = null;
|
||||||
@ -71,7 +70,6 @@ namespace TransportLogisticForm
|
|||||||
if (finishList != null)
|
if (finishList != null)
|
||||||
{
|
{
|
||||||
comboBoxFinish.DisplayMember = "Name";
|
comboBoxFinish.DisplayMember = "Name";
|
||||||
comboBoxFinish.DisplayMember = "Address";
|
|
||||||
comboBoxFinish.ValueMember = "Id";
|
comboBoxFinish.ValueMember = "Id";
|
||||||
comboBoxFinish.DataSource = finishList;
|
comboBoxFinish.DataSource = finishList;
|
||||||
comboBoxFinish.SelectedItem = null;
|
comboBoxFinish.SelectedItem = null;
|
||||||
@ -86,12 +84,10 @@ namespace TransportLogisticForm
|
|||||||
var customerList = _logicC.ReadList(null);
|
var customerList = _logicC.ReadList(null);
|
||||||
if (customerList != null)
|
if (customerList != null)
|
||||||
{
|
{
|
||||||
comboBoxFinish.DisplayMember = "Name";
|
comboBoxCustomer.DisplayMember = "Lastname";
|
||||||
comboBoxFinish.DisplayMember = "Lastname";
|
comboBoxCustomer.ValueMember = "Id";
|
||||||
comboBoxFinish.DisplayMember = "Email";
|
comboBoxCustomer.DataSource = customerList;
|
||||||
comboBoxFinish.ValueMember = "Id";
|
comboBoxCustomer.SelectedItem = null;
|
||||||
comboBoxFinish.DataSource = customerList;
|
|
||||||
comboBoxFinish.SelectedItem = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -31,8 +31,8 @@
|
|||||||
dataGridView1 = new DataGridView();
|
dataGridView1 = new DataGridView();
|
||||||
buttonUpd = new Button();
|
buttonUpd = new Button();
|
||||||
buttonDel = new Button();
|
buttonDel = new Button();
|
||||||
button1 = new Button();
|
buttonEdit = new Button();
|
||||||
button2 = new Button();
|
buttonAdd = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -52,7 +52,7 @@
|
|||||||
//
|
//
|
||||||
// buttonUpd
|
// buttonUpd
|
||||||
//
|
//
|
||||||
buttonUpd.Location = new Point(556, 166);
|
buttonUpd.Location = new Point(556, 252);
|
||||||
buttonUpd.Margin = new Padding(5, 4, 5, 4);
|
buttonUpd.Margin = new Padding(5, 4, 5, 4);
|
||||||
buttonUpd.Name = "buttonUpd";
|
buttonUpd.Name = "buttonUpd";
|
||||||
buttonUpd.Size = new Size(113, 53);
|
buttonUpd.Size = new Size(113, 53);
|
||||||
@ -63,7 +63,7 @@
|
|||||||
//
|
//
|
||||||
// buttonDel
|
// buttonDel
|
||||||
//
|
//
|
||||||
buttonDel.Location = new Point(556, 105);
|
buttonDel.Location = new Point(556, 191);
|
||||||
buttonDel.Margin = new Padding(5, 4, 5, 4);
|
buttonDel.Margin = new Padding(5, 4, 5, 4);
|
||||||
buttonDel.Name = "buttonDel";
|
buttonDel.Name = "buttonDel";
|
||||||
buttonDel.Size = new Size(113, 53);
|
buttonDel.Size = new Size(113, 53);
|
||||||
@ -72,36 +72,39 @@
|
|||||||
buttonDel.UseVisualStyleBackColor = true;
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
buttonDel.Click += buttonDel_Click;
|
buttonDel.Click += buttonDel_Click;
|
||||||
//
|
//
|
||||||
// button1
|
// buttonEdit
|
||||||
//
|
//
|
||||||
button1.Location = new Point(574, 249);
|
buttonEdit.Location = new Point(556, 131);
|
||||||
button1.Name = "button1";
|
buttonEdit.Name = "buttonEdit";
|
||||||
button1.Size = new Size(75, 23);
|
buttonEdit.Size = new Size(113, 53);
|
||||||
button1.TabIndex = 11;
|
buttonEdit.TabIndex = 21;
|
||||||
button1.Text = "button1";
|
buttonEdit.Text = "Изменить";
|
||||||
button1.UseVisualStyleBackColor = true;
|
buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
buttonEdit.Click += buttonEdit_Click;
|
||||||
//
|
//
|
||||||
// button2
|
// buttonAdd
|
||||||
//
|
//
|
||||||
button2.Location = new Point(579, 316);
|
buttonAdd.Location = new Point(556, 72);
|
||||||
button2.Name = "button2";
|
buttonAdd.Name = "buttonAdd";
|
||||||
button2.Size = new Size(75, 23);
|
buttonAdd.Size = new Size(113, 53);
|
||||||
button2.TabIndex = 12;
|
buttonAdd.TabIndex = 20;
|
||||||
button2.Text = "button2";
|
buttonAdd.Text = "Добавить";
|
||||||
button2.UseVisualStyleBackColor = true;
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
//
|
//
|
||||||
// FormCustomers
|
// FormCustomers
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(683, 498);
|
ClientSize = new Size(683, 498);
|
||||||
Controls.Add(button2);
|
Controls.Add(buttonEdit);
|
||||||
Controls.Add(button1);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(buttonUpd);
|
Controls.Add(buttonUpd);
|
||||||
Controls.Add(buttonDel);
|
Controls.Add(buttonDel);
|
||||||
Controls.Add(dataGridView1);
|
Controls.Add(dataGridView1);
|
||||||
Name = "FormCustomers";
|
Name = "FormCustomers";
|
||||||
Text = "Заказчики";
|
Text = "Заказчики";
|
||||||
|
Load += FormCustomers_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
@ -111,7 +114,7 @@
|
|||||||
private DataGridView dataGridView1;
|
private DataGridView dataGridView1;
|
||||||
private Button buttonUpd;
|
private Button buttonUpd;
|
||||||
private Button buttonDel;
|
private Button buttonDel;
|
||||||
private Button button1;
|
private Button buttonEdit;
|
||||||
private Button button2;
|
private Button buttonAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,5 +64,33 @@ namespace TransportLogisticForm
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCustomer));
|
||||||
|
if (service is FormCustomer form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView1.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCustomer));
|
||||||
|
if (service is FormCustomer form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
textBoxName = new TextBox();
|
textBoxName = new TextBox();
|
||||||
buttonCancel = new Button();
|
buttonCancel = new Button();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
|
textBox1 = new TextBox();
|
||||||
|
label2 = new Label();
|
||||||
|
textBox2 = new TextBox();
|
||||||
|
label3 = new Label();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -52,7 +56,7 @@
|
|||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(272, 68);
|
buttonCancel.Location = new Point(272, 149);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(95, 43);
|
buttonCancel.Size = new Size(95, 43);
|
||||||
buttonCancel.TabIndex = 3;
|
buttonCancel.TabIndex = 3;
|
||||||
@ -62,7 +66,7 @@
|
|||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(171, 68);
|
buttonSave.Location = new Point(171, 149);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(95, 43);
|
buttonSave.Size = new Size(95, 43);
|
||||||
buttonSave.TabIndex = 4;
|
buttonSave.TabIndex = 4;
|
||||||
@ -70,17 +74,53 @@
|
|||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += buttonSave_Click;
|
buttonSave.Click += buttonSave_Click;
|
||||||
//
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
textBox1.Location = new Point(98, 107);
|
||||||
|
textBox1.Name = "textBox1";
|
||||||
|
textBox1.Size = new Size(269, 27);
|
||||||
|
textBox1.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(12, 110);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(63, 20);
|
||||||
|
label2.TabIndex = 5;
|
||||||
|
label2.Text = "Размер:";
|
||||||
|
//
|
||||||
|
// textBox2
|
||||||
|
//
|
||||||
|
textBox2.Location = new Point(98, 65);
|
||||||
|
textBox2.Name = "textBox2";
|
||||||
|
textBox2.Size = new Size(269, 27);
|
||||||
|
textBox2.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(12, 68);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(36, 20);
|
||||||
|
label3.TabIndex = 7;
|
||||||
|
label3.Text = "Вес:";
|
||||||
|
//
|
||||||
// FormGood
|
// FormGood
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(391, 132);
|
ClientSize = new Size(391, 204);
|
||||||
|
Controls.Add(textBox2);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(textBox1);
|
||||||
|
Controls.Add(label2);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(textBoxName);
|
Controls.Add(textBoxName);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Name = "FormGood";
|
Name = "FormGood";
|
||||||
Text = "Товар";
|
Text = "Создание товара";
|
||||||
Load += FormGood_Load;
|
Load += FormGood_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@ -92,5 +132,9 @@
|
|||||||
private TextBox textBoxName;
|
private TextBox textBoxName;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
|
private TextBox textBox1;
|
||||||
|
private Label label2;
|
||||||
|
private TextBox textBox2;
|
||||||
|
private Label label3;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ namespace TransportLogisticForm
|
|||||||
if (view != null)
|
if (view != null)
|
||||||
{
|
{
|
||||||
textBoxName.Text = view.Name;
|
textBoxName.Text = view.Name;
|
||||||
|
textBox2.Text = view.Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -47,6 +47,8 @@ namespace TransportLogisticForm
|
|||||||
{
|
{
|
||||||
Id = _id ?? 0,
|
Id = _id ?? 0,
|
||||||
Name = textBoxName.Text,
|
Name = textBoxName.Text,
|
||||||
|
Weight = Convert.ToDouble(textBox1.Text),
|
||||||
|
Size = textBox2.Text
|
||||||
};
|
};
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
Controls.Add(dataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "FormGoods";
|
Name = "FormGoods";
|
||||||
Text = "Товары";
|
Text = "Товары";
|
||||||
|
Load += FormGoods_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace TransportLogisticForm
|
|||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
dataGridView.Columns["Id"].Visible = true;
|
||||||
dataGridView.Columns["Status"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["Status"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["DateCreate"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["DateCreate"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["DateDelivered"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["DateDelivered"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
@ -33,8 +33,8 @@ namespace TransportLogisticForm
|
|||||||
dataGridView.Columns["FinishStorageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["FinishStorageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["CustomerId"].Visible = false;
|
dataGridView.Columns["CustomerId"].Visible = false;
|
||||||
dataGridView.Columns["CustomerName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["CustomerName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["OrderTransports"].Visible = false;
|
dataGridView.Columns["OrderTransports"].Visible = true;
|
||||||
dataGridView.Columns["OrderGoods"].Visible = false;
|
dataGridView.Columns["OrderGoods"].Visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -28,35 +28,17 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
button2 = new Button();
|
|
||||||
button1 = new Button();
|
|
||||||
buttonUpd = new Button();
|
buttonUpd = new Button();
|
||||||
buttonDel = new Button();
|
buttonDel = new Button();
|
||||||
dataGridView1 = new DataGridView();
|
dataGridView1 = new DataGridView();
|
||||||
|
buttonEdit = new Button();
|
||||||
|
buttonAdd = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// button2
|
|
||||||
//
|
|
||||||
button2.Location = new Point(576, 315);
|
|
||||||
button2.Name = "button2";
|
|
||||||
button2.Size = new Size(75, 23);
|
|
||||||
button2.TabIndex = 17;
|
|
||||||
button2.Text = "button2";
|
|
||||||
button2.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
button1.Location = new Point(571, 248);
|
|
||||||
button1.Name = "button1";
|
|
||||||
button1.Size = new Size(75, 23);
|
|
||||||
button1.TabIndex = 16;
|
|
||||||
button1.Text = "button1";
|
|
||||||
button1.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonUpd
|
// buttonUpd
|
||||||
//
|
//
|
||||||
buttonUpd.Location = new Point(553, 165);
|
buttonUpd.Location = new Point(556, 252);
|
||||||
buttonUpd.Margin = new Padding(5, 4, 5, 4);
|
buttonUpd.Margin = new Padding(5, 4, 5, 4);
|
||||||
buttonUpd.Name = "buttonUpd";
|
buttonUpd.Name = "buttonUpd";
|
||||||
buttonUpd.Size = new Size(113, 53);
|
buttonUpd.Size = new Size(113, 53);
|
||||||
@ -67,7 +49,7 @@
|
|||||||
//
|
//
|
||||||
// buttonDel
|
// buttonDel
|
||||||
//
|
//
|
||||||
buttonDel.Location = new Point(553, 104);
|
buttonDel.Location = new Point(556, 191);
|
||||||
buttonDel.Margin = new Padding(5, 4, 5, 4);
|
buttonDel.Margin = new Padding(5, 4, 5, 4);
|
||||||
buttonDel.Name = "buttonDel";
|
buttonDel.Name = "buttonDel";
|
||||||
buttonDel.Size = new Size(113, 53);
|
buttonDel.Size = new Size(113, 53);
|
||||||
@ -90,28 +72,48 @@
|
|||||||
dataGridView1.Size = new Size(529, 498);
|
dataGridView1.Size = new Size(529, 498);
|
||||||
dataGridView1.TabIndex = 13;
|
dataGridView1.TabIndex = 13;
|
||||||
//
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
buttonEdit.Location = new Point(556, 131);
|
||||||
|
buttonEdit.Name = "buttonEdit";
|
||||||
|
buttonEdit.Size = new Size(113, 53);
|
||||||
|
buttonEdit.TabIndex = 19;
|
||||||
|
buttonEdit.Text = "Изменить";
|
||||||
|
buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
buttonEdit.Click += buttonEdit_Click;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(556, 72);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(113, 53);
|
||||||
|
buttonAdd.TabIndex = 18;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
// FormStorages
|
// FormStorages
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(683, 499);
|
ClientSize = new Size(683, 499);
|
||||||
Controls.Add(button2);
|
Controls.Add(buttonEdit);
|
||||||
Controls.Add(button1);
|
Controls.Add(buttonAdd);
|
||||||
Controls.Add(buttonUpd);
|
Controls.Add(buttonUpd);
|
||||||
Controls.Add(buttonDel);
|
Controls.Add(buttonDel);
|
||||||
Controls.Add(dataGridView1);
|
Controls.Add(dataGridView1);
|
||||||
Name = "FormStorages";
|
Name = "FormStorages";
|
||||||
Text = "Склады";
|
Text = "Склады";
|
||||||
|
Load += FormStorages_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Button button2;
|
|
||||||
private Button button1;
|
|
||||||
private Button buttonUpd;
|
private Button buttonUpd;
|
||||||
private Button buttonDel;
|
private Button buttonDel;
|
||||||
private DataGridView dataGridView1;
|
private DataGridView dataGridView1;
|
||||||
|
private Button buttonEdit;
|
||||||
|
private Button buttonAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using TransportLogisticContracts.BindingModels;
|
using System.Windows.Forms;
|
||||||
|
using TransportLogisticContracts.BindingModels;
|
||||||
using TransportLogisticContracts.BusinessLogicsContracts;
|
using TransportLogisticContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
namespace TransportLogisticForm
|
namespace TransportLogisticForm
|
||||||
@ -62,5 +63,33 @@ namespace TransportLogisticForm
|
|||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormStorage));
|
||||||
|
if (service is FormStorage form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView1.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormStorage));
|
||||||
|
if (service is FormTransport form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,13 @@
|
|||||||
buttonCancel = new Button();
|
buttonCancel = new Button();
|
||||||
textBoxName = new TextBox();
|
textBoxName = new TextBox();
|
||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
|
textBox1 = new TextBox();
|
||||||
|
label2 = new Label();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(171, 66);
|
buttonSave.Location = new Point(171, 119);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(95, 43);
|
buttonSave.Size = new Size(95, 43);
|
||||||
buttonSave.TabIndex = 8;
|
buttonSave.TabIndex = 8;
|
||||||
@ -46,7 +48,7 @@
|
|||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(272, 66);
|
buttonCancel.Location = new Point(272, 119);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(95, 43);
|
buttonCancel.Size = new Size(95, 43);
|
||||||
buttonCancel.TabIndex = 7;
|
buttonCancel.TabIndex = 7;
|
||||||
@ -56,9 +58,9 @@
|
|||||||
//
|
//
|
||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
textBoxName.Location = new Point(98, 18);
|
textBoxName.Location = new Point(56, 18);
|
||||||
textBoxName.Name = "textBoxName";
|
textBoxName.Name = "textBoxName";
|
||||||
textBoxName.Size = new Size(269, 27);
|
textBoxName.Size = new Size(311, 27);
|
||||||
textBoxName.TabIndex = 6;
|
textBoxName.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -66,21 +68,40 @@
|
|||||||
label1.AutoSize = true;
|
label1.AutoSize = true;
|
||||||
label1.Location = new Point(12, 21);
|
label1.Location = new Point(12, 21);
|
||||||
label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
label1.Size = new Size(80, 20);
|
label1.Size = new Size(38, 20);
|
||||||
label1.TabIndex = 5;
|
label1.TabIndex = 5;
|
||||||
label1.Text = "Название:";
|
label1.Text = "Тип:";
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
textBox1.Location = new Point(171, 65);
|
||||||
|
textBox1.Name = "textBox1";
|
||||||
|
textBox1.Size = new Size(196, 27);
|
||||||
|
textBox1.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(12, 68);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(144, 20);
|
||||||
|
label2.TabIndex = 9;
|
||||||
|
label2.Text = "Грузоподъемность:";
|
||||||
//
|
//
|
||||||
// FormTransport
|
// FormTransport
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(386, 131);
|
ClientSize = new Size(386, 174);
|
||||||
|
Controls.Add(textBox1);
|
||||||
|
Controls.Add(label2);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(textBoxName);
|
Controls.Add(textBoxName);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Name = "FormTransport";
|
Name = "FormTransport";
|
||||||
Text = "Транспорт";
|
Text = "Создание транспорта";
|
||||||
|
Load += FormTransports_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -91,5 +112,7 @@
|
|||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
private TextBox textBoxName;
|
private TextBox textBoxName;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
|
private TextBox textBox1;
|
||||||
|
private Label label2;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,7 +24,6 @@ namespace TransportLogisticForm
|
|||||||
if (view != null)
|
if (view != null)
|
||||||
{
|
{
|
||||||
textBoxName.Text = view.Type;
|
textBoxName.Text = view.Type;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -47,6 +46,7 @@ namespace TransportLogisticForm
|
|||||||
{
|
{
|
||||||
Id = _id ?? 0,
|
Id = _id ?? 0,
|
||||||
Type = textBoxName.Text,
|
Type = textBoxName.Text,
|
||||||
|
LoadCapacity = Convert.ToDouble(textBox1.Text)
|
||||||
};
|
};
|
||||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||||
if (!operationResult)
|
if (!operationResult)
|
||||||
|
@ -36,7 +36,7 @@ namespace TransportLogisticForm
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormGood));
|
var service = Program.ServiceProvider?.GetService(typeof(FormTransport));
|
||||||
if (service is FormTransport form)
|
if (service is FormTransport form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -50,7 +50,7 @@ namespace TransportLogisticForm
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormGood));
|
var service = Program.ServiceProvider?.GetService(typeof(FormTransport));
|
||||||
if (service is FormTransport form)
|
if (service is FormTransport form)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
@ -41,10 +41,12 @@ namespace TransportLogisticForm
|
|||||||
services.AddTransient<IGoodLogic, GoodLogic>();
|
services.AddTransient<IGoodLogic, GoodLogic>();
|
||||||
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
|
services.AddTransient<FormStorage>();
|
||||||
services.AddTransient<FormStorages>();
|
services.AddTransient<FormStorages>();
|
||||||
services.AddTransient<FormCreateOrder>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
services.AddTransient<FormGoods>();
|
services.AddTransient<FormGoods>();
|
||||||
services.AddTransient<FormGood>();
|
services.AddTransient<FormGood>();
|
||||||
|
services.AddTransient<FormCustomer>();
|
||||||
services.AddTransient<FormCustomers>();
|
services.AddTransient<FormCustomers>();
|
||||||
services.AddTransient<FormTransports>();
|
services.AddTransient<FormTransports>();
|
||||||
services.AddTransient<FormTransport>();
|
services.AddTransient<FormTransport>();
|
||||||
|
Loading…
Reference in New Issue
Block a user