private void button1_Click(object sender, EventArgs e) { int result; result = (int)Control.GetCustomer(textBox1.Text, textBox2.Text); if (result > 0) { if ((int)Control.CheckAdmin(result) > 0) { textBox1.Text = ""; textBox2.Text = ""; Logged_in = true; AdminProfile F = new AdminProfile(); F.TakeParamaters(result); F.Show(); Message.Visible = false; Message.Text = ""; //this.Hide(); } else { textBox1.Text = ""; textBox2.Text = ""; Logged_in = true; logincustomer F = new logincustomer(); F.TakeParamaters(result); F.GetNameSecond(); F.Show(); Message.Visible = false; Message.Text = ""; this.Hide(); } } else { result = (int)Control.GetSeller(textBox1.Text, textBox2.Text); if (result > 0) { textBox1.Text = ""; textBox2.Text = ""; Logged_in = true; Form4 F = new Form4(); F.TakeParamaters(result); F.GetNameSecond(); F.Show(); Message.Visible = false; Message.Text = ""; this.Hide(); } else { Message.Text = "The username or password are wrong"; Message.Visible = true; } } }
private void button1_Click(object sender, EventArgs e) { int result; if (UserName.TextLength > 3 && UserName.TextLength < 32) { if (FirstName.TextLength > 3 && FirstName.TextLength < 32 && LastName.TextLength > 3 && LastName.TextLength < 32) { if (Password.Text == Password_2.Text && Password.TextLength > 3 && Password.TextLength < 32) { if (Type.Text == "Seller" || Type.Text == "Customer") { if (Control.CheckNameCustomer(UserName.Text) == null && Control.CheckNameSeller(UserName.Text) == null) { if (Type.Text == "Customer") { result = Control.InsertCustomer(UserName.Text, FirstName.Text, LastName.Text, Password.Text); Logged_in = true; int ID = (int)Control.GetIDCustomer(); logincustomer F = new logincustomer(); F.TakeParamaters(ID); F.GetName(FirstName.Text, LastName.Text); Password.Text = ""; Password_2.Text = ""; FirstName.Text = ""; LastName.Text = ""; Type.Text = ""; Phone.Text = ""; UserName.Text = ""; Message.Visible = false; Message.Text = ""; F.Show(); this.Close(); } else if (Type.Text == "Seller") { result = Control.InsertSeller(UserName.Text, FirstName.Text, LastName.Text, Password.Text, Phone.Text); Logged_in = true; //f.Show(); int ID = (int)Control.GetID(); Form4 F = new Form4(); F.GetName(FirstName.Text, LastName.Text); F.TakeParamaters(ID); Password.Text = ""; Password_2.Text = ""; FirstName.Text = ""; LastName.Text = ""; Type.Text = ""; Phone.Text = ""; UserName.Text = ""; Message.Visible = false; Message.Text = ""; F.Show(); this.Close(); } } else { Message.Visible = true; Message.Text = "This username is alredy taken"; } } else { Message.Visible = true; Message.Text = "Select your type"; } } else { if (Password.Text == Password_2.Text) { Message.Visible = true; Message.Text = "The password must be between 5~32 characters"; } else { Message.Visible = true; Message.Text = "The passwords aren't identical"; } } } else { Message.Visible = true; Message.Text = "The FirstName and LastName must be between 4~32 characters"; } } else { Message.Visible = true; Message.Text = "The user name must be between 4~32 characters"; } }