示例#1
0
        public void Initilize()
        {
            Messenger.Default.Register <HostView>(this, save);

            this.Comments = CommonDataManager.GetAdminRuleComments(AdministrativeRuleEnum.ClassUnion);


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

            rule.ClassUnions.ForEach(u =>
            {
                UIClassUnion model = new UIClassUnion();
                var course         = cp.Courses.FirstOrDefault(c => c.ID.Equals(u.CourseID));
                if (course != null)
                {
                    model.CourseID   = course.ID;
                    model.CourseName = course.Name;
                }

                var classes = (from c in cp.Classes
                               from cc in u.ClassIDs
                               where c.ID.Equals(cc)
                               select new UIClass()
                {
                    ID = c.ID,
                    Name = c.Name,
                })?.ToList();
                model.Classes = classes;

                this.Rules.Add(model);
            });
        }
示例#2
0
        void deleteRule(object obj)
        {
            var result = this.ShowDialog("提示信息", "确认删除?", CustomControl.Enums.DialogSettingType.OkAndCancel, CustomControl.Enums.DialogType.Warning);

            if (result == CustomControl.Enums.DialogResultType.OK)
            {
                UIClassUnion rule = obj as UIClassUnion;
                this.Rules.Remove(rule);
            }
        }
        void createCommand()
        {
            CreateClassUnion win = new CreateClassUnion();

            win.Closed += (s, arg) =>
            {
                if (win.DialogResult.Value)
                {
                    UIClassUnion model = new UIClassUnion()
                    {
                        Classes    = win.SelectClasses,
                        CourseID   = win.SelectCourse.ID,
                        CourseName = win.SelectCourse.Name,
                    };
                    this.Rules.Add(model);
                }
            };
            win.ShowDialog();
        }
示例#4
0
        void createCommand()
        {
            CreateClassUnion win = new CreateClassUnion();

            win.Closed += (s, arg) =>
            {
                if (win.DialogResult.Value)
                {
                    UIClassUnion model = new UIClassUnion()
                    {
                        Classes    = win.SelectClasses,
                        CourseID   = win.SelectCourse.ID,
                        CourseName = win.SelectCourse.Name,
                    };

                    var has = this.Rules.Any(r =>
                    {
                        return(r.Classes.Count == model.Classes.Count &&
                               r.Classes.All(rc =>
                        {
                            return model.Classes.Any(mc => mc.ID.Equals(rc.ID) && mc.CourseID.Equals(rc.CourseID));
                        }));
                    });

                    if (!has)
                    {
                        this.Rules.Add(model);
                    }
                    else
                    {
                        this.ShowDialog("提示信息", "存在相同的规则!", CustomControl.Enums.DialogSettingType.OnlyOkButton, CustomControl.Enums.DialogType.Warning);
                    }
                }
            };
            win.ShowDialog();
        }