コード例 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            try
            {
                if (textBox1.Text == "")
                {
                    return;
                }
                string         temp_text      = textBox1.Text.Replace("\n", "");
                StudentProfile studentProfile = General.GetProfileFromBarcode(temp_text, databasePath);
                label8.Text = "ID: " + studentProfile.ID.ToString();
                label9.Text = "Name: " + studentProfile.name.ToString();

                button4.Focus();

                if (General.FindAttendanceRecord(Convert.ToInt32(label8.Text.Replace("ID:", "")), databasePath) == null)
                {
                    groupBox4.Enabled = true;
                }
                else
                {
                    groupBox4.Enabled = false;
                }
            }
            catch
            {
                MessageBox.Show("Profile not found, add user first", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textBox1.Text = "";
            }
        }
コード例 #2
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) + "]";
        }