Exemple #1
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     foreach (AttendanceReport attendanceReport in General.GetAttendaceSummaryReports(databasePath))
     {
         if (General.GetProfileByID(attendanceReport.ID, databasePath).name == listView1.SelectedItems[0].Text)
         {
             StudentInfoForm studentInfoForm = new StudentInfoForm(databasePath, attendanceReport);
             studentInfoForm.Show();
             return;
         }
     }
 }
Exemple #2
0
 public void UpdateListview()
 {
     listView1.Items.Clear();
     foreach (AttendanceReport attendanceReport in General.GetAttendaceSummaryReports(databasePath))
     {
         string[]     arr = new string[7];
         ListViewItem itm;
         arr[0] = General.GetProfileByID(attendanceReport.ID, databasePath).name;
         arr[1] = attendanceReport.dateTimeIN;
         arr[2] = attendanceReport.deltaDateTime;
         arr[3] = attendanceReport.dateTimeOUT;
         arr[4] = attendanceReport.activity;
         arr[5] = attendanceReport.mentor;
         arr[6] = attendanceReport.index.ToString();
         itm    = new ListViewItem(arr);
         listView1.Items.Add(itm);
     }
 }
Exemple #3
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) + "]";
        }
Exemple #4
0
        private void StudentInfoForm_Load(object sender, EventArgs e)
        {
            label5.Text = General.GetProfileByID(attendanceReport.ID, databasePath).name;
            label6.Text = attendanceReport.ID.ToString();

            ////////////////////////////////////////////////////// chart1
            List <StringInt> activitys     = new List <StringInt>();
            DateTimeMy       finalDateTime = new DateTimeMy(0, 0, 0, 0, 0, 0, DateTimeMy.PMorAM.NULL);

            foreach (AttendanceReport temp_attendanceReport in General.GetAttendaceSummaryReports(databasePath))
            {
                if (attendanceReport.ID == temp_attendanceReport.ID)
                {
                    finalDateTime = DateTimeMy.Add2DateTimes(finalDateTime, DateTimeMy.GetDateTimeFromString(temp_attendanceReport.deltaDateTime));
                    activitys.Add(new StringInt(temp_attendanceReport.activity, DateTimeMy.ConvertToSeconds(DateTimeMy.GetDateTimeFromString(temp_attendanceReport.deltaDateTime))));
                }
            }
            label7.Text = finalDateTime.hours + "h " + finalDateTime.minutes + "m " + finalDateTime.seconds + "s";

            List <StringInt> activitysAdded = new List <StringInt>();

            foreach (StringInt activity in activitys)
            {
                if (!StringInt.Contains(activitysAdded, activity.string1))
                {
                    activitysAdded.Add(new StringInt(activity.string1, 0));
                }
            }

            for (int i = 0; i < activitysAdded.Count; i++)
            {
                foreach (StringInt activity in activitys)
                {
                    if (activitysAdded[i].string1 == activity.string1)
                    {
                        activitysAdded[i] = new StringInt(activitysAdded[i].string1, activitysAdded[i].int1 + activity.int1);
                    }
                }
            }

            foreach (StringInt activityAdded in activitysAdded)
            {
                System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint = new System.Windows.Forms.DataVisualization.Charting.DataPoint();
                DateTimeMy dateTime = DateTimeMy.ConvertSeconds2DateTimeMy(activityAdded.int1);
                dataPoint.LegendText = activityAdded.string1 + ": " + (int)((dateTime.days + dateTime.months * 30 + dateTime.years * 360) * 24) + "h " +
                                       dateTime.minutes + "m " + dateTime.seconds + "s";
                dataPoint.YValues = new double[] { Convert.ToDouble(activityAdded.int1) };
                chart1.Series[0].Points.Add(dataPoint);
            }

            ////////////////////////////////////////////////////// chart2
            List <StringInt> mentors             = new List <StringInt>();
            DateTimeMy       finalDateTimeMentor = new DateTimeMy(0, 0, 0, 0, 0, 0, DateTimeMy.PMorAM.NULL);

            foreach (AttendanceReport temp_attendanceReport in General.GetAttendaceSummaryReports(databasePath))
            {
                if (attendanceReport.ID == temp_attendanceReport.ID)
                {
                    finalDateTimeMentor = DateTimeMy.Add2DateTimes(finalDateTimeMentor, DateTimeMy.GetDateTimeFromString(temp_attendanceReport.deltaDateTime));
                    mentors.Add(new StringInt(temp_attendanceReport.mentor, DateTimeMy.ConvertToSeconds(DateTimeMy.GetDateTimeFromString(temp_attendanceReport.deltaDateTime))));
                }
            }

            List <StringInt> mentorsAdded = new List <StringInt>();

            foreach (StringInt mentor in mentors)
            {
                if (!StringInt.Contains(mentorsAdded, mentor.string1))
                {
                    mentorsAdded.Add(new StringInt(mentor.string1, 0));
                }
            }

            for (int i = 0; i < mentorsAdded.Count; i++)
            {
                foreach (StringInt mentor in mentors)
                {
                    if (mentorsAdded[i].string1 == mentor.string1)
                    {
                        mentorsAdded[i] = new StringInt(mentorsAdded[i].string1, mentorsAdded[i].int1 + mentor.int1);
                    }
                }
            }

            foreach (StringInt mentorAdded in mentorsAdded)
            {
                System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint = new System.Windows.Forms.DataVisualization.Charting.DataPoint();
                DateTimeMy dateTime = DateTimeMy.ConvertSeconds2DateTimeMy(mentorAdded.int1);
                dataPoint.LegendText = mentorAdded.string1 + ": " + (int)((dateTime.days + dateTime.months * 30 + dateTime.years * 360) * 24) + "h " +
                                       dateTime.minutes + "m " + dateTime.seconds + "s";
                dataPoint.YValues = new double[] { Convert.ToDouble(mentorAdded.int1) };
                chart2.Series[0].Points.Add(dataPoint);
            }
        }