Esempio n. 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            ManagerDashboard form = new ManagerDashboard();

            this.Hide();
            form.FormClosed += new FormClosedEventHandler(delegate { Close(); });
            form.Show();
        }
Esempio n. 2
0
        //*******************************************************************************************************
        //Login Querry
        public void LoginCheck(string user, string pass, string option)
        {
            conn = new SqlConnection(constring);
            conn.Open();

            if (option == "Manager")
            {
                try
                {
                    da = new SqlDataAdapter("SELECT * from [M_Login] where [UserName]='" + user + "' and [Password]='" + pass + "'", conn);
                    DataTable dtbl = new DataTable();
                    da.Fill(dtbl);
                    if (dtbl.Rows.Count == 1)
                    {
                        ManagerDashboard form = new ManagerDashboard();
                        Login            lf   = new Login();
                        lf.Hide();
                        lf.FormClosed += new FormClosedEventHandler(delegate { lf.Close(); });
                        form.Show();
                    }
                    else
                    {
                        DialogResult DDR = MessageBox.Show("Incorrect Username or Password!", "TMS", MessageBoxButtons.OK,
                                                           MessageBoxIcon.Error);
                    }


                    conn.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }
            else if (option == "Distributer")
            {
                try
                {
                    da = new SqlDataAdapter("SELECT * from [C_Login] where [UserName]='" + user + "' and [Password]='" + pass + "'", conn);
                    DataTable dtbl = new DataTable();
                    da.Fill(dtbl);
                    if (dtbl.Rows.Count == 1)
                    {
                        DistributerDashboard form = new DistributerDashboard();
                        Login lf = new Login();
                        lf.Close();
                        lf.FormClosed += new FormClosedEventHandler(delegate { lf.Close(); });
                        form.Show();
                    }
                    else
                    {
                        DialogResult DDR = MessageBox.Show("Incorrect Username or Password!", "TMS", MessageBoxButtons.OK,
                                                           MessageBoxIcon.Error);
                    }


                    conn.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }
            }

            else
            {
                DialogResult DDR = MessageBox.Show("Select User", "TMS", MessageBoxButtons.OK,
                                                   MessageBoxIcon.Error);
            }
        }