void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this._timeRule   = timeRule;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);
            this.RaisePropertyChanged(() => ShowMaxNumber);
            this.RaisePropertyChanged(() => ShowSameMaxNumber);

            var cp = CommonDataManager.GetCPCase(base.LocalID);

            this.Sources = cp.GetClassHours(cp.ClassHours.Select(ch => ch.ID)?.ToArray());

            var results = new List <UITwoStatusWeek>();
            var groups  = cp.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);
                    results.Add(week);
                }
            }
            this.Periods = results;

            this.Search();
        }
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            this._timeRule   = timeRule;
            base.OpratorEnum = opratorEnum;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

            this.Days = new Dictionary <string, DayOfWeek>()
            {
                { "星期一", DayOfWeek.Monday },
                { "星期二", DayOfWeek.Tuesday },
                { "星期三", DayOfWeek.Wednesday },
                { "星期四", DayOfWeek.Thursday },
                { "星期五", DayOfWeek.Friday },
                { "星期六", DayOfWeek.Saturday },
                { "星期日", DayOfWeek.Sunday },
            };

            this.Day = "星期一";

            var cp = CommonDataManager.GetCPCase(base.LocalID);

            this.Periods = cp.GetDayPeriods();

            this.SelectPeriod = this.Periods.FirstOrDefault();

            Sources = cp.GetClassHours(cp.ClassHours?.Select(c => c.ID)?.ToArray());

            this.Search();
        }
예제 #3
0
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this._timeRule   = timeRule;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

            var cp = CommonDataManager.GetCPCase(base.LocalID);

            this.Sources = cp.GetClassHours(cp.ClassHours?.Select(ch => ch.ID)?.ToArray());

            this.Search();
        }
예제 #4
0
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this._timeRule   = timeRule;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

            //this.MaxTips = $"(1-{CommonDataManager.Hours})";

            if (timeRule == AdministrativeAlgoRuleEnum.TeachersMaxGapsPerDay)
            {
                this.Teachers = new List <UITeacher>()
                {
                    new UITeacher
                    {
                        ID   = string.Empty,
                        Name = "所有教师"
                    }
                };

                this.SelectTeacher = this.Teachers.First();
            }
            else
            {
                var cp = CommonDataManager.GetCPCase(base.LocalID);

                this.Teachers = cp.Teachers.Select(t =>
                {
                    return(new UITeacher()
                    {
                        ID = t.ID,
                        Name = t.Name
                    });
                })?.ToList();
            }

            this.SelectTeacher = this.Teachers.FirstOrDefault();
        }
예제 #5
0
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

            var cp = CommonDataManager.GetCPCase(base.LocalID);

            this.Teachers = cp.Teachers.Select(t =>
            {
                return(new UITeacher()
                {
                    ID = t.ID,
                    Name = t.Name
                });
            })?.ToList();

            this.SelectTeacher = this.Teachers.FirstOrDefault();

            var results = new List <UITwoStatusWeek>();
            var groups  = cp.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);
                    results.Add(week);
                }
            }
            this.Periods = results;
        }
예제 #6
0
        public HostView(AdministrativeAlgoRuleEnum ruleEnum) : this()
        {
            this.Title = $"高级-{ruleEnum.GetLocalDescription()}";

            if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHourRequiredStartingTime)
            {
                FillContainer(new RequiredStartingTimeView());
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHourRequiredStartingTimes ||
                     ruleEnum == AdministrativeAlgoRuleEnum.ClassHourRequiredTimes)
            {
                FillContainer(new ClassHourRequiredTimes(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursNotOverlap)
            {
                FillContainer(new HoursNotOverlapView());
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursMaxConcurrencyInSelectedTime ||
                     ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursOccupyMaxTimeFromSelection)
            {
                FillContainer(new ClassHoursTimesValue(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursRequiredStartingTimes ||
                     ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursRequiredTimes)
            {
                FillContainer(new ClassHoursRequiredTimes(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursSameStarting ||
                     ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursSameStartingHour ||
                     ruleEnum == AdministrativeAlgoRuleEnum.ClassHoursSameStartingTime)
            {
                FillContainer(new HoursSameStartingView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.MaxDaysBetweenClassHours ||
                     ruleEnum == AdministrativeAlgoRuleEnum.MinDaysBetweenClassHours)
            {
                FillContainer(new BetweenClassHoursView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.ThreeClassHoursGrouped ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TwoClassHoursContinuous ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TwoClassHoursGrouped ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TwoClassHoursOrdered)
            {
                FillContainer(new MultipyClassHoursView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.TeacherMaxDaysPerWeek ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TeachersMaxDaysPerWeek)
            {
                FillContainer(new Algo.Teacher.MaxDaysPerWeekView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.TeacherMaxGapsPerDay ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TeachersMaxGapsPerDay)
            {
                FillContainer(new Algo.Teacher.MaxGapsPerDayView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.TeacherMaxHoursDaily ||
                     ruleEnum == AdministrativeAlgoRuleEnum.TeachersMaxHoursDaily)
            {
                FillContainer(new Algo.Teacher.MaxHoursDailyView(ruleEnum));
            }
            else if (ruleEnum == AdministrativeAlgoRuleEnum.TeacherNotAvailableTimes)
            {
                FillContainer(new NotAvailableTimesView());
            }
        }