Exemple #1
0
        public Initialization_LessonType()
        {
            LessonType lt1 = new LessonType()
            {
                LessonTypeId   = 1,
                LessonTypeName = "Лекция"
            };
            LessonType lt2 = new LessonType()
            {
                LessonTypeId   = 2,
                LessonTypeName = "Практическое занятие"
            };

            LessonType lt3 = new LessonType()
            {
                LessonTypeId   = 3,
                LessonTypeName = "Лабораторная работа"
            };
            LessonType lt4 = new LessonType()
            {
                LessonTypeId   = 4,
                LessonTypeName = "Экзамен"
            };
            LessonType lt5 = new LessonType()
            {
                LessonTypeId   = 5,
                LessonTypeName = "Зачет"
            };

            _lessonTypes.Add(lt1);
            _lessonTypes.Add(lt2);
            _lessonTypes.Add(lt3);
            _lessonTypes.Add(lt4);
            _lessonTypes.Add(lt5);
        }
Exemple #2
0
 public static CardModel GetCardModel(Card card, Set cardSet, Rarity cardRarity, CardType cardType, CardDetail cardDetail,
                                      Language language, LessonType lessonType, LessonType providesLesson,
                                      CardProvidesLesson cardProvidesLesson)
 {
     return(new CardModel()
     {
         CardId = card.CardId,
         CardSet = SetService.GetSetModel(cardSet),
         CardType = TypeService.GetCardTypeModel(cardType),
         Rarity = RarityService.GetRarityModel(cardRarity),
         Detail = CardDetailService.GetCardDetailModel(cardDetail, language),
         LessonType = lessonType == null ? null : LessonService.GetLessonTypeModel(lessonType),
         LessonCost = card.LessonCost,
         ActionCost = card.ActionCost,
         CardNumber = card.CardNumber,
         Orientation = card.Orientation,
         ProvidesLesson = providesLesson == null && cardProvidesLesson == null ? null :
                          CardProvidesLessonService.GetCardProvidesLessonModel(cardProvidesLesson, providesLesson),
         CardPageUrl = $"/Card/{cardSet.ShortName}/{card.CardNumber}/{cardDetail.Name.Replace(" ", "-")}",
         CreatedById = card.CreatedById,
         CreatedDate = card.CreatedDate,
         UpdatedById = card.UpdatedById,
         UpdatedDate = card.UpdatedDate,
         Deleted = card.Deleted,
     });
 }
Exemple #3
0
 public Lesson(Guid id, string name, int lessonNumber, AppPath appPath, string description,
               string contentUrl, Guid?dependentOnLessonId, bool newFeature, string questionField,
               int correctAnswer, string answer1, string answer2, string answer3, string answer4,
               string answer5, string answer6, LessonType type, bool published = false, bool enabled = false)
 {
     Id                  = id;
     Name                = name;
     LessonNumber        = lessonNumber;
     AppPath             = appPath;
     Description         = description;
     Published           = published;
     ContentURL          = contentUrl;
     DependentOnLessonId = dependentOnLessonId;
     NewFeature          = newFeature;
     QuestionField       = questionField;
     CorrectAnswer       = correctAnswer;
     Answer1             = answer1;
     Answer2             = answer2;
     Answer3             = answer3;
     Answer4             = answer4;
     Answer5             = answer5;
     Answer6             = answer6;
     Enabled             = enabled;
     Type                = type;
     NewFeature          = newFeature;
 }
        public async Task <IActionResult> PutLessonType(int id, LessonType lessonType)
        {
            if (id != lessonType.Id)
            {
                return(BadRequest());
            }

            _context.Entry(lessonType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LessonTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        private void radioButtons_CheckedChanged(object sender, EventArgs e)
        {
            studentListBox.Items.Clear();
            addButton.Enabled           = true;
            studentBrowseButton.Enabled = true;

            if (groupLessonRButton.Checked)
            {
                lessonType = LessonType.Group;
            }
            else if (privateLessonRButton.Checked)
            {
                lessonType = LessonType.Private;

                if (personType == PersonType.Student)
                {
                    addButton.Enabled           = false;
                    studentBrowseButton.Enabled = false;
                }
            }
            else if (semiPrivateLessonRButton.Checked)
            {
                lessonType = LessonType.SemiPrivate;
            }
        }
        /// <summary>
        /// Initialises a new instance of the Tennis_Management_Software.TimetableInputForm class.
        /// </summary>
        public TimetableInputForm(StudentTimetable studentTimetable)
        {
            InitializeComponent();
            InitializeRadioButtons();
            this.personType = PersonType.Student;
            this.lessonType = studentTimetable.TypeOfLesson;
            FillStudentInformation(studentTimetable);

            switch (lessonType)
            {
            case LessonType.Private:
                addButton.Enabled           = false;
                studentBrowseButton.Enabled = false;
                break;

            case LessonType.SemiPrivate:
                if (studentListBox.Items.Count == 1)
                {
                    addButton.Enabled           = false;
                    studentBrowseButton.Enabled = false;
                }
                else
                {
                    addButton.Enabled           = true;
                    studentBrowseButton.Enabled = true;
                }
                break;

            case LessonType.Group:
                addButton.Enabled           = true;
                studentBrowseButton.Enabled = true;
                break;
            }
        }
Exemple #7
0
 //Получить аудитории привязанные к определенному предмету по определенному типу занятия
 private IEnumerable <ScheduleRoom> GetRoomsBindingDiscipline(LessonType type, string discipline)
 {
     return(Rooms.Select(room => room).Where(room =>
                                             (type == LessonType.Lection && room.DisciplinesLection.Where(disc => disc == discipline).Count() > 0) ||
                                             (type == LessonType.Labwork && room.DisciplinesLabWork.Where(disc => disc == discipline).Count() > 0) ||
                                             (type == LessonType.Practice && room.DisciplinesPractice.Where(disc => disc == discipline).Count() > 0)));
 }
        public async Task <ActionResult <LessonType> > PostLessonType(LessonType lessonType)
        {
            _context.LessonTypes.Add(lessonType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLessonType", new { id = lessonType.Id }, lessonType));
        }
        public ClassStudentLessonResponse GetClassStudentLessons(long classId, LessonType lessonType, DateTime classDate)
        {
            TeacherTimetableService service =
                new TeacherTimetableService(base.SchoolId, base.CurrentUser.UserId);

            return(service.GetClassStudentLessons(classId, lessonType, classDate, base.CurrentUser.UserId));
        }
Exemple #10
0
        public async Task AsyncWhenCreateALessonStudentGivenAnStudentThatIsAlreadyThere()
        {
            var mockLessonStudentRepository = GetDefaultILessonStudentRepositoryInstance();
            var mockLessonRepository        = GetDefaultILessonRepositoryInstance();
            var mockStudentRepository       = GetDefaultIStudentRepositoryInstance();
            var mockUnitOfWork = GetDefaultIUnitOfWorkInstance();



            //LESSON TYPE
            LessonType lessonType = new LessonType();

            lessonType.Id               = 1;
            lessonType.Lessons          = new List <Lesson>();
            lessonType.StudentsQuantity = 2;

            //LESSON
            Lesson lesson = new Lesson();

            lesson.Id           = 1;
            lesson.Vacants      = 2;
            lesson.LessonType   = lessonType;
            lesson.LessonTypeId = lessonType.Id;


            lessonType.Lessons.Add(lesson);

            LessonStudent lessonStudent = new LessonStudent();

            lessonStudent.LessonId  = 1;
            lessonStudent.StudentId = 104;


            //STUDENT
            Student student = new Student();

            student.Id            = 104;
            lessonStudent.Lesson  = lesson;
            lessonStudent.Student = student;



            mockStudentRepository.Setup(r => r.FindById(student.Id))
            .Returns(Task.FromResult <Student>(student));
            mockLessonRepository.Setup(r => r.FindById(lesson.Id))
            .Returns(Task.FromResult <Lesson>(lesson));
            mockLessonStudentRepository.Setup(r => r.FindById(lessonStudent.LessonId, lessonStudent.StudentId))
            .Returns(Task.FromResult <LessonStudent>(lessonStudent));
            mockLessonStudentRepository.Setup(r => r.AddAsync(lessonStudent))
            .Returns(Task.FromResult <LessonStudent>(lessonStudent));
            mockLessonStudentRepository.Setup(r => r.ExistsByLessonIdAndStudentId(lessonStudent.LessonId, lessonStudent.StudentId))
            .Returns(Task.FromResult <LessonStudent>(lessonStudent));
            var service = new LessonStudentService(mockLessonStudentRepository.Object, mockUnitOfWork.Object, mockLessonRepository.Object, mockStudentRepository.Object);
            LessonStudentResponse result = await service.SaveAsync(lessonStudent);

            var message = result.Message;

            message.Should().Be("You are already part of this lesson");
        }
Exemple #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            LessonType lessontype = db.LessonTypes.Find(id);

            db.LessonTypes.Remove(lessontype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #12
0
 public void SetDomainDefault(string subject, LessonType type) //set default domain (all possible values)
 {
     Days      = new List <string>(_fullDomain.Days);
     Times     = new List <string>(_fullDomain.Times);
     Audiences = new List <int>(_fullDomain.Audiences);
     Teachers  = new List <string>(_fullDomain.Teachers);
     CutOffStaticLimitations(subject, type);
 }
 public IQueryable <Lesson> Get(int LectorId, int CourseId, LessonType Type) =>
 Entityes
 .Include(L => L.Lector)
 .Include(L => L.Course)
 .Where(Lesson =>
        Lesson.Lector.Id == LectorId &&
        Lesson.Course.Id == CourseId &&
        Lesson.Type == Type);
Exemple #14
0
 public void SetDomainDefault(String subject, LessonType type)   //set default domain (all possible values)
 {
     _days      = new List <String>(_fullDomain._days);
     _times     = new List <String>(_fullDomain._times);
     _audiences = new List <int>(_fullDomain._audiences);
     _teachers  = new List <String>(_fullDomain._teachers);
     CutOffStaticLimitations(subject, type);
 }
Exemple #15
0
        public DomainSet(JsonElement element, String subject, LessonType type, ValuePickingHeuristic heuristic, FilteringHeuristic filtering) : this(element)
        {
            CutOffStaticLimitations(subject, type);

            if (heuristic != ValuePickingHeuristic.NONE || filtering != FilteringHeuristic.NONE)
            {
                FillPossibleValues();
            }
        }
Exemple #16
0
 public void GivenALesson(string p0)
 {
     lesson         = new Lesson();
     lesson.Id      = 1;
     lesson.Vacants = 2;
     lessonType     = new LessonType();
     lessonType.Id  = 2;
     lessonType.StudentsQuantity = 0;
 }
        public static (Color Left, Color Right) ToColorGradient(this LessonType lesson)
        {
            if (lesson == LessonType.None)
            {
                return(Color.white, Color.white);
            }

            return(Color.white, lesson.ToColor());
        }
        public IHttpActionResult GetLessonType(int id)
        {
            LessonType result = BusinessLayer.GetRow <LessonType>(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
Exemple #19
0
 private void CutOffStaticLimitations(string subject, LessonType type)
 {
     if (type == LessonType.Lecture)
     {
         Audiences = Audiences.Where(x => _lectureAudiences.Contains(x)).ToList();
         Teachers  = new List <string> {
             _subjectLecturer[subject]
         };
     }
 }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the Tennis_Management_Software.Timetabling.StudentTimetable class.
 /// </summary>
 public StudentTimetable(DayOfWeek day, Time fromTime, Time toTime,
                         byte tennisCourtNum, string coachName, LessonType typeOfLesson)
 {
     this.Day            = day;
     this.FromTime       = fromTime;
     this.ToTime         = toTime;
     this.TennisCourtNum = tennisCourtNum;
     this.CoachName      = coachName;
     this.TypeOfLesson   = typeOfLesson;
 }
Exemple #21
0
        //
        // GET: /LessonType/Edit/5

        public ActionResult Edit(int id = 0)
        {
            LessonType lessontype = db.LessonTypes.Find(id);

            if (lessontype == null)
            {
                return(HttpNotFound());
            }
            return(View(lessontype));
        }
Exemple #22
0
        /// <summary> Переназначить занятие </summary>
        public void UpdateFields(string teaher, string discipline, IEnumerable <string> groups, LessonType type)
        {
            Teacher = teaher;

            Discipline = discipline;

            Groups = groups.ToList();

            Type = type;
        }
Exemple #23
0
 /// <summary>
 /// 获取课次列表
 /// <para>作    者:zhiwei.Tang</para>
 /// <para>创建时间:2019-03-11</para>
 /// </summary>
 /// <param name="schoolId">校区ID</param>
 /// <param name="classId">班级Id</param>
 /// <param name="date">日期</param>
 /// <param name="lessonType">课次类型</param>
 /// <param name="adjustTypes">调整状态</param>
 /// <returns>课次列表</returns>
 public List <ViewTimReplenishLessonStudent> GetLessonList(
     string schoolId, long classId, DateTime date, LessonType lessonType,
     List <int> adjustTypes)
 {
     return(this.QueryableViewTimLessonStudent()
            .Where(x => x.SchoolId == schoolId && x.ClassId == classId &&
                   x.ClassDate == date && x.LessonType == (int)lessonType &&
                   adjustTypes.Contains(x.AdjustType))
            .ToList());
 }
Exemple #24
0
 GameObject GetLessonPrefabByType(LessonType type)
 {
     foreach (AppScreen l in lessonsPool)
     {
         if (l.type == type)
         {
             return(l.gameObject);
         }
     }
     return(null);
 }
        public async Task <LessonType> CreateLessonTypeAsync(LessonType entity)
        {
            using (var transaction = _transactionFactory.Begin())
            {
                entity.OnSale = entity.Offers.Any(o => o.OnSale);
                await _repository.AddAsync(entity);

                transaction.Save();
            }
            return(entity);
        }
Exemple #26
0
        }//end Constructor

        //Constructor
        public Lesson(DayOfWeek dayOfWeek, TimeSpan timeOfDayStart, TimeSpan timeOfDayEnd, Course course, string location, List<ScheduleEvent> lessons, LessonType type)
        {
            this.dayOfWeek = dayOfWeek;
            this.timeOfDayStart = timeOfDayStart;
            this.timeOfDayEnd = timeOfDayEnd;
            this.course = course;
            this.location = location;
            this.lessons = lessons;
            this.type = type;

        }//end Constructor
Exemple #27
0
        public void Add(string Name, LessonType Type, DateTime StartTime, DateTime EndTime)
        {
            XmlElement e = doc.CreateElement("lesson");

            e.SetAttribute("name", Name);
            e.SetAttribute("type", Type.ToString());
            e.SetAttribute("starttime", StartTime.ToShortTimeString());
            e.SetAttribute("endtime", EndTime.ToShortTimeString());
            doc.SelectSingleNode("/hapConfig/bookingsystem/lessons").AppendChild(e);
            base.Add(new Lesson(e));
        }
        /// <summary>
        /// 获取一个班级某一天的上课信息
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-03-15</para>
        /// </summary>
        /// <param name="schoolId">校区Id</param>
        /// <param name="classId">班级Id</param>
        /// <param name="day">某一天</param>
        /// <param name="lessonType">课次类型</param>
        /// <returns>班级某一天的上课信息列表</returns>
        public List <ViewCompleteStudentAttendance> GetClassInfoTheDayList(
            string schoolId, long classId, DateTime day, LessonType lessonType)
        {
            var query = this.BuildBasisQueryable
                        .Where(x => x.SchoolId == schoolId &&
                               x.ClassId == classId &&
                               x.ClassDate == day &&
                               x.LessonType == (int)lessonType)
                        .ToList();

            return(query);
        }
Exemple #29
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="teacher">Преподаватель</param>
 /// <param name="discimpline">Дисциплина</param>
 /// <param name="groups">Группы</param>
 /// <param name="hours">Часы за семестр</param>
 /// <param name="type">Тип занятия</param>
 public LoadItem(string teacher,
                 string discimpline,
                 List <string> groups,
                 decimal hours,
                 LessonType type)
 {
     Teacher    = teacher;
     Discipline = discimpline;
     Groups     = groups;
     HoursSem   = hours;
     LessonType = type;
 }
Exemple #30
0
        public async Task <IActionResult> StartLesson(string groupCourseId, LessonType type)
        {
            var lesson = await lessonRepository.Create(new Lesson
            {
                GroupCourseId = groupCourseId,
                LessonType    = type,
                Date          = DateTime.Now
            });

            var groupCourse = await groupCourseRepository.Get(groupCourseId);

            var students = await studentRepository.GetByGroupId(groupCourse.GroupId);

            var marks = new List <Mark>();

            foreach (var student in students)
            {
                marks.Add(new Mark
                {
                    StudentId = student.Id,
                    MarkType  = (type == LessonType.Lecture || type == LessonType.Seminar) ? MarkType.Activity : (MarkType)((int)type - 1)
                });
            }

            var viewModel = new StartLessonViewModel {
                GroupCourse = groupCourse, Type = type, Students = students, Marks = marks
            };

            var result = new KeyValuePair <bool, List <Mark> >();

            if (type == LessonType.FirstMiddle)
            {
                result = await mlDataRepository.GetFirstMiddlePrediction(groupCourseId);
            }
            else if (type == LessonType.SecondMiddle)
            {
                result = await mlDataRepository.GetSecondMiddlePrediction(groupCourseId);
            }
            else if (type == LessonType.Final)
            {
                result = await mlDataRepository.GetFinalPrediction(groupCourseId);
            }

            if (!result.Key)
            {
                viewModel.ErrorMessage = "Error occured when trying to predict marks";
            }
            else
            {
                viewModel.PredictedMarks = result.Value;
            }
            return(View("AddLesson", viewModel));
        }
        public JsonResult TeachersForLesson(int id, LessonType type, string elId)
        {
            ScheduleItemIdModel idModel = ScheduleHelper.ParseScheduleItemId(elId);

            int lessonId = id;
            LessonType lessonType = type;
            ApplicationDbContext context = new ApplicationDbContext();

            //Find teachers for this lesson number (to check further if teacher is unavailable)
            var teacherLessonsAcordingToElId = context.ScheduleItems
                .Where(
                    i =>
                        i.SemesterId == idModel.SemesterId && i.DayOfWeek == idModel.DayOfWeek &&
                        i.LessonNumber == idModel.LessonNumber && i.LessonFrequency == idModel.LessonFrequency)
                .ToList();
            var teacherLessonsIdsAcordingToElId = teacherLessonsAcordingToElId.Select(j => j.TeacherId).ToList();

            var teachers = context.Form3s
                .Where(i => i.LessonId == lessonId && i.LessonType == lessonType)
                .Where(k => (context.ScheduleItems.Count(i => i.LessonId == lessonId && i.TeacherId == k.TeacherId)) <= k.Hours) //Check GENERAL Hours
                .Where(z => teacherLessonsIdsAcordingToElId.Contains(z.TeacherId) == false) //Check acording to elId
                .Select(j => j.Teacher).ToList();

            //Check Max Lessons For This Day

            //get restriction
            Restriction MaxLessonsPerDayForTeachers = context.Restrictions.Single(i => i.Name == "MaxLessonsPerDayForTeachers");
            int maxLessons = Convert.ToInt32(MaxLessonsPerDayForTeachers.Value);

            List<ScheduleItem> scheduleItemsForDay = context.ScheduleItems.Where(
                    i =>
                        i.SemesterId == idModel.SemesterId && i.DayOfWeek == idModel.DayOfWeek
                        //&& i.GroupId == idModel.GroupId
                        ).ToList();

            List<ScheduleItem> scheduleItemsForLesson = scheduleItemsForDay.Where(
                    i =>
                        i.LessonNumber == idModel.LessonNumber
                        ).ToList();

            List<Teacher> teachersFiltered = new List<Teacher>();
            foreach (var teacher in teachers)
            {

                int numOfLessonsNominator =
                 scheduleItemsForDay.Where(
                     i =>
                         i.TeacherId == teacher.Id &&
                         (i.LessonFrequency == LessonFrequency.Constant || i.LessonFrequency == LessonFrequency.Nominator))
                     .Count();
                int numOfLessonsDeminator =
                    scheduleItemsForDay.Where(
                        i =>
                            i.TeacherId == teacher.Id &&
                            (i.LessonFrequency == LessonFrequency.Constant || i.LessonFrequency == LessonFrequency.Denominator))
                        .Count();

                if (idModel.LessonFrequency == LessonFrequency.Constant)
                {
                    if (numOfLessonsNominator < maxLessons && numOfLessonsDeminator < maxLessons)
                    {
                        teachersFiltered.Add(teacher);
                    }
                }
                else if (idModel.LessonFrequency == LessonFrequency.Nominator)
                {
                    if (numOfLessonsNominator < maxLessons)
                    {
                        teachersFiltered.Add(teacher);
                    }
                }
                else if (idModel.LessonFrequency == LessonFrequency.Denominator)
                {
                    if (numOfLessonsDeminator < maxLessons)
                    {
                        teachersFiltered.Add(teacher);
                    }
                }
            }
            teachers = teachersFiltered;

            return Json(teachers, JsonRequestBehavior.AllowGet);
        }