Beispiel #1
0
        void save(object obj)
        {
            var group = this.Preselections.Where(p => p.IsChecked).GroupBy(p => p.CourseID);

            var isSelectMoreLevel = group.Any(g => g.Count() > 1);

            if (isSelectMoreLevel)
            {
                this.ShowDialog("提示信息", "每个科目只能选择一个层!", CustomControl.Enums.DialogSettingType.OnlyOkButton, CustomControl.Enums.DialogType.Warning);
                return;
            }

            SetStudentPreselectionWindow window = obj as SetStudentPreselectionWindow;

            // 清除
            window.Preselections = new List <UIPreselection>();

            // 添加
            this.Preselections.Where(p => p.IsChecked)?.ToList()?.ForEach(p =>
            {
                UIPreselection uiPreselection = new UIPreselection()
                {
                    Course    = p.Course,
                    CourseID  = p.CourseID,
                    IsChecked = p.IsChecked,
                    Level     = p.Level,
                    LevelID   = p.LevelID
                };
                window.Preselections.Add(uiPreselection);
            });

            window.DialogResult = true;
        }
Beispiel #2
0
        void cancel(object obj)
        {
            SetStudentPreselectionWindow window = obj as SetStudentPreselectionWindow;

            window.DialogResult = false;
        }