Beispiel #1
0
        //To track the attendance of the students

        public static void RecordStudentAttendance()
        {
            string Attendance;

            Console.WriteLine("Press P/p if you are present");
            Console.WriteLine("Press A/a if you are absent");
            Attendance = Console.ReadLine().ToUpper();

            if (Attendance.Equals("P"))
            {
                Console.WriteLine("Data has been saved");
            }
            else if (Attendance.Equals("A"))
            {
                Console.WriteLine("Reason of Absence:");
                string reason = Console.ReadLine();
                Console.WriteLine("Date of Absence(MM/DD/YY):");
                string absentdate = Console.ReadLine();
                Console.WriteLine(" You are absent on" + absentdate + "due to" + reason);
                Console.WriteLine("Data has been saved");
            }
            else
            {
                Console.WriteLine("Invalid keyword please try again");
            }
        }
Beispiel #2
0
 private static TimeSpan calculateTimeSpent(Attendance attendance)
 {
     if ((attendance == null || attendance.Equals("")))
     {
         return(new TimeSpan(0));
     }
     if ((attendance.timeOut == null || attendance.timeOut.ToString().Equals("")))
     {
         attendance.timeOut = attendance.timeIn;
     }
     return(Convert.ToDateTime(attendance.timeOut.ToString("hh:mm:ss tt")) - Convert.ToDateTime(attendance.timeIn.ToString("hh:mm:ss tt")));
 }
        private void loadUserCurrentAttendance()
        {
            EmployeeControllerInterface employeeController = new EmployeeController();
            Employee employee = employeeController.fetchEmployeeByUsername(user.username);
            AttendanceControllerInterface attendanceController = new AttendanceController();
            Attendance attendance = attendanceController.fetchEmployeeAttendanceByDate(employee, DateTime.Now);

            if (attendance != null && !attendance.Equals(""))
            {
                clockedIn.Text  = attendance.timeIn.ToString();
                clockedOut.Text = attendance.timeOut.ToString("MM/dd/yyyy").Equals("01/01/0001") ? "N/A" : attendance.timeOut.ToString();
                DateTime timeToClockOut = calculateTimeToClockOut(attendance.timeIn);
                validClockOut.Text = timeToClockOut.ToString();
            }
            else
            {
                clockedIn.Text     = "Not yet clocked in.";
                clockedOut.Text    = "N/A";
                validClockOut.Text = "N/A";
            }
        }