работает вывод полей для редактирования
This commit is contained in:
parent
e507aa62a2
commit
061773baca
@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Components" Version="1.0.0" />
|
||||
<PackageReference Include="Components" Version="1.0.1" />
|
||||
<PackageReference Include="FixedWinFormsLibrary1" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
||||
|
@ -29,30 +29,33 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
textComponentOrderSum = new WinFormsLibrary1.TextComponent();
|
||||
textBoxName = new TextBox();
|
||||
textBoxFIO = new TextBox();
|
||||
labelFIO = new Label();
|
||||
labelGoodDescription = new Label();
|
||||
textBoxGoodDescription = new TextBox();
|
||||
labelOrderSum = new Label();
|
||||
labelOrderStatus = new Label();
|
||||
selectComponentOrderStatus = new UserComponentsOption19.SelectComponent();
|
||||
buttonClose = new Button();
|
||||
buttonSave = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textComponentOrderSum
|
||||
//
|
||||
textComponentOrderSum.Location = new Point(213, -34);
|
||||
textComponentOrderSum.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
textComponentOrderSum.Location = new Point(213, -35);
|
||||
textComponentOrderSum.Margin = new Padding(3, 4, 3, 4);
|
||||
textComponentOrderSum.Name = "textComponentOrderSum";
|
||||
textComponentOrderSum.Size = new Size(351, 199);
|
||||
textComponentOrderSum.TabIndex = 0;
|
||||
textComponentOrderSum.TextValue = 0;
|
||||
//
|
||||
// textBoxName
|
||||
// textBoxFIO
|
||||
//
|
||||
textBoxName.Location = new Point(60, 9);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(346, 27);
|
||||
textBoxName.TabIndex = 1;
|
||||
textBoxFIO.Location = new Point(60, 9);
|
||||
textBoxFIO.Name = "textBoxFIO";
|
||||
textBoxFIO.Size = new Size(346, 27);
|
||||
textBoxFIO.TabIndex = 1;
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
@ -67,7 +70,7 @@
|
||||
//
|
||||
labelGoodDescription.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelGoodDescription.AutoSize = true;
|
||||
labelGoodDescription.Location = new Point(433, 16);
|
||||
labelGoodDescription.Location = new Point(430, 16);
|
||||
labelGoodDescription.Name = "labelGoodDescription";
|
||||
labelGoodDescription.Size = new Size(131, 20);
|
||||
labelGoodDescription.TabIndex = 7;
|
||||
@ -76,16 +79,16 @@
|
||||
// textBoxGoodDescription
|
||||
//
|
||||
textBoxGoodDescription.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
textBoxGoodDescription.Location = new Point(585, 9);
|
||||
textBoxGoodDescription.Location = new Point(582, 9);
|
||||
textBoxGoodDescription.Name = "textBoxGoodDescription";
|
||||
textBoxGoodDescription.Size = new Size(378, 27);
|
||||
textBoxGoodDescription.TabIndex = 8;
|
||||
//
|
||||
// labelOrderSum
|
||||
//
|
||||
labelOrderSum.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelOrderSum.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
labelOrderSum.AutoSize = true;
|
||||
labelOrderSum.Location = new Point(248, 60);
|
||||
labelOrderSum.Location = new Point(248, 59);
|
||||
labelOrderSum.Name = "labelOrderSum";
|
||||
labelOrderSum.Size = new Size(104, 20);
|
||||
labelOrderSum.TabIndex = 9;
|
||||
@ -93,9 +96,9 @@
|
||||
//
|
||||
// labelOrderStatus
|
||||
//
|
||||
labelOrderStatus.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
labelOrderStatus.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
labelOrderStatus.AutoSize = true;
|
||||
labelOrderStatus.Location = new Point(12, 60);
|
||||
labelOrderStatus.Location = new Point(12, 59);
|
||||
labelOrderStatus.Name = "labelOrderStatus";
|
||||
labelOrderStatus.Size = new Size(101, 20);
|
||||
labelOrderStatus.TabIndex = 10;
|
||||
@ -103,27 +106,55 @@
|
||||
//
|
||||
// selectComponentOrderStatus
|
||||
//
|
||||
selectComponentOrderStatus.Location = new Point(12, 92);
|
||||
selectComponentOrderStatus.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
selectComponentOrderStatus.Location = new Point(12, 91);
|
||||
selectComponentOrderStatus.Name = "selectComponentOrderStatus";
|
||||
selectComponentOrderStatus.SelectedValue = "";
|
||||
selectComponentOrderStatus.Size = new Size(189, 36);
|
||||
selectComponentOrderStatus.TabIndex = 11;
|
||||
//
|
||||
// buttonClose
|
||||
//
|
||||
buttonClose.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonClose.BackColor = Color.IndianRed;
|
||||
buttonClose.ForeColor = SystemColors.ButtonHighlight;
|
||||
buttonClose.Location = new Point(582, 80);
|
||||
buttonClose.Name = "buttonClose";
|
||||
buttonClose.Size = new Size(138, 47);
|
||||
buttonClose.TabIndex = 12;
|
||||
buttonClose.Text = "Закрыть";
|
||||
buttonClose.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonSave.BackColor = Color.LightGreen;
|
||||
buttonSave.ForeColor = Color.DarkGreen;
|
||||
buttonSave.Location = new Point(822, 80);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(138, 47);
|
||||
buttonSave.TabIndex = 13;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// FormEdit_Add
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1035, 356);
|
||||
ClientSize = new Size(1032, 166);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(buttonClose);
|
||||
Controls.Add(selectComponentOrderStatus);
|
||||
Controls.Add(labelOrderStatus);
|
||||
Controls.Add(labelOrderSum);
|
||||
Controls.Add(textBoxGoodDescription);
|
||||
Controls.Add(labelGoodDescription);
|
||||
Controls.Add(labelFIO);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(textBoxFIO);
|
||||
Controls.Add(textComponentOrderSum);
|
||||
Name = "FormEdit_Add";
|
||||
Text = "Редактировать/добавить сущность";
|
||||
Load += FormEdit_Add_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -131,7 +162,7 @@
|
||||
#endregion
|
||||
|
||||
private WinFormsLibrary1.TextComponent textComponentOrderSum;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxFIO;
|
||||
private TextBox textBoxLastName;
|
||||
private TextBox textBoxPatronymic;
|
||||
private Label labelFIO;
|
||||
@ -142,5 +173,7 @@
|
||||
private Label labelOrderSum;
|
||||
private Label labelOrderStatus;
|
||||
private UserComponentsOption19.SelectComponent selectComponentOrderStatus;
|
||||
private Button buttonClose;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
@ -1,20 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShopContracts.BindingModels;
|
||||
using ShopContracts.BusinessLogicContracts;
|
||||
using ShopContracts.SearchModels;
|
||||
|
||||
namespace AppShopInternetOption19
|
||||
{
|
||||
public partial class FormEdit_Add : Form
|
||||
{
|
||||
public FormEdit_Add()
|
||||
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IOrderStatusLogic _orderStatusLogic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
public FormEdit_Add(IOrderLogic orderLogic, IOrderStatusLogic orderStatusLogic)
|
||||
{
|
||||
_orderLogic = orderLogic;
|
||||
_orderStatusLogic = orderStatusLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void FormEdit_Add_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_id != 0 && _id != null)
|
||||
{
|
||||
var element = _orderLogic.ReadElement(new OrderSearchModel { Id = _id.Value });
|
||||
if (element != null)
|
||||
{
|
||||
textBoxFIO.Text = element.FIO;
|
||||
textBoxGoodDescription.Text = element.OrderDescription;
|
||||
selectComponentOrderStatus.SelectedValue = element.OrderStatus;
|
||||
textComponentOrderSum.TextValue = Convert.ToInt32(element.OrderSumm);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@
|
||||
редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
|
||||
редактироватьToolStripMenuItem.Size = new Size(125, 24);
|
||||
редактироватьToolStripMenuItem.Text = "Редактировать";
|
||||
редактироватьToolStripMenuItem.Click += редактироватьToolStripMenuItem_Click;
|
||||
//
|
||||
// удалитьToolStripMenuItem
|
||||
//
|
||||
|
@ -21,16 +21,14 @@ namespace AppShopInternetOption19
|
||||
FIO = "Ïóïêèí âàñèëèé çàëóïêèí",
|
||||
OrderDescription = "Description",
|
||||
OrderStatus = "íå ãîòîâ",
|
||||
OrderSumm = "20 ðóáë¸â",
|
||||
OrderSumm = "20",
|
||||
};
|
||||
_orderLogic.Create(order);
|
||||
}
|
||||
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void äîáàâèòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -41,6 +39,7 @@ namespace AppShopInternetOption19
|
||||
return;
|
||||
}
|
||||
|
||||
form.Id = 0;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
@ -75,5 +74,22 @@ namespace AppShopInternetOption19
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ðåäàêòèðîâàòüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormEdit_Add));
|
||||
if (!(service is FormEdit_Add form))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var selectedOrder = userControlTreeView.GetObjectSelectedNode<OrderBindingModel>();
|
||||
form.Id = Convert.ToInt32(selectedOrder.Id);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user