示例#1
0
 public frmReceipt(frmPos frm)
 {
     InitializeComponent();
     con             = new MySqlConnection(dbCon.getConnection());
     f               = frm;
     this.KeyPreview = true;
 }
示例#2
0
 public frmSettle(frmPos fp)
 {
     InitializeComponent();
     con             = new MySqlConnection(dbCon.getConnection());
     fpos            = fp;
     this.KeyPreview = true;
 }
示例#3
0
 public frmQty(frmPos frmpos)
 {
     InitializeComponent();
     con  = new MySqlConnection(dbCon.getConnection());
     fpos = frmpos;
 }
示例#4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string _role = "", _name = "";

            try
            {
                bool found = false;
                con.Open();
                cmd = new MySqlCommand("select * from tblUser where username=@username and password=@password", con);
                cmd.Parameters.AddWithValue("@username", txtUsername.Text);
                cmd.Parameters.AddWithValue("@password", txtPassword.Text);
                dr = cmd.ExecuteReader();
                dr.Read();
                if (dr.HasRows)
                {
                    found     = true;
                    _UserName = dr["username"].ToString();
                    _role     = dr["role"].ToString();
                    _name     = dr["name"].ToString();
                    _password = dr["password"].ToString();
                    _isactive = bool.Parse(dr["isactive"].ToString());
                }
                else
                {
                    found = false;
                }
                dr.Close();
                con.Close();
                if (found == true)
                {
                    if (_isactive == false)
                    {
                        MessageBox.Show("ACCOUNT IS DEACTIVATE, UNABLE TO LOGIN", "DEACTIVETED ACCOUNT", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (_role == "Cashier")
                    {
                        MessageBox.Show("WELCOME " + _name + " ! ", "ACCESS GRANTED", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtPassword.Clear();
                        txtUsername.Clear();
                        this.Hide();
                        frmPos frm = new frmPos(this);
                        frm.lblUsername.Text = _UserName.ToString();
                        frm.lblName.Text     = _name + " | " + _UserName;
                        frm.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("WELCOME " + _name + " ! ", "ACCESS GRANTED", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtPassword.Clear();
                        txtUsername.Clear();
                        this.Hide();
                        Form1 frm = new Form1();
                        frm.lblName.Text = _name;
                        frm.lblRole.Text = _role;
                        frm.lblUser.Text = _UserName;
                        frm._password    = _password;
                        frm._user        = _UserName;

                        frm.ShowDialog();
                    }
                }
                else

                {
                    MessageBox.Show("INVALID USERNAME OR PASSWORD", "ACCESS DENIED", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                con.Close();
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }