Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MainSite mainSite = new MainSite();

            mainSite.Show();
            this.Close();
        }
Example #2
0
        //For Sign Out
        private void button2_Click(object sender, EventArgs e)
        {
            Form1.enter = false;
            MainSite mainSite = new MainSite();

            mainSite.Show();
            this.Close();
        }
Example #3
0
 //For Sign In
 private void button1_Click(object sender, EventArgs e)
 {
     /*
      * textBox1----password
      * textBox2----username
      * comboBox1---role
      */
     if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "" || comboBox1.Text.Trim() == "")
     {
         enter = false;
         MessageBox.Show("Null Values exit, please select login type, enter username and password", "Wrong", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else if (!(comboBox1.Text.Trim() == "Customer" || comboBox1.Text.Trim() == "Seller" || comboBox1.Text.Trim() == "Employee"))
     {
         MessageBox.Show("Are you are customer or seller or employee??", "Invalid Selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else if (textBox1.Text.Trim().Length <= 5)
     { //Password length>6
         enter = false;
         MessageBox.Show("the length of password should be more than 5", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         x.set.Reset();
         role = comboBox1.Text.Trim();
         string sql = null;
         if (role == "Customer")
         {
             sql = "select * from customer where CustomerId='" + textBox2.Text.Trim() + "'and PassWord='******'";
         }
         else if (role == "Employee")
         {
             if (textBox2.Text.Trim().Length != 6)
             {
                 MessageBox.Show("the length of id should be equal to 6", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 sql = "select * from employee where EmployeeId='" + textBox2.Text.Trim() + "'and PassWord='******'";
             }
         }
         else
         {
             if (textBox2.Text.Trim().Length != 6)
             {
                 MessageBox.Show("the length of id should be equal to 6", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 sql = "select * from seller where SellerId='" + textBox2.Text.Trim() + "'and PassWord='******'";
             }
         }
         if (sql != null)
         {
             x.query(sql);
             if (x.set.Tables[0].Rows.Count >= 0)
             {
                 enter    = true;
                 username = textBox2.Text;
                 if (role == "Customer")
                 {
                     MainSite mainSite = new MainSite();
                     mainSite.Show();
                 }
                 else if (role == "Employee")
                 {
                     Information info = new Information();
                     info.Show();
                 }
                 else
                 {
                     Seller seller = new Seller();
                     seller.Show();
                 }
                 enter = true;
                 this.Close();
             }
             else
             {
                 enter = false;
                 MessageBox.Show("Username Or Password is wrong", "Invalid Sign In", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }