Ejemplo n.º 1
0
        private void Back_Click(object sender, EventArgs e)
        {
            OwnerIF f3 = new OwnerIF();

            this.Hide();
            f3.ShowDialog();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            OwnerIF f5 = new OwnerIF();

            this.Hide();
            f5.ShowDialog();
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string str = "Data Source=.\\sqlexpress;Data Source=DESKTOP-EVASEB4;Initial Catalog=PharmacyManagementSystem;Integrated Security=True";

            SqlConnection conn = new SqlConnection(str);

            if (comboBox2.Text.ToString() == "Owner")
            {
                SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Owner where OwnerName ='" + textBox1.Text + "' and Password='******'", conn);

                DataTable dt = new DataTable();

                sda.Fill(dt);

                if (dt.Rows[0][0].ToString() == "1")
                {
                    OwnerIF f3 = new OwnerIF();
                    this.Hide();
                    f3.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Wrong Username or Password or Usermode!", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (comboBox2.Text.ToString() == "Salesman")
            {
                SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Salesman where SalesmanName ='" + textBox1.Text + "' and Password='******'", conn);

                DataTable dt1 = new DataTable();

                sda.Fill(dt1);

                if (dt1.Rows[0][0].ToString() == "1")
                {
                    SalesmanHomePage shp = new SalesmanHomePage();
                    this.Hide();
                    shp.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Wrong Username or Password or Usermode!", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Wrong User Mode!", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }