示例#1
0
 private bool CreateSubscriptionWCategory(SubscribedToCategory subCat)
 {
     try
     {
         return(subscriptionLogic.CreateSubscriptionWCategory(subCat));
     }
     catch (Exception ex)
     {
         ErrorHandler.Log.WriteFail(ex);
         CreateMessage.ShowInputNotValid();
         return(false);
     }
 }
示例#2
0
        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());
        }
示例#3
0
        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());
        }
示例#4
0
        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());
        }
示例#5
0
        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());
        }
示例#6
0
        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());
        }
示例#7
0
        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();
            }
        }
示例#8
0
 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());
     }
 }
示例#9
0
        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());
            }
        }
示例#10
0
        //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());
            }
        }
示例#11
0
 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);
     }
 }