private bool CreateSubscriptionWCategory(SubscribedToCategory subCat) { try { return(subscriptionLogic.CreateSubscriptionWCategory(subCat)); } catch (Exception ex) { ErrorHandler.Log.WriteFail(ex); CreateMessage.ShowInputNotValid(); return(false); } }
private void btn_DeleteProduct_Click(object sender, RoutedEventArgs e) { bool wasSucces = interaction.DeleteProduct("product", product.ProductID); if (wasSucces) { CreateMessage.ShowDeleteSuccesful("Product"); } if (!wasSucces) { CreateMessage.ShowFailureMessage(); } NavigationService.Navigate(new ViewProducts()); }
private void btn_Delete_Click(object sender, RoutedEventArgs e) { bool wasSucces = customerLogic.DeleteCustomer("customer", customer.customerID); if (wasSucces) { CreateMessage.ShowDeleteSuccesful("Customer"); } if (!wasSucces) { CreateMessage.ShowFailureMessage(); } NavigationService.Navigate(new ViewCustomer()); }
private void btn_Delete_Click(object sender, RoutedEventArgs e) { bool wasSucces = interaction.DeleteDeal("deals", deal.DealsID); if (wasSucces) { CreateMessage.ShowDeleteSuccesful("deal"); } if (!wasSucces) { CreateMessage.ShowFailureMessage(); } NavigationService.Navigate(new ViewDeals()); }
private void Btn_Click_DeleteSubscription(object sender, RoutedEventArgs e) { bool wasSuccess = subscriptionLogic.DeleteSubscription(subscription, "Subscription", subscription.SubscriptionID); if (wasSuccess == true) { CreateMessage.ShowDeleteSuccesful("Subscription"); } if (wasSuccess == false) { CreateMessage.ShowFailureMessage(); } this.Content = null; NavigationService.Navigate(new ViewCustomer()); }
private void Btn_Click_DeleteUser(object sender, RoutedEventArgs e) { bool wasSucces = userLogic.DeleteUser("user", user.ID); if (wasSucces) { CreateMessage.ShowDeleteSuccesful("User"); } if (!wasSucces) { CreateMessage.ShowFailureMessage(); } this.Content = null; NavigationService.Navigate(new ViewUser()); }
private void Btn_Click_LogIn(object sender, RoutedEventArgs e) { CurrentUser.username = txtBox_Username.Text; CurrentUser.password = txtBox_Password.Text; bool loginSucces = DB.UserLogin(); if (CurrentUser.currentUserID > 0) { CreateMessage.ShowSuccesfulLogin(); this.Content = null; } if (CurrentUser.currentUserID == 0) { CreateMessage.ShowUnsuccesfulLogin(); } }
private void Button_Click_Save(object sender, RoutedEventArgs e) { foreach (int productIDs in productList) { Product product = DB.SelectProduct(productIDs); // will break if input is anything else than numbers // to fix use regex, not enough time in devolpment product.Price = double.Parse(TextBox_Price.Text); wasSuccess = DB.EditProduct(product); } if (wasSuccess == true) { CreateMessage.ShowEditSuccesful("Product"); NavigationService.Navigate(new ViewCatalogue()); } if (wasSuccess == false) { CreateMessage.ShowFailureMessage(); NavigationService.Navigate(new ViewCatalogue()); } }
private void btn_Save_Click(object sender, RoutedEventArgs e) { int customerID = 0; List <int> selectedCustomersList = new List <int>(); for (int i = 0; i < lstbx_Customer.SelectedItems.Count; i++) { Customer chosenCustomer = (Customer)lstbx_Customer.Items[i]; customerID = chosenCustomer.customerID; selectedCustomersList.Add(customerID); } int[] arrayOfCustomerIDs = selectedCustomersList.ToArray(); foreach (int customerIDs in arrayOfCustomerIDs) { wasSuccess = CreateDeals(customerIDs); // Creates a deal for every customer selected } if (txtbx_Discount.Text == "" || txtbx_Name.Text == "") { CreateMessage.ShowInputNotValid(); } else if (check.CheckTextBoxInputInteger(txtbx_Discount.Text) == true) { CreateMessage.ShowInputNotValid(); } else { if (wasSuccess) { CreateMessage.ShowCreateSuccesful("Deal"); } if (!wasSuccess) { CreateMessage.ShowFailureMessage(); } NavigationService.Navigate(new ViewDeals()); } }
//Made by Mikkel E.R. Glerup private void btn_Save_Click(object sender, RoutedEventArgs e) { bool isAdmin = false; UserLogic userLogic = new UserLogic(); if (TxtBox_Name.Text == "") { CreateMessage.ShowInputNotValid(); } else if (check.CheckTextBoxInputChars(TxtBox_Name.Text) == false) { CreateMessage.ShowInputNotValid(); } else { if (CheckBox_IsAdmin.IsChecked == true) { isAdmin = true; } if (CheckBox_IsAdmin.IsChecked == false) { isAdmin = false; } //Databinding, would've, should've could've but didn't bool wasSuccess = userLogic.CreateUser(user.Name = TxtBox_Name.Text, user.IsAdmin = isAdmin); if (wasSuccess) { CreateMessage.ShowCreateSuccesful("User"); } if (!wasSuccess) { CreateMessage.ShowFailureMessage(); } NavigationService.Navigate(new ViewUser()); } }
private bool CreateDeals(int customerID) { try { deals.CustomerID = customerID; if (rdbtn_Category.IsChecked == true) //find out if the deal is made to product or category { Categories chosenCategory = (Categories)lstbx_ProductOrCategory.SelectedItem; deals.CategoryID = chosenCategory.CategoryID; } else if (rdbtn_Product.IsChecked == true) { Product chosenProduct = (Product)lstbx_ProductOrCategory.SelectedItem; deals.ProductID = chosenProduct.ProductID; } return(interaction.CreateDeal(deals)); } catch (Exception ex) { ErrorHandler.Log.WriteFail(ex); CreateMessage.ShowInputNotValid(); return(false); } }