コード例 #1
0
 public QtyForm(PosForm frmpos)
 {
     InitializeComponent();
     connect = new MySqlConnection();
     connect.ConnectionString = dbconnect.DataConnection();
     fpos = frmpos;
 }
コード例 #2
0
ファイル: ChangePasswordForm.cs プロジェクト: lynarvi/POS
 public ChangePasswordForm(PosForm frm)
 {
     InitializeComponent();
     connect = new MySqlConnection();
     connect.ConnectionString = dbconnect.DataConnection();
     f = frm;
 }
コード例 #3
0
 public LookUpForm(PosForm frm)
 {
     InitializeComponent();
     connect = new MySqlConnection();
     connect.ConnectionString = dbconnect.DataConnection();
     posform         = frm;
     this.KeyPreview = true;
 }
コード例 #4
0
ファイル: SettleForm.cs プロジェクト: lynarvi/POS
 public SettleForm(PosForm fp)
 {
     InitializeComponent();
     connect = new MySqlConnection();
     connect.ConnectionString = dbconnect.DataConnection();
     fpos            = fp;
     this.KeyPreview = true;
 }
コード例 #5
0
 public SeniorReceipt(PosForm frm)
 {
     InitializeComponent();
     connect = new MySqlConnection();
     connect.ConnectionString = dbconnect.DataConnection();
     f = frm;
     this.KeyPreview = true;
 }
コード例 #6
0
ファイル: DiscountForm.cs プロジェクト: lynarvi/POS
        public DiscountForm(PosForm form)
        {
            InitializeComponent();
            connect = new MySqlConnection();
            connect.ConnectionString = dbconnect.DataConnection();

            f = form;
            this.KeyPreview = true;
        }
コード例 #7
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            string _username = "", _role = "", _name = "";

            try
            {
                bool found = false;
                connect.Open();
                command = new MySqlCommand("SELECT * FROM users_tbl where username = @username AND password = @password", connect);
                command.Parameters.AddWithValue("@username", usertxt.Text);
                command.Parameters.AddWithValue("@password", passtxt.Text);
                DataReader = command.ExecuteReader();
                DataReader.Read();
                if (DataReader.HasRows)
                {
                    found     = true;
                    _username = DataReader["username"].ToString();
                    _role     = DataReader["role"].ToString();
                    _name     = DataReader["name"].ToString();
                }
                else
                {
                    found = false;
                }
                DataReader.Close();
                connect.Close();

                if (found == true)
                {
                    if (_role == "Cashier")
                    {
                        MessageBox.Show("Welcome " + _name + "!", "Access Granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        usertxt.Text = "";
                        passtxt.Text = "";
                        this.Hide();
                        PosForm pf = new PosForm(this);
                        pf.usernamelbl.Text = _username;
                        pf.cashierlbl.Text  = _name + " | " + _role;
                        pf.ShowDialog();
                    }
                    else if (_role == "Administrator")
                    {
                        MessageBox.Show("Welcome " + _name + "!", "Access Granted", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        usertxt.Text = "";
                        passtxt.Text = "";
                        this.Hide();
                        AdminPage frm = new AdminPage();
                        frm.nametxt.Text     = _name;
                        frm.usernametxt.Text = _username;
                        frm.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show("Invalid username" + _name + "!", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    usertxt.Text = "";
                    passtxt.Text = "";
                }
            }
            catch (Exception ex)
            {
                connect.Close();
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }