public LessonLogEventView(LessonLogEvent evt)
 {
     LessonLogEventId = evt.LessonLogEventId;
     if (evt.OldLesson == null)
     {
         OldLesson = "";
     }
     else
     {
         OldLesson = evt.OldLesson.TeacherForDiscipline.Discipline.StudentGroup.Name + Environment.NewLine +
             evt.OldLesson.TeacherForDiscipline.Discipline.Name + Environment.NewLine +
             evt.OldLesson.TeacherForDiscipline.Teacher.FIO + Environment.NewLine +
             evt.OldLesson.Calendar.Date.ToString("d.MM.yyyy") + Environment.NewLine +
             evt.OldLesson.Ring.Time.ToString("H:mm") + Environment.NewLine +
             evt.OldLesson.Auditorium.Name;
     }
     if (evt.NewLesson == null)
     {
         NewLesson = "";
     }
     else
     {
         NewLesson = evt.NewLesson.TeacherForDiscipline.Discipline.StudentGroup.Name + Environment.NewLine +
             evt.NewLesson.TeacherForDiscipline.Discipline.Name + Environment.NewLine +
             evt.NewLesson.TeacherForDiscipline.Teacher.FIO + Environment.NewLine +
             evt.NewLesson.Calendar.Date.ToString("d.MM.yyyy") + Environment.NewLine +
             evt.NewLesson.Ring.Time.ToString("H:mm") + Environment.NewLine +
             evt.NewLesson.Auditorium.Name;
     }
     DateTime = evt.DateTime.ToString("d MM yyyy HH:mm:ss");
     PublicComment = evt.PublicComment;
     HiddenComment = evt.HiddenComment;
 }
Exemple #2
0
        public LleView(LessonLogEvent e)
        {
            EventId = e.LessonLogEventId;

            EventDate = e.DateTime.ToString("dd MM yyyy HH:mm:ss");

            EventType = -1;
            if ((e.OldLesson == null) && (e.NewLesson != null))
            {
                EventType = 1;
            }
            else
            {
                if ((e.OldLesson != null) && (e.NewLesson == null))
                {
                    EventType = 2;
                }
                else
                {

                    if ((e.OldLesson.TeacherForDiscipline.TeacherForDisciplineId ==
                            e.NewLesson.TeacherForDiscipline.TeacherForDisciplineId) &&
                        (e.OldLesson.Auditorium.AuditoriumId != e.NewLesson.Auditorium.AuditoriumId))
                    {
                        EventType = 3;
                    }

                }
            }

            switch (EventType)
            {
                case 1:
                    Message  = e.NewLesson.TeacherForDiscipline.Discipline.StudentGroup.Name + Environment.NewLine;
                    Message += e.NewLesson.Calendar.Date.ToString("dd.MM.yyyy") + " - " + e.NewLesson.Ring.Time.ToString("H:mm") + Environment.NewLine;
                    Message += e.NewLesson.TeacherForDiscipline.Discipline.Name + Environment.NewLine;
                    Message += e.NewLesson.TeacherForDiscipline.Teacher.FIO + Environment.NewLine;
                    Message += e.NewLesson.Auditorium.Name;
                    break;
                case 2:
                    Message  = e.OldLesson.TeacherForDiscipline.Discipline.StudentGroup.Name + Environment.NewLine;
                    Message += e.OldLesson.Calendar.Date.ToString("dd.MM.yyyy") + " - " + e.OldLesson.Ring.Time.ToString("H:mm") + Environment.NewLine;
                    Message += e.OldLesson.TeacherForDiscipline.Discipline.Name + Environment.NewLine;
                    Message += e.OldLesson.TeacherForDiscipline.Teacher.FIO + Environment.NewLine;
                    Message += e.OldLesson.Auditorium.Name;
                    break;
                case 3:
                    Message  = e.NewLesson.TeacherForDiscipline.Discipline.StudentGroup.Name + Environment.NewLine;
                    Message += e.NewLesson.Calendar.Date.ToString("dd.MM.yyyy") + " - " + e.NewLesson.Ring.Time.ToString("H:mm") + Environment.NewLine;
                    Message += e.NewLesson.TeacherForDiscipline.Discipline.Name + Environment.NewLine;
                    Message += e.NewLesson.TeacherForDiscipline.Teacher.FIO + Environment.NewLine;
                    Message += e.OldLesson.Auditorium.Name + " => " + e.NewLesson.Auditorium.Name;
                    break;
            }
        }
Exemple #3
0
        private void acceptLessons_Click(object sender, EventArgs e)
        {
            foreach (var lesson in _curLessons[_curLessons.Keys.ElementAt(_curTfdIndex)].Item2)
            {
                lesson.State = 1;

                _repo.Lessons.UpdateLesson(lesson);

                var acceptEvent = new LessonLogEvent
                {
                    DateTime = DateTime.Now,
                    OldLesson = null,
                    NewLesson = lesson,
                    PublicComment = "Утверждён проект"
                };
                _repo.LessonLogEvents.AddLessonLogEvent(acceptEvent);
            }

            Close();
        }
 public MySQLLessonLogEvent(LessonLogEvent logEvent)
 {
     LessonLogEventId = logEvent.LessonLogEventId;
     if (logEvent.OldLesson != null)
     {
         OldLessonId = logEvent.OldLesson.LessonId;
     }
     else
     {
         OldLessonId = -1;
     }
     if (logEvent.NewLesson != null)
     {
         NewLessonId = logEvent.NewLesson.LessonId;
     }
     else
     {
         NewLessonId = -1;
     }
     DateTime = logEvent.DateTime.ToString("yyyy-MM-dd HH:mm:ss");
     PublicComment = logEvent.PublicComment;
     HiddenComment = logEvent.HiddenComment;
 }
        public LessonLogEvent AddLessonLogEvent(LessonLogEvent lessonLogEvent)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                lessonLogEvent.LessonLogEventId = 0;
                lessonLogEvent.OldLesson = (lessonLogEvent.OldLesson == null) ? null : context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.OldLesson.LessonId);
                lessonLogEvent.NewLesson = (lessonLogEvent.NewLesson == null) ? null : context.Lessons.FirstOrDefault(l => l.LessonId == lessonLogEvent.NewLesson.LessonId);

                context.LessonLog.Add(lessonLogEvent);
                context.SaveChanges();

                return lessonLogEvent;
            }
        }
        public void UpdateLessonLogEvent(LessonLogEvent lessonLogEvent)
        {
            using (var context = new ScheduleContext(ConnectionString))
            {
                var curLessonLogEvent = context.LessonLog.FirstOrDefault(lle => lle.LessonLogEventId == lessonLogEvent.LessonLogEventId);

                curLessonLogEvent.DateTime = lessonLogEvent.DateTime;
                curLessonLogEvent.HiddenComment = lessonLogEvent.HiddenComment;
                curLessonLogEvent.NewLesson = lessonLogEvent.NewLesson;
                curLessonLogEvent.OldLesson = lessonLogEvent.OldLesson;
                curLessonLogEvent.PublicComment = lessonLogEvent.PublicComment;

                context.SaveChanges();
            }
        }