Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="coursEvent"></param>
        public DataCard(CoursEvent coursEvent)
        {
            using (var db = new SchoolContext()) {
                var currentCous = db.Studies.Find(coursEvent.CoursGuid);

                Guid  = coursEvent.CoursGuid;
                Date1 = coursEvent.EventDate;
                Info1 = currentCous.Subject.Name + " (" + currentCous.Subject.Sigle + ")";
                Info2 = currentCous.Classe.Name + " (" + currentCous.Classe.Filiere.Name + ")";
                Info3 = coursEvent.EventDate.ToShortDateString() + " (" + coursEvent.StartTime.ProperTimeSpan() + "-" +
                        coursEvent.EndTime.ProperTimeSpan() + ") - Salle " + currentCous.Room;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="coursEvent"></param>
        /// <param name="isStaff"></param>
        public CoursCard(CoursEvent coursEvent, bool isStaff = false)
        {
            using (var db = new SchoolContext())
            {
                var currentCous = db.Studies.Find(coursEvent.CoursGuid);

                Type      = currentCous.Type;
                CoursGuid = currentCous.StudyGuid;
                Salle     = currentCous.Room?.ToUpper();
                CoursDate = coursEvent.EventDate;
                StartTime = currentCous.StartTime;
                EndTime   = currentCous.EndTime;
                ForeColor = "Black";

                var m = db.Subjects.Find(currentCous.SubjectGuid);

                MatiereName = m.Name.Substring(0, 1).ToUpper() + m.Name.Substring(1).ToLower();
                Couleur     = m.Couleur;

                StaffFullName = isStaff ? currentCous.Classe.Sigle : currentCous.Proff.Person.FullName;
            }

            if (coursEvent.EventDate < DateTime.Today)
            {
                ForeColor = "Gray";
            }
            else if (coursEvent.EventDate == DateTime.Today)
            {
                if (EndTime < DateTime.Now.TimeOfDay)
                {
                    ForeColor = "Gray";
                }

                if (StartTime <= DateTime.Now.TimeOfDay && EndTime >= DateTime.Now.TimeOfDay)
                {
                    ForeColor = "Red";
                }
            }
        }