Ejemplo n.º 1
0
        private void toolStripButton4_Click_1(object sender, EventArgs e)
        {
            StockManagementSystem sms = new StockManagementSystem();

            sms.Show();
            this.Close();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection con = new SqlConnection("server=SHREYAS-PC ; database=post ; uid=sa ; pwd=1234");
                con.Open();

                SqlCommand cmd = new SqlCommand("select * from login where Username='******' and Pwd='" + passwd.Text + "' and Typ='" + cbotype.Text + "'", con);

                SqlDataReader dr = cmd.ExecuteReader();


                if (dr.Read())
                {
                    name    = dr["Name"].ToString();
                    contact = dr["contact"].ToString();
                    email   = dr["EmailId"].ToString();
                    addr    = dr["Adress"].ToString();
                    type    = dr["Typ"].ToString();
                    dept    = dr["department"].ToString();

                    if (cbotype.Text.Equals("Admin"))
                    {
                        StockManagementSystem sms = new StockManagementSystem(name, contact, email, addr, type, dept);
                        sms.Show();
                    }

                    else if (cbotype.Text.Equals("Other"))
                    {
                        StockManagementSystem1 sms1 = new StockManagementSystem1(name, contact, email, addr, type, dept);
                        sms1.Show();
                    }
                }


                else
                {
                    MessageBox.Show("Invalid username or password");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }