лаба 1 готовя
This commit is contained in:
parent
9210394589
commit
deef66e3fc
@ -82,11 +82,11 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
if (model.PastryId <= 0)
|
if (model.PastryId <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Некорректный идентификатор мороженого", nameof(model.PastryId));
|
throw new ArgumentNullException("Некорректный идентификатор выпечки", nameof(model.PastryId));
|
||||||
}
|
}
|
||||||
if (model.Count <= 0)
|
if (model.Count <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("В заказе должно быть хотя бы одно мороженое", nameof(model.Count));
|
throw new ArgumentNullException("В заказе должно быть хотя бы одна выпечка", nameof(model.Count));
|
||||||
}
|
}
|
||||||
if (model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
|
@ -100,15 +100,15 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.PastryName))
|
if (string.IsNullOrEmpty(model.PastryName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет названия мороженого", nameof(model.PastryName));
|
throw new ArgumentNullException("Нет названия выпечки", nameof(model.PastryName));
|
||||||
}
|
}
|
||||||
if (model.Price <= 0)
|
if (model.Price <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Цена мороженого должна быть больше 0", nameof(model.Price));
|
throw new ArgumentNullException("Цена выпечки должна быть больше 0", nameof(model.Price));
|
||||||
}
|
}
|
||||||
if (model.PastryComponents == null || model.PastryComponents.Count == 0)
|
if (model.PastryComponents == null || model.PastryComponents.Count == 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Мороженое должно состоять хотя бы из одного компонента");
|
throw new ArgumentNullException("Выпечка должна состоять хотя бы из одного компонента");
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Pastry. PastryName: {PastryName}. Price: {Price}. Id: {Id}", model.PastryName, model.Price, model.Id);
|
_logger.LogInformation("Pastry. PastryName: {PastryName}. Price: {Price}. Id: {Id}", model.PastryName, model.Price, model.Id);
|
||||||
var element = _pastryStorage.GetElement(new PastrySearchModel
|
var element = _pastryStorage.GetElement(new PastrySearchModel
|
||||||
@ -117,7 +117,7 @@ namespace ConfectioneryBusinessLogic.BusinessLogics
|
|||||||
});
|
});
|
||||||
if (element != null && element.Id != model.Id)
|
if (element != null && element.Id != model.Id)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Мороженое с таким названием уже есть");
|
throw new InvalidOperationException("Выпечка с таким названием уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,32 +12,57 @@ namespace ConfectioneryListImplement
|
|||||||
{
|
{
|
||||||
internal class Order : IOrderModel
|
internal class Order : IOrderModel
|
||||||
{
|
{
|
||||||
public int PastryId => throw new NotImplementedException();
|
public int Id { get; private set; }
|
||||||
|
|
||||||
public int Count => throw new NotImplementedException();
|
public int PastryId { get; private set; }
|
||||||
|
|
||||||
public double Sum => throw new NotImplementedException();
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public OrderStatus Status => throw new NotImplementedException();
|
public double Sum { get; private set; }
|
||||||
|
|
||||||
public DateTime DateCreate => throw new NotImplementedException();
|
public OrderStatus Status { get; private set; }
|
||||||
|
|
||||||
public DateTime? DateImplement => throw new NotImplementedException();
|
public DateTime DateCreate { get; private set; }
|
||||||
|
|
||||||
public int Id => throw new NotImplementedException();
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
return new Order();
|
if (model == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Order()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
PastryId = model.PastryId,
|
||||||
|
Count = model.Count,
|
||||||
|
Sum = model.Sum,
|
||||||
|
Status = model.Status,
|
||||||
|
DateCreate = model.DateCreate,
|
||||||
|
DateImplement = model.DateImplement
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Status = model.Status;
|
||||||
|
DateImplement = model.DateImplement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
|
Id = Id,
|
||||||
|
PastryId = PastryId,
|
||||||
|
Count = Count,
|
||||||
|
Sum = Sum,
|
||||||
|
Status = Status,
|
||||||
|
DateCreate = DateCreate,
|
||||||
|
DateImplement = DateImplement
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxSum
|
// textBoxSum
|
||||||
//
|
//
|
||||||
|
this.textBoxSum.Enabled = false;
|
||||||
this.textBoxSum.Location = new System.Drawing.Point(150, 95);
|
this.textBoxSum.Location = new System.Drawing.Point(150, 95);
|
||||||
this.textBoxSum.Name = "textBoxSum";
|
this.textBoxSum.Name = "textBoxSum";
|
||||||
this.textBoxSum.Size = new System.Drawing.Size(429, 27);
|
this.textBoxSum.Size = new System.Drawing.Size(429, 27);
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||||
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
|
this.Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
|
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.groupBox = new System.Windows.Forms.GroupBox();
|
this.groupBox = new System.Windows.Forms.GroupBox();
|
||||||
this.ButtonRef = new System.Windows.Forms.Button();
|
this.ButtonRef = new System.Windows.Forms.Button();
|
||||||
this.ButtonDel = new System.Windows.Forms.Button();
|
this.ButtonDel = new System.Windows.Forms.Button();
|
||||||
@ -40,9 +43,6 @@
|
|||||||
this.ButtonCancel = new System.Windows.Forms.Button();
|
this.ButtonCancel = new System.Windows.Forms.Button();
|
||||||
this.labelName = new System.Windows.Forms.Label();
|
this.labelName = new System.Windows.Forms.Label();
|
||||||
this.labelPrice = new System.Windows.Forms.Label();
|
this.labelPrice = new System.Windows.Forms.Label();
|
||||||
this.Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Component = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.groupBox.SuspendLayout();
|
this.groupBox.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -56,6 +56,7 @@
|
|||||||
//
|
//
|
||||||
// textBoxPrice
|
// textBoxPrice
|
||||||
//
|
//
|
||||||
|
this.textBoxPrice.Enabled = false;
|
||||||
this.textBoxPrice.Location = new System.Drawing.Point(204, 64);
|
this.textBoxPrice.Location = new System.Drawing.Point(204, 64);
|
||||||
this.textBoxPrice.Name = "textBoxPrice";
|
this.textBoxPrice.Name = "textBoxPrice";
|
||||||
this.textBoxPrice.Size = new System.Drawing.Size(125, 27);
|
this.textBoxPrice.Size = new System.Drawing.Size(125, 27);
|
||||||
@ -75,6 +76,28 @@
|
|||||||
this.dataGridView.Size = new System.Drawing.Size(422, 297);
|
this.dataGridView.Size = new System.Drawing.Size(422, 297);
|
||||||
this.dataGridView.TabIndex = 2;
|
this.dataGridView.TabIndex = 2;
|
||||||
//
|
//
|
||||||
|
// Number
|
||||||
|
//
|
||||||
|
this.Number.HeaderText = "Номер";
|
||||||
|
this.Number.MinimumWidth = 6;
|
||||||
|
this.Number.Name = "Number";
|
||||||
|
this.Number.Visible = false;
|
||||||
|
this.Number.Width = 125;
|
||||||
|
//
|
||||||
|
// Component
|
||||||
|
//
|
||||||
|
this.Component.HeaderText = "Компонент";
|
||||||
|
this.Component.MinimumWidth = 6;
|
||||||
|
this.Component.Name = "Component";
|
||||||
|
this.Component.Width = 125;
|
||||||
|
//
|
||||||
|
// Count
|
||||||
|
//
|
||||||
|
this.Count.HeaderText = "Количество";
|
||||||
|
this.Count.MinimumWidth = 6;
|
||||||
|
this.Count.Name = "Count";
|
||||||
|
this.Count.Width = 125;
|
||||||
|
//
|
||||||
// groupBox
|
// groupBox
|
||||||
//
|
//
|
||||||
this.groupBox.Controls.Add(this.ButtonRef);
|
this.groupBox.Controls.Add(this.ButtonRef);
|
||||||
@ -167,28 +190,6 @@
|
|||||||
this.labelPrice.TabIndex = 10;
|
this.labelPrice.TabIndex = 10;
|
||||||
this.labelPrice.Text = "Стоимость:";
|
this.labelPrice.Text = "Стоимость:";
|
||||||
//
|
//
|
||||||
// Number
|
|
||||||
//
|
|
||||||
this.Number.HeaderText = "Номер";
|
|
||||||
this.Number.MinimumWidth = 6;
|
|
||||||
this.Number.Name = "Number";
|
|
||||||
this.Number.Visible = false;
|
|
||||||
this.Number.Width = 125;
|
|
||||||
//
|
|
||||||
// Component
|
|
||||||
//
|
|
||||||
this.Component.HeaderText = "Компонент";
|
|
||||||
this.Component.MinimumWidth = 6;
|
|
||||||
this.Component.Name = "Component";
|
|
||||||
this.Component.Width = 125;
|
|
||||||
//
|
|
||||||
// Count
|
|
||||||
//
|
|
||||||
this.Count.HeaderText = "Количество";
|
|
||||||
this.Count.MinimumWidth = 6;
|
|
||||||
this.Count.Name = "Count";
|
|
||||||
this.Count.Width = 125;
|
|
||||||
//
|
|
||||||
// FormPastry
|
// FormPastry
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
Loading…
Reference in New Issue
Block a user