private void cbCheckGiftSert_Click(object sender, RoutedEventArgs e) { double itog = 0; foreach (var item in db.ZakaznBludaNew) { if (item.IdZakaza == idNewZakaz) { itog += (double)item.Price; } } //itog=itog-(itog*()) Доделать использование скидочных карт и подарочных сертификатов как однвременно так и по отдельности и при выборе товара //itog = itog - (itog - (double)((GiftSertificate)cbGiftSertificate.SelectedItem).Nominal); lblItog.Content = itog; if (cbCheckSaleCart.IsChecked == true && cbSaleCart.SelectedItem != null) { SaleCarts saleCart = (SaleCarts)cbSaleCart.SelectedItem; double nominal = int.Parse(saleCart.Nominal); itog = itog - (itog * (nominal / 100)); lblItog.Content = itog.ToString(); } if (cbChekGiftSertificate.IsChecked == true && cbGiftSertificate.SelectedItem != null) { GiftSertificate giftSertificate = (GiftSertificate)cbGiftSertificate.SelectedItem; int nominal = (int)giftSertificate.Nominal; itog = itog - nominal; lblItog.Content = itog.ToString(); } }
private void btnCreateSaleCart_Click(object sender, RoutedEventArgs e) { bool proverka = true; SaleCarts saleCarts = new SaleCarts(); saleCarts.Name = txtName.Text; saleCarts.Surname = txtSurname.Text; saleCarts.Patronymic = txtPatronymic.Text; saleCarts.Nominal = txtNominal.Text; if (cbEmployee.SelectedItem != null) { Employees emp = (Employees)cbEmployee.SelectedItem; saleCarts.EmployeeId = emp.id.ToString(); } else { proverka = false; MessageBox.Show("Поле сотрудник не заполнено"); } if (proverka) { db.SaleCarts.Add(saleCarts); db.SaveChanges(); Close(); } }