Esempio n. 1
0
        private void btnCal_Click(object sender, EventArgs e)
        {
            frmEmployee emp        = new frmEmployee();
            double      balanceDue = emp.getBalanceDue;
            double      Bal;


            try
            {
                connect = new SqlConnection(connectionString);
                connect.Open();
                string readQuery = @"SELECT * FROM Tab WHERE Cust_ID = '" + txtTabID.Text + "'";
                command = new SqlCommand(readQuery, connect);
                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Bal  = double.Parse(reader.GetValue(1).ToString());
                    Bal += balanceDue;
                    listBox1.Items.Add("New Balance: " + Bal.ToString());
                }
                connect.Close();
            }
            catch (SqlException err)
            {
                MessageBox.Show(err.Message);
            }
            emp.ShowDialog();
        }
Esempio n. 2
0
        private void BtnDone_Click(object sender, EventArgs e)
        {
            items = lstHotDrinks.Items.ToString();
            /*emp.lstOrderName.Items.Add(items);*/
            emp.ShowDialog();

            this.Close();
        }
Esempio n. 3
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            connect = new SqlConnection(connectionString);
            connect.Open();
            String sql = @"SELECT * FROM Staff";

            command    = new SqlCommand(sql, connect);
            dataReader = command.ExecuteReader();

            while (dataReader.Read())
            {
                username = dataReader.GetValue(1).ToString();
                password = dataReader.GetValue(2).ToString();
                userPos  = dataReader.GetValue(3).ToString();

                if (username == tbUsername.Text && password == tbPassword.Text)
                {
                    lblSearching.Text = "";
                    tbUsername.Text   = "";
                    tbPassword.Text   = "";
                    lblSearching.Text = "";

                    if (userPos == "O")
                    {
                        frmOwner owner = new frmOwner();
                        owner.ShowDialog();
                    }
                    else
                    {
                        frmEmployee employee = new frmEmployee();
                        employee.ShowDialog();
                    }
                }

                else
                {
                    if (tbUsername.Text == "" && tbPassword.Text == "")
                    {
                        lblSearching.Text = "Please enter username and password";
                    }
                    else if (tbUsername.Text == "")
                    {
                        lblSearching.Text = "Please enter username";
                    }
                    else if (tbPassword.Text == "")
                    {
                        lblSearching.Text = "Please enter password";
                    }
                    else if (username != tbUsername.Text)
                    {
                        tbUsername.SelectAll();
                        tbPassword.SelectAll();
                        lblSearching.Text = "The username or the password is incorrect";
                    }
                    else if (password != tbPassword.Text)
                    {
                        tbUsername.SelectAll();
                        tbPassword.SelectAll();
                        lblSearching.Text = "The username or the password is incorrect";
                    }
                }
            }

            /* }
             * if (username == tbUsername.Text && password == tbPassword.Text)
             * {
             *   lblSearching.Text = "";
             *   tbUsername.Text = "";
             *   tbPassword.Text = "";
             *
             *   if (userPos == "O")
             *   {
             *       frmOwner owner = new frmOwner();
             *       owner.ShowDialog();
             *       //this.Close();
             *   }
             *   else
             *   {
             *       frmEmployee emp = new frmEmployee();
             *       emp.ShowDialog();
             *      // this.Close();
             *   }
             * }
             * else
             * {
             *   if (username != tbUsername.Text)
             *   {
             *       tbUsername.SelectAll();
             *       tbPassword.SelectAll();
             *       lblSearching.Text = "The username or the password is incorrect";
             *   }
             *   else if (password != tbPassword.Text)
             *   {
             *       tbUsername.SelectAll();
             *       tbPassword.SelectAll();
             *       lblSearching.Text = "The username or the password is incorrect";
             *   }
             * }
             *
             * }*/
            connect.Close();

            /*
             * frmOwner ow = new frmOwner();
             * ow.ShowDialog();
             *
             * frmEmployee emp = new frmEmployee();
             * emp.ShowDialog();*/
        }
 private void BtnDone_Click(object sender, EventArgs e)
 {
     emp.ShowDialog();
     this.Close();
 }