Esempio n. 1
0
 private void PsoBack_Click(object sender, EventArgs e) // Method for the action when a user clicks on the Back button on the Sign Out panel
 {
     FNameSO.Clear();                                   // Clears text fields
     LNameSO.Clear();
     PSignout.Visible = false;                          // Shows main screen
     PSignin.Visible  = false;
 }
Esempio n. 2
0
        private void SOContinue()                                         // method to add a Sign Out time to a student
        {
            string          SOFName = FNameSO.Text;                       // Takes user's data enterted into the text box, and adds it as a string
            string          SOLName = LNameSO.Text;
            string          Date    = DateTime.Now.ToString("MM.dd.yyy"); // Create strings needed to add data to a database
            string          Time    = DateTime.Now.ToString("h:mm:ss");
            OleDbConnection conn    = new OleDbConnection();

            conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data source= C:\CheckIn\CheckIn.accdb";
            try
            {
                conn.Open();                                                                                                                                                                  // Opens database connection
                String       SOTime = "Update Table1 set [Time out] = '" + Time + "' Where [First Name] = '" + SOFName + "' and [Last Name] = '" + SOLName + "' and [Date] = '" + Date + "'"; // Adds the current time to the Time out field on the database
                OleDbCommand cmd    = new OleDbCommand(SOTime, conn);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex) // I mainly used this for debugging, however, if Faculty at South sees this message, they now to switch to paper until the problem is resolved
            {
                MessageBox.Show("Failed due to" + ex.Message);
            }
            finally
            {
                conn.Close();
                FNameSO.Clear(); // Clears Text fields so other users cannot see what the previous user inputted
                LNameSO.Clear();
                PSignedIn.Visible  = true;
                PSignout.Visible   = true;
                PSignin.Visible    = true;
                PSignedOut.Visible = true;
                SOWait5.Interval   = 5000; // Show the Signed Out message for 5 seconds
                SOWait5.Start();
            }
        }