コード例 #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            AttendanceRecord attendanceRecord = General.FindAttendanceRecord(Convert.ToInt32(label8.Text.Replace("ID:", "")), databasePath);

            if (attendanceRecord != null)
            {
                DateTime dateTime = Convert.ToDateTime(attendanceRecord.dateTime);
                General.AddAttendanceReport(Convert.ToInt32(label8.Text.Replace("ID:", "")), dateTime, attendanceRecord.activity, attendanceRecord.mentor, General.GetIndexBasedOnCurrentTime(), databasePath);
                General.AddAttendanceSummaryReport(Convert.ToInt32(label8.Text.Replace("ID:", "")), dateTime, attendanceRecord.activity, attendanceRecord.mentor, General.GetIndexBasedOnCurrentTime(), databasePath);
                General.DeleteScannedProfileByID(Convert.ToInt32(label8.Text.Replace("ID:", "")), databasePath);
            }
            else
            {
                if (comboBox1.Text == "" || comboBox2.Text == "" || textBox1.Text == "")
                {
                    MessageBox.Show("Barcode, action and mentor fields have to be filled in.", "Not filled in", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                General.AddAttendanceRecord(Convert.ToInt32(label8.Text.Replace("ID:", "")), DateTime.Now, comboBox1.Text, comboBox2.Text, databasePath);
            }

            button4.PerformClick();
            comboBox1.Text = "";
            comboBox2.Text = "";

            groupBox4.Enabled = false;

            button8.Text = "Submit Database Data [" + General.GetNumberOfReports(databasePath) + "]";
        }
コード例 #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (CheckDatabaseConnection())
     {
         if (General.GetNumberOfReports(databasePath) != 0)
         {
             MessageBox.Show("Reports haven't been sent, click 'Submit Database Data' button before exiting", "Exit", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
         }
     }
 }
コード例 #3
0
        private void openDatabaseButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = openFileDialog1.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                databasePath = openFileDialog1.FileName;
                CheckDatabaseConnection();
                button8.Text = "Submit Database Data [" + General.GetNumberOfReports(databasePath) + "]";
            }
        }
コード例 #4
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (General.GetNumberOfReports(databasePath) != 0)
     {
         MessageBox.Show("Reports haven't been sent", "Exit", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
     }
     if (MessageBox.Show("Do you really want to exit", "Exit", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
     {
         Close();
     }
 }
コード例 #5
0
        private void button8_Click(object sender, EventArgs e)
        {
            foreach (AttendanceReport attendanceReport in General.GetAttendaceReports(databasePath))
            {
                General.SendMail(General.GetMailAdressByMentor(attendanceReport.mentor, databasePath),
                                 "Robotics Attendance Report",
                                 "APPROVED" + Environment.NewLine +
                                 "Name: " + General.GetProfileByID(attendanceReport.ID, databasePath).name + Environment.NewLine +
                                 "ID: " + attendanceReport.ID + Environment.NewLine +
                                 "Date & Time IN: " + attendanceReport.dateTimeIN + Environment.NewLine +
                                 "Date & Time OUT: " + attendanceReport.dateTimeOUT + Environment.NewLine +
                                 "How long [HH:MM:SS]: " + attendanceReport.deltaDateTime.Split('.')[0] + Environment.NewLine +
                                 "Activity: " + attendanceReport.activity + Environment.NewLine +
                                 "Mentor's name: " + attendanceReport.mentor + Environment.NewLine
                                 );
            }
            General.DeleteAllAttendanceReports(databasePath);

            button8.Text = "Submit Database Data [" + General.GetNumberOfReports(databasePath) + "]";
        }
コード例 #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            databasePath = Application.ExecutablePath.Replace("StudentProfileScanner.EXE", "") + "StudentProfileDatabase.s3db";
            if (CheckDatabaseConnection())
            {
                comboBox1.Items.Clear();
                comboBox2.Items.Clear();
                foreach (string item in General.GetActivities(databasePath))
                {
                    comboBox1.Items.Add(item);
                }
                foreach (string item in General.GetMentors(databasePath))
                {
                    comboBox2.Items.Add(item);
                }

                button8.Text = "Submit Database Data [" + General.GetNumberOfReports(databasePath) + "]";
            }
            else
            {
                MessageBox.Show("There is no database file in the same directory as this application, select the database file using 'Open database' button", "Database loading failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }