コード例 #1
0
        private void Dg_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            UIMaxDaysPerWeek maxDays = e.Row.DataContext as UIMaxDaysPerWeek;

            if (maxDays != null)
            {
                maxDays.IsChecked = true;
            }
        }
コード例 #2
0
        public void Initilize()
        {
            this.Comments = CommonDataManager.GetAdminRuleComments(AdministrativeRuleEnum.TeacherMaxDaysPerWeek);

            Messenger.Default.Register <HostView>(this, save);

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

            // 绑定教师
            int no = 0;
            List <UIMaxDaysPerWeek> rules = new List <UIMaxDaysPerWeek>();

            cp.Teachers.ForEach(t =>
            {
                UIMaxDaysPerWeek teacherRule = new UIMaxDaysPerWeek()
                {
                    NO        = ++no,
                    CourseID  = string.Empty,
                    MaxDays   = 1,
                    TeacherID = t.ID,
                    Teacher   = t.Name,
                    Courses   = cp.GetCourses(t.ID),
                };
                rules.Add(teacherRule);
            });
            this.Rules = rules;

            // 绑定教师状态
            var rule = CommonDataManager.GetAminRule(base.LocalID);

            if (rule != null)
            {
                rule.MaxDaysPerWeek.ForEach(h =>
                {
                    var first = this.Rules.FirstOrDefault(r => r.TeacherID.Equals(h.TeacherID));
                    if (first != null)
                    {
                        first.Weight    = (Models.Enums.WeightTypeEnum)h.Weight;
                        first.MaxDays   = h.MaxDay;
                        first.IsChecked = true;
                    }
                });
            }
        }