}//end getDataTable

        //logout from admin page
        private void btnLogout_Click(object sender, EventArgs e)
        {
            this.Hide();                           //hide the current form
            frmRegister reg = new frmRegister();   //set new frmRegister called reg

            reg.ctozero();                         //call function ctozero to initialize c from frmRegister
            reg.Show();                            //show reg
        }//end btnLogout
Esempio n. 2
0
        }//end btnLog

        //function if button btnExit is clicked
        private void btnExit_Click_1(object sender, EventArgs e)
        {
            this.Hide();                                //hides the current form
            frmRegister frmReg = new frmRegister();     //creates a new frmRegister called frmReg

            frmReg.ctozero();                           //calls function ctozero from frmReg to initialize c
            frmReg.Show();                              //shows frmReg
        }//end btnExit
Esempio n. 3
0
        }//end time2use

        //function if button btnPrint is clicked
        private void btnPrint_Click(object sender, EventArgs e)
        {
            //AddToDatabase();                           //calls function AddToDatabase
            //DeleteVoucher();                           //calls function DeleteVoucher
            //printreceipt();                            //calls function printreceipt
            frmRegister frmReg = new frmRegister();      //creates new frmRegister called frmReg

            frmReg.ctozero();                            //calls function ctozero from frmRegister to initialize c
            this.Hide();                                 //hides current form
            frmReg.Show();                               //show frmReg
        }//end btnPrint
Esempio n. 4
0
        }//end connectToVoucherDb

        //function to checkUser if it exist
        private void checkUser()
        {
            voucherDatabase.Open();                                                  //opens database connection
            //command in database stored in querystr
            String       queryStr = "SELECT count(*) FROM useraccount WHERE username='******' AND userpass ='******'";
            OleDbCommand oleDbCmd = new OleDbCommand(queryStr, voucherDatabase);     //creates new oledbCommand with parameters queryStr and voucherDatabase

            int count = (int)oleDbCmd.ExecuteScalar();                               //stores executescalar if a username and password exist as 1 or 0

            if (count > 0)                                                           //if statement if a match was found
            {
                voucherDatabase.Close();                                             //closes database connection
                frmRegister formReg = new frmRegister();                             //creates new frmRegister called frmReg
                formReg.Show();                                                      //show frmReg
                this.Hide();                                                         //hides the current form
            }
            else
            {
                MessageBox.Show("Invalid Account");                                 //prompts a messagebox that indicates no username and password exists
                txtUser.Text = "";                                                  //clears txtUser textbox
                txtPass.Text = "";                                                  //clears txtPass textBox
                voucherDatabase.Close();                                            //closes database connection
            }
        }//end checkUser