void saveCommand(object obj)
        {
            ModifyClassHourSameOpen win = obj as ModifyClassHourSameOpen;

            var groups = (from c in this.Classes from cc in c.HourIndexs where !c.ID.Equals("0") select cc)?.GroupBy(cc => cc.Index);

            if (groups != null)
            {
                // 如果存在少于两个的选项则提示信息
                var has = groups.Any(g => g.ToList().Count(gg => gg.IsChecked) == 1);
                if (has)
                {
                    this.ShowDialog("提示信息", "只有选择两个以上才有效!", CustomControl.Enums.DialogSettingType.OnlyOkButton, CustomControl.Enums.DialogType.Warning);
                    return;
                }
            }

            // 1.移除一行记录
            this.Classes.RemoveAll(c => c.ID.Equals("0"));

            var allUnSelected = this.Classes.All(c => c.HourIndexs.All(h => h.IsChecked == false));

            if (allUnSelected)
            {
                this.ShowDialog("提示信息", "至少要选择两个课时!", CustomControl.Enums.DialogSettingType.OnlyOkButton, CustomControl.Enums.DialogType.Warning);
                return;
            }

            // 2.选择班级
            win.Classes = this.Classes;
            // 3.关闭当前窗口
            win.DialogResult = true;
        }
Beispiel #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.main = ((OSKernel.Presentation.Arranging.Administrative.Modify.Rule.ClassHour.Dialog.ModifyClassHourSameOpen)(target));
                return;

            case 2:
                this.btn_save = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.btn_cancel = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void cancelCommand(object obj)
        {
            ModifyClassHourSameOpen win = obj as ModifyClassHourSameOpen;

            win.DialogResult = false;
        }