Exemplo n.º 1
0
 public StudentLessonInfoViewModel(StudentLessonEntity studentLesson, ICommand addNote, ICommand showStudent)
 {
     StudentLesson  = studentLesson;
     AddStudentNote = addNote;
     ShowStudent    = showStudent;
     this.GroupText = string.Join(", ",
                                  studentLesson.Student.Groups?.Select(entity => entity.Name) ?? new List <string>());
 }
Exemplo n.º 2
0
        private void Register(StudentLessonEntity model)
        {
            model.IsRegistered     = true;
            model.RegistrationTime = DateTime.Now;
            this.LessonStudents.Remove(model);
            this.RegisteredStudents.Add(model);

            _db.ThrottleSave();
        }
        public void ShowStudentLessonNotes(StudentLessonEntity studentLesson)
        {
            var studentLessonNotes = new NoteListFormToken("Заметки", () => new StudentLessonNote {
                StudentLesson = studentLesson,
                EntityId      = studentLesson.Id
            }, _context.StudentLessonNotes.Where(note => note.EntityId == studentLesson.Id).ToList());

            _windowPageHost.AddPageAsync(studentLessonNotes);
        }
Exemplo n.º 4
0
        private void RegisterExtStudent(StudentEntity studentEntity)
        {
            var studentLessonModel = new StudentLessonEntity {
                _LessonId        = Lesson.Id,
                Lesson           = Lesson,
                _StudentId       = studentEntity.Id,
                Student          = studentEntity,
                IsRegistered     = true,
                RegistrationTime = DateTime.Now
            };
            var studentLessonInfoViewModel =
                new StudentLessonInfoViewModel(studentLessonModel, AddStudentNote, ShowStudent);

            this.RegisteredStudents.Add(studentLessonInfoViewModel);
            _studentLessons.Add(studentLessonInfoViewModel);
            _db.StudentLessons.Add(studentLessonModel);
            _db.ThrottleSave();
        }
Exemplo n.º 5
0
        public StudentLessonViewBox(StudentLessonEntity studentLesson, StudentViewPageModel model, LocalDbContext context)
        {
            _model              = model;
            _context            = context;
            this.StudentLesson  = studentLesson;
            this.LessonTypeName = LocalizationContainer.Localization[$"common.lesson.type.{studentLesson.Lesson.LessonType}"];

            this.ToggleRegistrationHandler =
                ReactiveCommand.Create(() => model.ToggleRegistration(this));
            this.OpenLessonHandler =
                ReactiveCommand.Create(() => model.OpenLesson(StudentLesson.Lesson));
            this.ShowLessonNotesHandler =
                ReactiveCommand.Create(() => model.ShowStudentLessonNotes(StudentLesson));
            this.IsLessonNotesVisible  = (this.StudentLesson.Lesson.Notes?.Count ?? 0) > 0;
            this.IsStudentNotesVisible = (this.StudentLesson.Notes?.Count ?? 0) > 0;
            this.LessonTime            = $"{studentLesson.Lesson.Schedule?.Begin:hh\\:mm}-{studentLesson.Lesson.Schedule?.End:hh\\:mm}";
            switch (studentLesson.Lesson.LessonType)
            {
            case LessonType.Lecture: {
                this.Background = new SolidColorBrush(Color.FromArgb(20, 255, 255, 0));
                break;
            }

            case LessonType.Practice: {
                this.Background = new SolidColorBrush(Color.FromArgb(20, 50, 50, 255));
                break;
            }

            case LessonType.Laboratory: {
                this.Background = new SolidColorBrush(Color.FromArgb(20, 50, 255, 50));
                break;
            }
            }

            this.Border = !studentLesson.IsRegistered.HasValue || studentLesson.IsRegistered == false
                ? new SolidColorBrush(Color.FromRgb(255, 0, 0))
                : new SolidColorBrush(Color.FromArgb(100, 0, 0, 0));
        }
 public override void Apply(NoteEntity trackable)
 {
     base.Apply(trackable);
     this.StudentLesson = (trackable as StudentLessonNote)?.StudentLesson;
 }
 public StudentAttestationExamView(StudentLessonEntity studentLesson, StudentViewPageModel model, int order)
 {
     _model             = model;
     this.StudentLesson = studentLesson;
     this.Header        = LocalizationContainer.Interpolate("page.student.view.attestation.header.label", order);
 }
 private async Task ToggleRegistration(StudentLessonEntity studentLesson)
 {
     studentLesson.IsRegistered     = studentLesson.IsLessonMissed;
     studentLesson.RegistrationTime = DateTime.Now;
     await _context.SaveChangesAsync();
 }