예제 #1
0
 private void button1_Click(object sender, EventArgs e)//Login button
 {
     if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
     {
         MessageBox.Show("Please fill all the boxes");
     }
     else
     {
         //bool Exists= //query that check if this user exists given its data in textBox1, textBox2, textBox3, textBox4 AND RETURNS BOOL TRUE IF USER EXISTS
         bool Exists = controllerObj.UserLogin(Int32.Parse(textBox1.Text), textBox2.Text, textBox3.Text, Int32.Parse(textBox4.Text));
         if (Exists == true)
         {
             UserHome a = new UserHome(this, Int32.Parse(textBox1.Text));
             a.Show();
         }
         else
         {
             MessageBox.Show("No such a user please make sure of your inputs or sign up");
         }
     }
 }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)//register
 {
     if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "")
     {
         MessageBox.Show("Please fill all boxes");
     }
     else
     {
         int result2 = controllerObj.InsertUser(Int32.Parse(textBox1.Text), textBox2.Text, textBox3.Text, Int32.Parse(textBox4.Text));
         if (result2 == 0)
         {
             MessageBox.Show("Unable to create user try another id");
         }
         else
         {
             MessageBox.Show("User created successfully !");
             int      result = controllerObj.InsertChips(Int32.Parse(textBox1.Text));
             UserHome a      = new UserHome(this, Int32.Parse(textBox1.Text));
             a.Show();
         }
     }
 }