Beispiel #1
0
 private void button5_Click(object sender, EventArgs e)
 {
     frmMain frm = new frmMain();
        frm.Show();
        this.Close();
 }
Beispiel #2
0
        private void LoginMathod()
        {
            String userName = null;
            String userpass = null;
            String userRole = null;
            String userFName = null;
            String userLName = null;

            if (txtName.Text == "")
            {
                MessageBox.Show("Please Enter Your Name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Focus();
                return;
            }
            if (txtPass.Text == "")
            {
                MessageBox.Show("Please Enter Your Password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtPass.Focus();
                return;
            }
            if (roleCombo.Text == "")
            {
                MessageBox.Show("Please Select Your Role", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            try
            {
                String query = "SELECT * FROM Users WHERE UserName='******' ";
                reader = db.selectQuery(query);
                if (reader.Read())
                {
                    userRole = reader[1].ToString();
                    userFName = reader[2].ToString();
                    userLName = reader[3].ToString();
                    userName = reader[4].ToString();
                    userpass = reader[5].ToString();
                }
                db.ConnectionClose();
                if (txtName.Text.Equals(userName) && roleCombo.Text.Equals(userRole))
                {
                    if (txtPass.Text.Equals(userpass))
                    {
                        frmMain mainfrm = new frmMain();
                        mainfrm.Show();
                        mainfrm.lblFirstName.Text = userFName+":";
                        mainfrm.lblLastName.Text = userLName;
                        mainfrm.lblUserRole.Text = userRole +":";
                        this.Hide();
                    }
                    else
                    {
                        txtPass.Clear();
                        txtPass.Focus();
                        MessageBox.Show("Your Password is Invalid !!"+Environment.NewLine+"Please Enter Your Valid Password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Your User Name OR User Role is Invalid !!" + Environment.NewLine + "Please Enter Your Valid Name OR Role", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtName.Clear();
                    txtName.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
 private void button5_Click_1(object sender, EventArgs e)
 {
     frmMain main = new frmMain();
     main.Show();
     this.Close();
 }
Beispiel #4
0
 public frmRecivedCash(frmMain frm)
 {
     InitializeComponent();
     this.frm = frm;
 }
Beispiel #5
0
 public frmRecivedCash(frmMain frm)
 {
     InitializeComponent();
     this.frm = frm;
 }
Beispiel #6
0
 private void btnClose_Click_1(object sender, EventArgs e)
 {
     frmMain frm = new frmMain();
     frm.Show();
     this.Close();
 }