//Dodawanie zamówienia. private void buttonAcceptNewOrder_Click(object sender, EventArgs e) { if (_products.Count != 0) { var order = new Order() { SellerID = _currentSeller.ID, Price = int.Parse(labelActualSumPrice.Text), AmountOfCalories = int.Parse(labelActualSumAmountOfCalories.Text), Products = _products }; _writeOrderRepository.Create(order); _products.Clear(); dataGridViewNewOrderListOfProducts.DataSource = null; dataGridViewNewOrderListOfProducts.DataSource = null; labelActualSumPrice.Text = @"0"; labelActualSumAmountOfCalories.Text = @"0"; MessageBox.Show(@"Pomyślnie dodano zamówienie"); } else { MessageBox.Show(@"Próba akceptacji - dodania zamówienia nieudana. Brak produktów!"); } }
private void buttonAddNewSupply_Click(object sender, EventArgs e) { if ((_currentTable == "suppliers") && (dataGridViewRestaurantManagementSystem.SelectedRows.Count > 0)) { var supplierId = dataGridViewRestaurantManagementSystem.SelectedRows[0].Cells["ID"].Value.ToString(); try { var supply = new Supply() { Date = DateTime.Parse(textBoxSupplyDate.Text), OrderedProduct = textBoxSupplyOrderedProduct.Text, Price = int.Parse(textBoxSupplyPrice.Text), ProviderID = int.Parse(supplierId) }; _writeSupplyRepository.Create(supply); ShowSupplies(); } catch (Exception) { MessageBox.Show(@"Błędne/niepełne dane dostawy!"); } ClearTextBoxes(); } else { MessageBox.Show(@"Pamietaj o wyborze dostawcy przed dodaniem sfinaliowaniem dostawy!"); } }
private void buttonAddNewStudent_Click(object sender, EventArgs e) { Student student = new Student() { Name = textBoxNewStudentName.Text.ToString(), Surname = textBoxNewStudentSurname.Text.ToString(), Index = textBoxNewStudentIndex.Text.ToString(), Address = new Address() { City = textBoxNewStudentCity.Text.ToString(), PostCode = textBoxNewStudentPostCode.Text.ToString() } }; _writeStudentRepository.Create(student); }
private void buttonAddNewSupplier_Click(object sender, EventArgs e) { try { var supplier = new Supplier() { Name = textBoxSupplierName.Text, Localization = comboBoxSupplierLocalization.Text, DeliveryTime = int.Parse(textBoxSupplierDeliveryTime.Text) }; _writeSupplierRepository.Create(supplier); ShowSuppliers(); } catch (Exception) { MessageBox.Show(@"Błędne/niepełne dane dostawcy!"); } ClearTextBoxes(); }
private void buttonAddProductMenu_Click(object sender, EventArgs e) { try { var menuProduct = new MenuProduct() { Category = comboBoxMenuProductCategory.Text, Name = textBoxMenuProductName.Text, AmountOfCalories = int.Parse(textBoxMenuProductAmountOfCalories.Text), Price = int.Parse(textBoxMenuProductPrice.Text) }; _writeMenuProductRepository.Create(menuProduct); ShowMenuProducts(); } catch (Exception) { MessageBox.Show(@"Błędne/niepełne dane produktu menu!"); } ClearTextBoxes(); }
//Przyciski dodające obiekty do baz danych. private void buttonRegisterNewSeller_Click(object sender, EventArgs e) { try { var seller = new Seller() { Name = textBoxSellerName.Text, Surname = textBoxSellerSurname.Text, YearsOfExperience = int.Parse(comboBoxSellerYearsOfExperience.Text), EnglishLevel = comboBoxSellerEnglishLevel.Text, Password = textBoxSellerPassword.Text }; _writeSellerRepository.Create(seller); ShowSellers(); } catch (Exception) { MessageBox.Show(@"Błędne/niepełne dane sprzedawcy!"); } ClearTextBoxes(); }