Exemple #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) + "]";
        }