void setCourseCommand(object obj)
        {
            UICourseLimit model = obj as UICourseLimit;

            CourseLimitPosition window = new CourseLimitPosition(model);

            window.Closed += (s, arg) =>
            {
                if (window.DialogResult.Value)
                {
                    model.PeriodLimits = window.PeriodLimits;
                    model.Weight       = window.WeightType;
                }
            };
            window.ShowDialog();
        }
        public void Bind(UICourseLimit bind)
        {
            bind.PeriodLimits.ForEach(pl =>
            {
                var period = this.Periods.FirstOrDefault(p => p.Period.Period == pl.DayPeriod.Period);
                if (period != null)
                {
                    if (pl.DayPeriod.Day == DayOfWeek.Monday)
                    {
                        period.Monday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Tuesday)
                    {
                        period.Tuesday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Wednesday)
                    {
                        period.Wednesday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Thursday)
                    {
                        period.Thursday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Friday)
                    {
                        period.Friday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Saturday)
                    {
                        period.Saturday.Value = pl.Limit.ToString();
                    }
                    else if (pl.DayPeriod.Day == DayOfWeek.Sunday)
                    {
                        period.Sunday.Value = pl.Limit.ToString();
                    }
                }
            });

            base.SelectWeight = bind.Weight;
        }
 public CourseLimitPosition(UICourseLimit model) : this()
 {
     (this.DataContext as CourseLimitPositionModel).Bind(model);
 }