public KebabItem(SizeTypeEnum sizeType, PitaTypeEnum pitaType, List <SauceTypeEnum> sauces, string comment, int quantity) { this.pitaType = pitaType; this.sizeType = sizeType; this.sauces = sauces; this.comment = comment; this.quantity = quantity; }
private void btAdd_Click(object sender, EventArgs e) { if (!checkInput()) { return; } SizeTypeEnum size; if (rbSmall.Checked) { size = SizeTypeEnum.small; } else if (rbStandart.Checked) { size = SizeTypeEnum.standart; } else { size = SizeTypeEnum.big; } PitaTypeEnum pitaType = (rbWheat.Checked ? PitaTypeEnum.wheaten : PitaTypeEnum.cheesy); List <SauceTypeEnum> sauces = GetKebabSauces(); string comment = rtbComment.Text; int quantity = int.Parse(tbCount.Text); KebabItem kebab = new KebabItem( size, pitaType, sauces, comment, quantity); currentOrder.AddNewKebabToOrder(kebab); Label newLabel = new Label(); newLabel.Name = "lbN" + labelCounter; newLabel.Left = 10; newLabel.Width = gbOrder.Width - 100; newLabel.Height = 30; if (lastLabel == null) { newLabel.Top = 20; } else { newLabel.Top = lastLabel.Bottom; } newLabel.Text = kebab.ToString(); gbOrder.Controls.Add(newLabel); Label costLabel = new Label(); costLabel.Width = 60; costLabel.Name = "costN" + labelCounter; costLabel.Left = gbOrder.Width - 70; costLabel.Top = newLabel.Top; costLabel.Text = "=" + kebab.CountCost(); gbOrder.Controls.Add(costLabel); labelCounter++; lastLabel = newLabel; clearErrorProvider(sender, e); clearInput(); }