Example #1
0
 private void PsiBack_Click(object sender, EventArgs e) // Method for action taken when a user clicks the Back button on the Sign In panel
 {
     PsiFName.Clear();                                  // Clears fields so next user doesn't see the previous users input
     PsiLName.Clear();
     PsiID.Clear();
     G6.Checked         = false;
     G7.Checked         = false;
     G8.Checked         = false;
     TchCh.SelectedItem = null;
     PSignin.Visible    = false; // Displays main page
     PSignout.Visible   = false;
 }
Example #2
0
        private void ContinueSI()         // Method for adding users input to a database
        {
            string FName = PsiFName.Text; // Creates strings needed for inputting data into DB
            string LName = PsiLName.Text;
            string ID    = PsiID.Text;
            string Grade = "";

            if (G6.Checked)
            {
                Grade = G6.Text;
            }
            if (G7.Checked)
            {
                Grade = (G7.Text);
            }
            if (G8.Checked)
            {
                Grade = (G8.Text);
            }
            string          Teacher = TchCh.GetItemText(TchCh.SelectedItem);
            string          Date    = DateTime.Now.ToString("MM.dd.yyy");
            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();                                                                                                                                // Connects to database
                String WriteChkIn = "INSERT INTO Table1([Date],[First Name],[Last Name],[Student ID],Grade,[Here to see],[Time In])" +
                                    "VALUES('" + Date + "','" + FName + "','" + LName + "','" + ID + "','" + Grade + "','" + Teacher + "','" + Time + "')"; // Enters users info into DB
                OleDbCommand cmd = new OleDbCommand(WriteChkIn, conn);
                cmd.ExecuteNonQuery();
                PsiFName.Clear(); // Clears fields on Sign In panel so the next user doesn't see the previous user's input
                PsiLName.Clear();
                PsiID.Clear();
                G6.Checked         = false;
                G7.Checked         = false;
                G8.Checked         = false;
                TchCh.SelectedItem = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed due to" + ex.Message); // 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
            }
            finally
            {
                conn.Close();
            }
            PSignout.Visible  = true;
            PSignedIn.Visible = true;
            SIWait5.Interval  = 5000;
            SIWait5.Start(); // Displays Signed Out panel for 5 seconds
        }