Пример #1
0
 private void loginBtn_Click(object sender, EventArgs e)
 {
     try
     {
         string type     = catagoryBox.Text;
         string username = usernameBox.Text;
         string password = passwordBox.Text;
         MessageBox.Show(String.Format("{0} | {1} | {2}", type, username, password), "OK");
         if (type == "Customer")
         {
             var cust = Customer.Login(username, password);
             if (cust != null)
             {
                 CustomerBoard window = new CustomerBoard(cust);
                 window.Show();
                 this.Hide();
             }
         }
         else if (type == "Admin")
         {
             var admin = Admin.Login(username, password);
             if (admin != null)
             {
                 AdminBoard window = new AdminBoard(admin);
                 window.Show();
                 this.Hide();
             }
         }
     }catch (Exception er)
     {
         MessageBox.Show(er.Message, "Error");
     }
 }
Пример #2
0
 private void loginBtn_Click(object sender, EventArgs e)
 {
     try
     {
         var name     = textBox2.Text;
         var email    = textBox3.Text;
         var username = usernameBox.Text;
         var password = passwordBox.Text;
         var phone    = maskedTextBox1.Text;
         var gender   = comboBox1.Text == "Male" ? Gender.Male : Gender.Female;
         MessageBox.Show(gender.ToString());
         var customer = Customer.Signup(name, username, password, email, phone, gender);
         if (customer != null)
         {
             CustomerBoard board = new CustomerBoard(customer);
             board.Show();
             this.Hide();
         }
     }catch (Exception er)
     {
         MessageBox.Show(er.Message);
     }
 }