public void Initilize() { Messenger.Default.Register <HostView>(this, save); this.Comments = CommonDataManager.GetAdminAlgoComments(Models.Enums.AdministrativeAlgoRuleEnum.TeacherNotAvailableTimes); var rule = CommonDataManager.GetAminAlgoRule(base.LocalID); var cp = CommonDataManager.GetCPCase(base.LocalID); int no = 0; rule.TeacherNotAvailableTimes.ForEach(n => { var newRule = new UITeacherRule() { NO = ++no, ForbidTimes = n.Times, IsActive = n.Active, Weight = n.Weight, UID = n.UID, }; var teacher = cp.Teachers.FirstOrDefault(t => t.ID.Equals(n.TeacherID)); newRule.TeacherID = teacher?.ID; newRule.Name = teacher?.Name; this.Rules.Add(newRule); }); }
void modifyCommand(object obj) { UITeacherRule rule = obj as UITeacherRule; if (this.CurrentRuleEnum == AdministrativeAlgoRuleEnum.TeacherMaxHoursDaily) { CreateMaxHoursDaily createWin = new CreateMaxHoursDaily(Models.Enums.OperatorEnum.Modify, Models.Enums.AdministrativeAlgoRuleEnum.TeacherMaxHoursDaily, rule); createWin.Closed += (s, arg) => { var modify = createWin.Modify; if (createWin.DialogResult.Value) { rule.IsActive = modify.IsActive; rule.Value = modify.Value; rule.Weight = modify.Weight; } }; createWin.ShowDialog(); } else { CreateMaxHoursDaily createWin = new CreateMaxHoursDaily(Models.Enums.OperatorEnum.Modify, Models.Enums.AdministrativeAlgoRuleEnum.TeachersMaxHoursDaily, rule); createWin.Closed += (s, arg) => { var modify = createWin.Modify; if (createWin.DialogResult.Value) { rule.IsActive = modify.IsActive; rule.Value = modify.Value; rule.Weight = modify.Weight; } }; createWin.ShowDialog(); } }
void bind(UITeacherRule receive) { this.UID = receive.UID; this.Weight = receive.Weight; this.IsActive = receive.IsActive; this.SelectTeacher = this.Teachers.FirstOrDefault(t => t.ID.Equals(receive.TeacherID)); this.MaxGaps = receive.Value; }
void deleteCommand(object obj) { UITeacherRule rule = obj as UITeacherRule; var result = this.ShowDialog("提示信息", "确认删除?", CustomControl.Enums.DialogSettingType.OkAndCancel, CustomControl.Enums.DialogType.Warning); if (result == CustomControl.Enums.DialogResultType.OK) { this.Rules.Remove(rule); } }
public void BindData(AdministrativeAlgoRuleEnum ruleEnum) { this.CurrentRuleEnum = ruleEnum; this.Comments = CommonDataManager.GetAdminAlgoComments(ruleEnum); var rule = CommonDataManager.GetAminAlgoRule(base.LocalID); if (rule == null) { return; } var cp = CommonDataManager.GetCPCase(base.LocalID); int no = 0; if (this.CurrentRuleEnum == AdministrativeAlgoRuleEnum.TeacherMaxHoursDaily) { rule.TeacherMaxHoursDailys.ForEach(t => { var teacher = cp.Teachers.FirstOrDefault(f => f.ID.Equals(t.TeacherID)); UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.TeacherID = teacher?.ID; ui.Name = teacher?.Name; ui.Weight = t.Weight; ui.IsActive = t.Active; ui.Value = t.MaxHours; this.Rules.Add(ui); }); } else { rule.TeachersMaxHoursDailys?.ForEach(t => { UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.Name = "所有教师"; ui.Weight = t.Weight; ui.IsActive = t.Active; ui.Value = t.MaxHours; this.Rules.Add(ui); }); } }
public void BindData(MixedAlgoRuleEnum ruleEnum) { this.CurrentRuleEnum = ruleEnum; this.Comments = CommonDataManager.GetMixedAlgoComments(ruleEnum); var rule = base.GetCLAlgoRule(base.LocalID); var cl = base.GetClCase(base.LocalID); int no = 0; if (this.CurrentRuleEnum == MixedAlgoRuleEnum.TeacherMaxHoursDaily) { rule.TeacherMaxHoursDailys.ForEach(t => { var teacher = cl.Teachers.FirstOrDefault(f => f.ID.Equals(t.TeacherID)); UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.TeacherID = teacher?.ID; ui.Name = teacher?.Name; ui.Weight = t.Weight; ui.IsActive = t.Active; ui.Value = t.MaxHours; this.Rules.Add(ui); }); } else { rule.TeachersMaxHoursDailys?.ForEach(t => { UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.Name = "所有教师"; ui.Weight = t.Weight; ui.IsActive = t.Active; ui.Value = t.MaxHours; ui.TeacherID = string.Empty; this.Rules.Add(ui); }); } }
void modifyCommand(object obj) { UITeacherRule rule = obj as UITeacherRule; CreateMaxGapsPerDay createWin = new CreateMaxGapsPerDay(Models.Enums.OperatorEnum.Modify, this.GetCurrentRuleEnum(), rule); createWin.Closed += (s, arg) => { var modify = createWin.Modify; if (createWin.DialogResult.Value) { rule.IsActive = modify.IsActive; rule.Value = modify.Value; rule.Weight = modify.Weight; } }; createWin.ShowDialog(); }
void bind(UITeacherRule receive) { this.UID = receive.UID; this.Weight = receive.Weight; this.IsActive = receive.IsActive; this.SelectTeacher = this.Teachers.FirstOrDefault(t => t.ID.Equals(receive.TeacherID)); receive.ForbidTimes.ForEach(t => { var period = this.Periods.First(p => p.Period.Period == t.Period); if (period != null) { if (t.Day == DayOfWeek.Monday) { period.Monday.IsChecked = false; } else if (t.Day == DayOfWeek.Tuesday) { period.Tuesday.IsChecked = false; } else if (t.Day == DayOfWeek.Wednesday) { period.Wednesday.IsChecked = false; } else if (t.Day == DayOfWeek.Thursday) { period.Thursday.IsChecked = false; } else if (t.Day == DayOfWeek.Friday) { period.Friday.IsChecked = false; } else if (t.Day == DayOfWeek.Saturday) { period.Saturday.IsChecked = false; } else if (t.Day == DayOfWeek.Sunday) { period.Sunday.IsChecked = false; } } }); }
void modifyCommand(object obj) { UITeacherRule rule = obj as UITeacherRule; CreateTeacherNoAvaliable createWin = new CreateTeacherNoAvaliable(Models.Enums.OperatorEnum.Modify, Models.Enums.AdministrativeAlgoRuleEnum.TeacherNotAvailableTimes, rule); createWin.Closed += (s, arg) => { var modify = createWin.Modify; if (createWin.DialogResult.Value) { rule.IsActive = modify.IsActive; rule.Value = modify.Value; rule.Weight = modify.Weight; rule.ForbidTimes = modify.ForbidTimes; } }; createWin.ShowDialog(); }
public void BindData(MixedAlgoRuleEnum ruleEnum) { this.SetCurrentRuleEnum(ruleEnum); var rule = base.GetCLAlgoRule(base.LocalID); var cl = base.GetClCase(base.LocalID); int no = 0; if (this.GetCurrentRuleEnum() == MixedAlgoRuleEnum.TeacherMaxGapsPerDay) { rule.TeacherMaxGapsPerDays.ForEach(t => { var teacher = cl.Teachers.FirstOrDefault(f => f.ID.Equals(t.TeacherID)); UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.TeacherID = teacher?.ID; ui.Name = teacher?.Name; ui.IsActive = t.Active; ui.Value = t.MaxGaps; this.Rules.Add(ui); }); } else { rule.TeachersMaxGapsPerDays?.ForEach(t => { UITeacherRule ui = new UITeacherRule(); ui.NO = ++no; ui.Name = "所有教师"; ui.IsActive = t.Active; ui.Value = t.MaxGaps; ui.TeacherID = string.Empty; this.Rules.Add(ui); }); } }
public void SetValue(OperatorEnum opratorEnum, MixedAlgoRuleEnum timeRule, UITeacherRule rule) { this.getBase(opratorEnum, timeRule); this.bind(rule); }
public CreateMaxHoursDaily(OperatorEnum operatorEnum, AdministrativeAlgoRuleEnum ruleType, UITeacherRule rule) : this() { VM?.SetValue(operatorEnum, ruleType, rule); }
public CreateMaxGapsPerDay(OperatorEnum operatorEnum, MixedAlgoRuleEnum ruleType, UITeacherRule rule) : this() { VM?.SetValue(operatorEnum, ruleType, rule); }
public CreateTeacherNoAvaliable(OperatorEnum operatorEnum, AdministrativeAlgoRuleEnum ruleType, UITeacherRule rule) : this() { VM?.SetValue(operatorEnum, ruleType, rule); }