Пример #1
0
 private void LogIn(object sender, RoutedEventArgs e)
 {
     if (CheckUsernamePassword())
     {
         if (AccountToLogin.Type == "Seller")
         {
             SellerHome sellerHome = new SellerHome(AccountToLogin);
             sellerHome.Show();
             this.Close();
         }
         else if (AccountToLogin.Type == "Shopper")
         {
             ShopperHome shopperHome = new ShopperHome(AccountToLogin);
             shopperHome.Show();
             this.Close();
         }
     }
 }
Пример #2
0
        private void SavePetToDatabase(object sender, RoutedEventArgs e)
        {
            petType     = PetTypeEntry.Text;
            petSize     = PetSizeEntry.Text;
            petAge      = PetAgeEntry.Text;
            petQuantity = PetQuantityEntry.Text;
            petPrice    = PetPriceEntry.Text;
            petZip      = PetZipEntry.Text;

            if (CheckEntries())
            {
                MessageBox.Show("Updating database...");
                Animal a = new Animal(petID, LoggedInSeller.id, petType, petAge, petSize, petQuantity, petPrice, petZip);
                PostgreSQL.editPet(a);
                PostgreSQL.editSeller(LoggedInSeller, a);
                SellerHome sh = new SellerHome(LoggedInSeller);
                sh.Show();
                this.Close();
            }
        }
Пример #3
0
        private void DeletePet(object o)
        {
            lb = o as ListBox;
            Animal selectedAnimal = lb.SelectedItem as Animal;

            if (selectedAnimal == null)
            {
                MessageBox.Show("Please select an animal before removing it", "Invalid Selection");
            }
            else
            {
                MessageBox.Show("Removing from the database...");
                PostgreSQL.deleteSeller(selectedAnimal.PetID);
                PostgreSQL.deletePet(selectedAnimal.PetID);

                SellerHome sh = new SellerHome(LoggedInSeller);
                closeWindows();
                sh.Show();
            }
        }
Пример #4
0
 private void LogInClicked(object sender, RoutedEventArgs e)
 {
     if (Authenticated())
     {
         User user = Users.FirstOrDefault(x => x.Username == UsernameEntry.Text &&
                                          x.Password == PasswordEntry.Password);
         if (user.Seller)
         {
             SellerHome sellerWindow = new SellerHome(ref user);
             sellerWindow.Show();
             Close();
         }
         else
         {
             ShopperHome shopperWindow = new ShopperHome(ref user);
             shopperWindow.Show();
             Close();
         }
     }
 }