void getBase(OperatorEnum opratorEnum, MixedAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this._timeRule   = timeRule;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

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

            var results = new List <UITwoStatusWeek>();
            var groups  = cl.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);
                    results.Add(week);
                }
            }

            this.Periods = results;
            this.Search();
        }
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this._timeRule   = timeRule;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);
            this.RaisePropertyChanged(() => ShowMaxNumber);
            this.RaisePropertyChanged(() => ShowSameMaxNumber);

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

            this.Sources = cp.GetClassHours(cp.ClassHours.Select(ch => ch.ID)?.ToArray());

            var results = new List <UITwoStatusWeek>();
            var groups  = cp.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);
                    results.Add(week);
                }
            }
            this.Periods = results;

            this.Search();
        }
        private void Border_norml_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Border          border      = sender as Border;
            UITwoStatusWeek dataContext = border.DataContext as UITwoStatusWeek;

            if (dataContext.PositionType != XYKernel.OS.Common.Enums.Position.AB &&
                dataContext.PositionType != XYKernel.OS.Common.Enums.Position.PB &&
                dataContext.PositionType != XYKernel.OS.Common.Enums.Position.Noon)
            {
                var isChecked = dataContext.Monday.IsChecked;
                var isLeft    = dataContext.Monday.IsMouseLeft;

                if (!isChecked)
                {
                    dataContext.Monday.IsChecked   = true;
                    dataContext.Monday.IsMouseLeft = false;

                    dataContext.Tuesday.IsChecked   = true;
                    dataContext.Tuesday.IsMouseLeft = false;

                    dataContext.Wednesday.IsChecked   = true;
                    dataContext.Wednesday.IsMouseLeft = false;

                    dataContext.Thursday.IsChecked   = true;
                    dataContext.Thursday.IsMouseLeft = false;

                    dataContext.Friday.IsChecked   = true;
                    dataContext.Friday.IsMouseLeft = false;

                    dataContext.Saturday.IsChecked   = true;
                    dataContext.Saturday.IsMouseLeft = false;

                    dataContext.Sunday.IsChecked   = true;
                    dataContext.Sunday.IsMouseLeft = false;
                }
                else
                {
                    dataContext.Monday.IsChecked   = !isChecked;
                    dataContext.Monday.IsMouseLeft = !isLeft;

                    dataContext.Tuesday.IsChecked   = !isChecked;
                    dataContext.Tuesday.IsMouseLeft = !isLeft;

                    dataContext.Wednesday.IsChecked   = !isChecked;
                    dataContext.Wednesday.IsMouseLeft = !isLeft;

                    dataContext.Thursday.IsChecked   = !isChecked;
                    dataContext.Thursday.IsMouseLeft = !isLeft;

                    dataContext.Friday.IsChecked   = !isChecked;
                    dataContext.Friday.IsMouseLeft = !isLeft;

                    dataContext.Saturday.IsChecked   = !isChecked;
                    dataContext.Saturday.IsMouseLeft = !isLeft;

                    dataContext.Sunday.IsChecked   = !isChecked;
                    dataContext.Sunday.IsMouseLeft = !isLeft;
                }
            }
        }
        public void Initilize()
        {
            var rule = base.GetClRule(base.LocalID);

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

            var groups = cl.Positions.OrderBy(p => p.DayPeriod.Period).GroupBy(p => p.DayPeriod.Period);

            var periods = new List <UITwoStatusWeek>();

            foreach (var g in groups)
            {
                Dictionary <DayOfWeek, bool> weekSelected = new Dictionary <DayOfWeek, bool>();
                g.ToList().ForEach(gg =>
                {
                    weekSelected.Add(gg.DayPeriod.Day, gg.IsSelected);
                });

                var first     = g.First();
                var dayPeriod = first.DayPeriod;
                var period    = new UITwoStatusWeek()
                {
                    PositionType = first.Position,
                    Monday       = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Monday]
                    },
                    Tuesday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Tuesday]
                    },
                    Wednesday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Wednesday],
                    },
                    Thursday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Thursday],
                    },
                    Friday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Friday],
                    },
                    Saturday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Saturday],
                    },
                    Sunday = new UIWeek
                    {
                        IsChecked = weekSelected[DayOfWeek.Sunday],
                    },
                    Period = dayPeriod
                };

                periods.Add(period);
            }
            this.Periods = periods;
        }
        private void Border_norml_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Border          border = sender as Border;
            UITwoStatusWeek week   = border.DataContext as UITwoStatusWeek;

            if (week.PositionType != XYKernel.OS.Common.Enums.Position.AB &&
                week.PositionType != XYKernel.OS.Common.Enums.Position.PB &&
                week.PositionType != XYKernel.OS.Common.Enums.Position.Noon)
            {
                var isChecked = week.Monday.IsChecked;

                week.Monday.IsChecked    = !isChecked;
                week.Tuesday.IsChecked   = !isChecked;
                week.Wednesday.IsChecked = !isChecked;
                week.Thursday.IsChecked  = !isChecked;
                week.Friday.IsChecked    = !isChecked;
                week.Saturday.IsChecked  = !isChecked;
                week.Sunday.IsChecked    = !isChecked;
            }
        }
Пример #6
0
        void RefreshPosition()
        {
            var cl = CommonDataManager.GetCLCase(base.LocalID);

            var results = new List <UITwoStatusWeek>();
            var groups  = cl.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position
                    };
                    results.Add(week);
                }
            }
            this.Periods = results;
        }
Пример #7
0
        void getBase(OperatorEnum opratorEnum, AdministrativeAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

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

            this.Teachers = cp.Teachers.Select(t =>
            {
                return(new UITeacher()
                {
                    ID = t.ID,
                    Name = t.Name
                });
            })?.ToList();

            this.SelectTeacher = this.Teachers.FirstOrDefault();

            var results = new List <UITwoStatusWeek>();
            var groups  = cp.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);
                    results.Add(week);
                }
            }
            this.Periods = results;
        }
        public void Initilize()
        {
            CLCase clModel = CommonDataManager.GetCLCase(base.LocalID);

            var results = new List <UITwoStatusWeek>();
            var groups  = clModel.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);

                    if (first.Position != XYKernel.OS.Common.Enums.Position.AB &&
                        first.Position != XYKernel.OS.Common.Enums.Position.PB &&
                        first.Position != XYKernel.OS.Common.Enums.Position.Noon)
                    {
                        g.ToList().ForEach(gg =>
                        {
                            if (gg.DayPeriod.Day == DayOfWeek.Monday)
                            {
                                week.Monday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Tuesday)
                            {
                                week.Tuesday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Wednesday)
                            {
                                week.Wednesday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Thursday)
                            {
                                week.Thursday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Friday)
                            {
                                week.Friday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Saturday)
                            {
                                week.Saturday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Sunday)
                            {
                                week.Sunday.IsChecked = gg.IsSelected;
                            }
                        });
                    }

                    results.Add(week);
                }
            }
            this.Periods = results;
        }
Пример #9
0
        void getBase(OperatorEnum opratorEnum, MixedAlgoRuleEnum timeRule)
        {
            base.OpratorEnum = opratorEnum;
            this.TitleString = $"{ opratorEnum.GetLocalDescription()}-{timeRule.GetLocalDescription()}";
            this.RaisePropertyChanged(() => ShowRead);
            this.RaisePropertyChanged(() => ShowEdit);

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

            this.Teachers = cl.Teachers.Select(t =>
            {
                return(new UITeacher()
                {
                    ID = t.ID,
                    Name = t.Name
                });
            })?.ToList();

            this.SelectTeacher = this.Teachers.FirstOrDefault();

            var results = new List <UITwoStatusWeek>();
            var groups  = cl.Positions.GroupBy(p => p.DayPeriod.Period);

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var             first = g.First();
                    UITwoStatusWeek week  = new UITwoStatusWeek()
                    {
                        Period       = first.DayPeriod,
                        PositionType = first.Position,
                    };
                    week.SetStatus(true);

                    if (first.Position != XYKernel.OS.Common.Enums.Position.AB &&
                        first.Position != XYKernel.OS.Common.Enums.Position.PB &&
                        first.Position != XYKernel.OS.Common.Enums.Position.Noon)
                    {
                        g.ToList().ForEach(gg =>
                        {
                            if (gg.DayPeriod.Day == DayOfWeek.Monday)
                            {
                                week.Monday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Tuesday)
                            {
                                week.Tuesday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Wednesday)
                            {
                                week.Wednesday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Thursday)
                            {
                                week.Thursday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Friday)
                            {
                                week.Friday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Saturday)
                            {
                                week.Saturday.IsChecked = gg.IsSelected;
                            }
                            else if (gg.DayPeriod.Day == DayOfWeek.Sunday)
                            {
                                week.Sunday.IsChecked = gg.IsSelected;
                            }
                        });
                    }

                    results.Add(week);
                }
            }
            this.Periods = results;
        }