Exemple #1
0
        /// <summary>
        /// Le Rapport d'Assudite Par Periode
        /// </summary>
        public PeriodeAttendance(Guid personGuid, SchoolPeriod schoolPeriod)
        {
            using (var db = new SchoolContext())
            {
                var personTickets = db.AbsenceTickets.Where(tk =>
                                                            tk.PersonGuid == personGuid &&
                                                            (
                                                                tk.CoursDate >= schoolPeriod.StartDate &&
                                                                tk.CoursDate <= schoolPeriod.EndDate
                                                            )
                                                            ).OrderBy(tk => tk.CoursDate).ToList();

                foreach (var personTicket in personTickets)
                {
                    TicketsCardList.Add(new AssiduiteCard(personTicket));
                }

                PeriodeName = schoolPeriod.Name.ToUpper();

                PeriodeTime = "  (" + schoolPeriod.StartDate.GetValueOrDefault().ToShortDateString() + " -> " +
                              schoolPeriod.EndDate.GetValueOrDefault().ToShortDateString() + ")";

                PersonFullName = db.Students.Find(personGuid)?.Person.FullName ?? db.Staffs.Find(personGuid)?.Person.FullName;

                foreach (var ticket in personTickets)
                {
                    if (!ticket.IsPresent)
                    {
                        TotalAbsences = TotalAbsences + 1;
                    }
                    else
                    {
                        TotalRetards    = TotalRetards + 1;
                        TotalRatardTime = TotalRatardTime.Add(ticket.RetardTime);
                    }
                }

                TrimestreTotal = TotalAbsences > 0 ? "Absences " + TotalAbsences + " fois,  " : "Aucune Absence,  ";

                TrimestreTotal = TotalRetards > 0
                    ? TrimestreTotal + "Retards " + TotalRetards + " fois en "
                                 + TotalRatardTime.ProperTimeSpan() + " mins"
                    : TrimestreTotal + "Aucun Retard";
            }
        }
Exemple #2
0
        public AttendenceRepport(Guid personGuid, DateTime?fromDate, DateTime?toDate)
        {
            using (var db = new SchoolContext()) {
                var personTickets = db.AbsenceTickets.Where(tk =>
                                                            tk.PersonGuid == personGuid &&
                                                            (
                                                                tk.CoursDate >= fromDate &&
                                                                tk.CoursDate <= toDate
                                                            )
                                                            ).OrderBy(tk => tk.CoursDate).ToList();

                foreach (var personTicket in personTickets)
                {
                    TicketsCardList.Add(new AssiduiteCard(personTicket));
                }

                PersonFullName = db.Staffs.Find(personGuid)?.Person.FullName ?? db.Staffs.Find(personGuid)?.Person.FullName;
                PhotoIdentity  = db.Staffs.Find(personGuid)?.Person.PhotoIdentity ?? db.Staffs.Find(personGuid)?.Person.PhotoIdentity;

                foreach (var ticket in personTickets)
                {
                    if (!ticket.IsPresent)
                    {
                        TotalAbsences = TotalAbsences + 1;
                    }
                    else
                    {
                        TotalRetards    = TotalRetards + 1;
                        TotalRatardTime = TotalRatardTime.Add(ticket.RetardTime);
                    }
                }

                TotalDescription = TotalAbsences > 0 ? "Absences " + TotalAbsences + " fois,  " : "Aucune Absence,  ";

                TotalDescription = TotalRetards > 0
                    ? TotalDescription + "Retards " + TotalRetards + " fois en "
                                   + TotalRatardTime.ProperTimeSpan() + " mins"
                    : TotalDescription + "Aucun Retard";
            }
        }