Example #1
0
        private void da_Click(object sender, EventArgs e)
        {
            dash frm = new dash();

            this.Visible = false;
            frm.ShowDialog();
            this.Close();
        }
Example #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            try
            {
                SQLCON.openConn();
                //SQLCON.cnn.Open();
                MySqlCommand cmd = new MySqlCommand("Select * from tbluser Where userName=@user And pwd=@pwd", SQLCON.cnn);
                cmd.Parameters.AddWithValue("@user", txtUser.Text);
                cmd.Parameters.AddWithValue("@pwd", txtPwd.Text);
                MySqlDataAdapter da      = new MySqlDataAdapter(cmd);
                DataTable        dtlogin = new DataTable();
                da.Fill(dtlogin);
                SQLCON.cnn.Close();
                if (dtlogin.Rows.Count > 0)
                {
                    //this.Hide();
                    dash frmMain = new dash();

                    // login ln = new login();
                    this.Hide();
                    frmMain.Show();
                    //ln.Close();
                }
                else
                {
                    MessageBox.Show("Invalid");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SQLCON.cnn.Close();
            }
        }
Example #3
0
        public static void login(TextBox un, TextBox pw, Label l, Form lgfrm, PictureBox p1, PictureBox p2)
        {
            DBconnect conn = new DBconnect();

            conn.DBopen();

            try
            {
                conn.SqlQuery("SELECT user_name,password,desig from login WHERE user_name = '" + un.Text + "' AND password ='******' ");
                DataTable     dt = conn.SelQryEx();
                SqlDataReader re = conn.SelQryRedEx();
                re.Read();

                if (un.Text == "User Name" || pw.Text == "Password")
                {
                    MessageBox.Show("Please enter the user name and the password");
                    p1.Image     = Resources.userRed;
                    p2.Image     = Resources.locked_padlockR;
                    un.Text      = "User Name";
                    un.ForeColor = Color.FromArgb(218, 214, 218);
                    pw.Text      = "Password";
                    pw.ForeColor = Color.FromArgb(218, 214, 218);
                }

                else
                {
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("Invalid Username or Password.");
                        un.Clear();
                        pw.Clear();
                        l.Text              = "Wrong username or password.Try again.";
                        l.ForeColor         = Color.FromArgb(232, 17, 35);
                        l.Visible           = true;
                        lgfrm.ActiveControl = un;
                        p1.Image            = Resources.userRed;
                        p2.Image            = Resources.locked_padlockR;
                    }
                    else
                    {
                        l.Visible = false;
                        if (re.HasRows)
                        {
                            string desig = (string)(re[2]);

                            if (desig == "Sales")
                            {
                                dash frm = new dash();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }

                            else if (desig == "Account")
                            {
                                AccountingManagementSysem.Hm frm = new AccountingManagementSysem.Hm();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }

                            else if (desig == "Manu")
                            {
                                Manufacturing_Management_System.manudashboard frm = new Manufacturing_Management_System.manudashboard();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Purch")
                            {
                                Project001.viewinvoice frm = new Project001.viewinvoice();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Ship")
                            {
                                Package_and_shipment.homepage frm = new Package_and_shipment.homepage();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                            else if (desig == "Main")
                            {
                                AccountingManagementSysem.Hm frm = new AccountingManagementSysem.Hm();
                                lgfrm.Visible = false;
                                frm.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }

            finally
            {
                conn.DBclose();
            }
        }
Example #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            dash frm = new dash();

            frm.Show();
        }