Сданная 1 л
This commit is contained in:
parent
40fb3142eb
commit
39ae477367
@ -86,7 +86,7 @@ namespace AbstractSoftwareInstallationBusinessLogic.BusinessLogic
|
||||
return false;
|
||||
}
|
||||
model.Status = _newStatus;
|
||||
if (model.Status == OrderStatus.Готов) model.DateImplement = DateTime.Now;
|
||||
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
|
||||
else
|
||||
{
|
||||
model.DateImplement = viewModel.DateImplement;
|
||||
|
@ -11,9 +11,9 @@ namespace AbstractSoftwareInstallationContracts.ViewModels
|
||||
public class PackageViewModel : IPackageModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Package Name")]
|
||||
[DisplayName("Имя пакета")]
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
[DisplayName("Price")]
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
public Dictionary<int, (ISoftwareModel, int)> PackageSoftware
|
||||
{
|
||||
|
@ -83,6 +83,7 @@ namespace AbstractSoftwareInstallationListImplement.Implements
|
||||
component.Update(model);
|
||||
return component.GetViewModel;
|
||||
}
|
||||
throw new ArgumentNullException("Новая цена", nameof(model.Cost));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@
|
||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(153, 23);
|
||||
this.buttonIssuedOrder.TabIndex = 5;
|
||||
this.buttonIssuedOrder.Text = "Заказ принят";
|
||||
this.buttonIssuedOrder.Text = "Заказ выдан";
|
||||
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonIssuedOrder.Click += new System.EventHandler(this.buttonIssuedOrder_Click);
|
||||
//
|
||||
|
@ -145,8 +145,8 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
private void packageToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPackage));
|
||||
if (service is FormPackage form)
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormPackages));
|
||||
if (service is FormPackages form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
@ -60,7 +60,12 @@ namespace SoftwareInstallationView
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var pc in _packageSoftwares)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.SoftwareName, pc.Value.Item2 });
|
||||
dataGridView.Rows.Add(new object[]
|
||||
{
|
||||
pc.Key,
|
||||
pc.Value.Item1.
|
||||
SoftwareName,
|
||||
pc.Value.Item2 });
|
||||
}
|
||||
textBoxPrice.Text = CalcPrice().ToString();
|
||||
}
|
||||
@ -184,9 +189,7 @@ namespace SoftwareInstallationView
|
||||
Id = _id ?? 0,
|
||||
PackageName = textBoxName.Text,
|
||||
Price = Convert.ToDouble(textBoxPrice.Text),
|
||||
PackageSoftware = _packageSoftwares
|
||||
};
|
||||
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
|
||||
if (!operationResult)
|
||||
@ -207,7 +210,8 @@ namespace SoftwareInstallationView
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
private double CalcPrice()
|
||||
{
|
||||
|
@ -29,11 +29,11 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.buttonUpdate = new System.Windows.Forms.Button();
|
||||
this.buttonDelete = new System.Windows.Forms.Button();
|
||||
this.buttonEdit = new System.Windows.Forms.Button();
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -49,6 +49,14 @@
|
||||
this.dataGridView.Size = new System.Drawing.Size(445, 373);
|
||||
this.dataGridView.TabIndex = 10;
|
||||
//
|
||||
// ColumnId
|
||||
//
|
||||
this.ColumnId.FillWeight = 200F;
|
||||
this.ColumnId.HeaderText = "Id";
|
||||
this.ColumnId.Name = "ColumnId";
|
||||
this.ColumnId.Visible = false;
|
||||
this.ColumnId.Width = 200;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(461, 193);
|
||||
@ -57,6 +65,7 @@
|
||||
this.buttonUpdate.TabIndex = 9;
|
||||
this.buttonUpdate.Text = "Обновить";
|
||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||
this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpd_Click);
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
@ -66,6 +75,7 @@
|
||||
this.buttonDelete.TabIndex = 8;
|
||||
this.buttonDelete.Text = "Удалить";
|
||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||
this.buttonDelete.Click += new System.EventHandler(this.ButtonDel_Click);
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
@ -85,14 +95,7 @@
|
||||
this.buttonAdd.TabIndex = 6;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// ColumnId
|
||||
//
|
||||
this.ColumnId.FillWeight = 200F;
|
||||
this.ColumnId.HeaderText = "Id";
|
||||
this.ColumnId.Name = "ColumnId";
|
||||
this.ColumnId.Visible = false;
|
||||
this.ColumnId.Width = 200;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||
//
|
||||
// FormPackages
|
||||
//
|
||||
|
@ -14,6 +14,7 @@ namespace SoftwareInstallationView
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
LoadData();
|
||||
}
|
||||
private void FormPackages_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -29,7 +30,7 @@ namespace SoftwareInstallationView
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["PackageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["PackageSoftwares"].Visible = false;
|
||||
dataGridView.Columns["PackageSoftware"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка пакетов");
|
||||
}
|
||||
@ -53,7 +54,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
LoadData();
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -84,10 +85,6 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
}
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
LoadData();
|
||||
}
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -88,7 +88,20 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormSoftware));
|
||||
|
||||
if (service is FormSoftware form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user