コード例 #1
0
        void createCommand()
        {
            CreateClassHourSameOpenView win = new CreateClassHourSameOpenView();

            win.Closed += (s, arg) =>
            {
                if (win.DialogResult.Value)
                {
                    var last  = this.Rules.LastOrDefault();
                    var index = last == null ? 0 : last.NO;

                    var rule = new UISameOpenTime()
                    {
                        NO      = index + 1,
                        Classes = win.Classes,
                        Display = win.Classes?.Select(c =>
                        {
                            return(c.Display);
                        })?.Parse()
                    };

                    var cl = base.GetClCase(base.LocalID);

                    var details = new XYKernel.OS.Common.Models.Mixed.Rule.SameOpenDetailsModel();
                    rule.Classes.ForEach(c =>
                    {
                        var hours = cl.GetClassHours(c.CourseID, c.ID, c.LevelID);
                        if (hours?.Count > 0)
                        {
                            for (int i = 0; i < hours?.Count; i++)
                            {
                                c.HourIndexs.Add(new Models.Mixed.UIClassHourIndex()
                                {
                                    Index     = i,
                                    IsChecked = true
                                });
                            }
                        }
                    });

                    this.Rules.Add(rule);
                }
            };
            win.ShowDialog();
        }
コード例 #2
0
        void createCommand()
        {
            CreateClassHourSameOpenView win = new CreateClassHourSameOpenView();

            win.Closed += (s, arg) =>
            {
                if (win.DialogResult.Value)
                {
                    var last  = this.Rules.LastOrDefault();
                    var index = last == null ? 0 : last.NO;

                    var rule = new UISameOpenTime()
                    {
                        NO      = index + 1,
                        Classes = win.Classes,
                    };

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

                    var details = new XYKernel.OS.Common.Models.Administrative.Rule.SameOpenDetailsModel();
                    rule.Classes.ForEach(c =>
                    {
                        var hours = cp.GetClassHours(c.CourseID, c.ID);
                        if (hours?.Count > 0)
                        {
                            for (int i = 0; i < hours?.Count; i++)
                            {
                                c.HourIndexs.Add(new Models.Administrative.UIClassHourIndex()
                                {
                                    Index     = i,
                                    IsChecked = true
                                });
                            }
                        }
                    });

                    this.Rules.Add(rule);
                }
            };
            win.ShowDialog();
        }