示例#1
0
 private void button4_Click(object sender, EventArgs e)
 {
     this.Close();
     if (ef != null)
     {
         ef.Show();
     }
     else if (mf != null)
     {
         mf.Show();
     }
     else if (cf != null)
     {
         cf.Show();
     }
 }
示例#2
0
        private void LogIN_Button_Click(object sender, EventArgs e)
        {
            int ID = Check_IDValidation(User_ID_Textbox.Text, "User");

            if (ID == 0)
            {
                return;
            }
            string    Password = Password_Textbox.Text;
            DataTable dt       = Controller_OBJ.GetUserByID(ID);

            if (dt == null)
            {
                MessageBox.Show("The Id You have Entered does not match any ID in the library", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
            }
            if (Password.Contains("User"))
            {
                if (Password == dt.Rows[0].ItemArray[5].ToString())
                {
                    MessageBox.Show("Welcome " + dt.Rows[0].ItemArray[0].ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    User_Form Form = new User_Form(dt.Rows[0].ItemArray[0].ToString() + " " + dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString(), "Rate : " + dt.Rows[0].ItemArray[3].ToString(), (byte[])dt.Rows[0].ItemArray[6], ID);
                    Form.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            dt = Controller_OBJ.Get_Employee_by_ID_forlog(ID);
            if (Password.Contains("Man"))
            {
                if (Password == dt.Rows[0]["Password"].ToString())
                {
                    MessageBox.Show("Welcome " + dt.Rows[0].ItemArray[0].ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ChairmanForm Form = new ChairmanForm(this, dt.Rows[0].ItemArray[0].ToString() + " " + dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString());
                    Form.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            if (Password.Contains("SPR"))
            {
                if (Password == dt.Rows[0]["Password"].ToString())
                {
                    MessageBox.Show("Welcome " + dt.Rows[0].ItemArray[0].ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ManagerForm Form = new ManagerForm(this, dt.Rows[0].ItemArray[0].ToString() + " " + dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString(), ID);
                    Form.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            if (Password.Contains("EMP"))
            {
                if (Password == dt.Rows[0]["Password"].ToString())
                {
                    MessageBox.Show("Welcome " + dt.Rows[0].ItemArray[0].ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    EmployeeForm Form = new EmployeeForm(this, dt.Rows[0].ItemArray[0].ToString() + " " + dt.Rows[0].ItemArray[1].ToString() + " " + dt.Rows[0].ItemArray[2].ToString(), ID);
                    Form.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }