예제 #1
0
        private void button19_Click(object sender, EventArgs e)
        {
            this.Close();
            addPanel.Visible  = false;
            groupBox2.Visible = false;

            mainsecretary mainsec = new mainsecretary();

            mainsec.Show();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlDataAdapter dr = new SqlDataAdapter(" select * from Users_TB where Username = '******' and Password = '******' and Role = '" + cbLoginUsertype.Text + "'", con);
                con.Open();
                DataTable dt = new DataTable();
                dr.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    MessageBox.Show("Login Successfully ! ", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    // this.Hide();
                    // mainform main = new mainform();
                    // main.Show();
                }

                else
                {
                    MessageBox.Show(" Incorrect username or password , Please Try Again ! ", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (cbLoginUsertype.Text == "Secretary")
                {
                    this.Hide();
                    mainsecretary mainsec = new mainsecretary();
                    mainsec.Show();
                }
                else
                {
                    this.Hide();
                    mainform main = new mainform();
                    main.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }
        }