Exemplo n.º 1
0
 private void confirm_Click(object sender, EventArgs e)
 {
     DBconnect chckOut = new DBconnect();
     chckOut.DBConnect();
     chckOut.checkoutConfirm(userName, gameTitle);
     this.Close();
 }
Exemplo n.º 2
0
 private void submit_Click(object sender, EventArgs e)
 {
     checkOutUPCIn = CheckOutUPC.Text;
     if (checkOutUPCIn == "")
     {
         MessageBox.Show("Please scan a game before hitting enter");
     }
     else
     {
         DBconnect chkout = new DBconnect();
         chkout.DBConnect();
         Tuple<string,string,string,string> output = chkout.checkoutQuery(username, checkOutUPCIn);
         if (output.Item1 != "")
         {
             qname = output.Item1;
             qConsole = output.Item2;
             qDescr = output.Item3;
             qImage = output.Item4;
             //MessageBox.Show(qname+"\n"+qConsole);
             confirmCheckout confirm = new confirmCheckout();
             confirm.Show();
             CheckOutUPC.Clear();
             this.Visible = false;
         }
         else
         {
             MessageBox.Show("The item you scanned is not in our database\nYou must scan a game currently available in the locker");
         }
     }
 }
Exemplo n.º 3
0
 //Function called when yes is selected, begins the process of 
 private void button1_Click(object sender, EventArgs e)
 {
     //Admin must choose a genre from a drop down menu as genre is not provided by Walmart, will deny if genre hasn't been selected
     string genre = genreBox.Text;
     if(genre == "Choose Here")
     {
         MessageBox.Show("Please select a genre from the drop-down menu");
     }
     else
     {
         //genre is selected, begin the DB insertion process
         DBconnect insert = new DBconnect();
         insert.DBConnect();
         bool isOpen = insert.OpenConnection();
         if (isOpen == false)
         {
             //Ensure DB coneection is still available
             MessageBox.Show("Failed to establish database connection");
         }
         else
         {
             //See DBconnect.cs for implementation, pass all variables in the correct order
             insert.populateDB(AdminAddGame.gameName, genre, AdminAddGame.console, AdminAddGame.description, AdminAddGame.UPC, AdminAddGame.imageLink);
         }
         //always close
         this.Close();
     }  
 }
Exemplo n.º 4
0
        //Submit button, initiates login when clicked
        private void button1_Click(object sender, EventArgs e)
        {
            //Assigns username and password variables to their repsective text fields
            userName = UserNameField.Text;
            string password = PasswordField.Text;
            UserNameField.Focus();
            //Creates DBconnect object that will handle DB work
            DBconnect data = new DBconnect();
            data.DBConnect();
            bool isOpen = data.OpenConnection();
            if(isOpen == false)
            {
                MessageBox.Show("Failed to establish database connection");
            }
            else
            {
                //See DBconnect.cs for implementation, if function returns false, user credentials were denied
                if (data.Validate(userName, password) == false)
                {
                    MessageBox.Show("Invalid user name or password, please try again.");
                }
                else
                {
                    //Credentials are legitimate, must check if it was a user or admin 
                    if(data.isAdmin(userName) == true)
                    {
                        //user was admin, open the admin form
                        //MessageBox.Show("Welcome Admin");
                        AdminWindow ad = new AdminWindow();
                        //create reference to admin form window in order to recal this form after it is hidden
                        ad.RefToLogin = this;
                        //hide this form and display admin window
                        this.Visible = false;
                        ad.Show();
                       
                    }
                    else
                    {
                        //User was plain user, open the user form
                        //MessageBox.Show("Welcome User");
                        UserWindow us = new UserWindow();
                        //Same process as the admin
                        us.RefToLogin = this;
                        this.Visible = false;
                        us.Show();

                    }
                    //Clear all text fields and rehighlight the username so when the form is called again 
                    //everything is blank and the username is ready for another
                    UserNameField.Text = string.Empty;
                    PasswordField.Text = string.Empty;
                }
            }
        }
Exemplo n.º 5
0
 private void checkIn_Click(object sender, EventArgs e)
 {
     DBconnect inchk = new DBconnect();
     inchk.DBConnect();
     if (inchk.checkinEligible(name) == true)
     {
         checkIn1.Visible = true;
         checkIn1.CheckInUPC.Focus();
         this.AcceptButton = checkIn1.button1;
     }
     else
     {
         MessageBox.Show("You cannot check-in a game if you have not checked one out.\nPlease hit the Check-Out button to select a game to rent.");
     }
 }
Exemplo n.º 6
0
        private void ViewInventory_Load(object sender, EventArgs e)
        {
            //open dbconnect object to take connectionString and use here to connect to DB
            DBconnect grid = new DBconnect();
            grid.DBConnect();
            MySqlConnection conn = new MySqlConnection(grid.connectionString);
            //Close DBconnect object to avoid collision
            grid.CloseConnection();
            //Start working with the local MySql connection
            conn.Open();
            //Exclude games that have no records
            da = new MySqlDataAdapter("SELECT * FROM Games WHERE count > 0", conn);
            //Fill the DataAdapter with current state of the DB
            ds = new DataSet();
            da.Fill(ds, sTable);
            conn.Close();
            //Show the datagridview of the current DB
            dataGridView1.Refresh();
            dataGridView1.DataSource = ds;
            dataGridView1.DataMember = sTable;

        }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     if(CheckInUPC.Text == "")
     {
         MessageBox.Show("You must scan a game before hitting enter");
     }
     else
     {
         DialogResult confirmation = MessageBox.Show("Are you sure you want to return this game?", "Check In", MessageBoxButtons.YesNo);
         if (confirmation == DialogResult.Yes)
         {
             string chkinUPC = CheckInUPC.Text;
             DBconnect chkin = new DBconnect();
             chkin.DBConnect();
             chkin.checkInConfirm(username, chkinUPC);
             CheckInUPC.Clear();
             this.Visible = false;
         }
         else if (confirmation == DialogResult.No)
         {
             //do nothing
         }
     }
 }
Exemplo n.º 8
0
 private void checkOut_Click(object sender, EventArgs e)
 {
     DBconnect outchk = new DBconnect();
     outchk.DBConnect();
     if (outchk.checkoutEligible(name) == true)
     {
         checkOut1.Visible = true;
         checkOut1.CheckOutUPC.Focus();
         this.AcceptButton = checkOut1.submit;
     }
     else
     {
         MessageBox.Show("You already have a game checked out!\nYou can only have one game checked out at a time.\nPlease check in the game you previously rented before renting another.");
     }
     
 }