Exemple #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.win = ((OSKernel.Presentation.Arranging.Mixed.Modify.Algo.ClassHour.Dialog.CreateMultipyClassHours)(target));
                return;

            case 2:
                this.cb_checked = ((System.Windows.Controls.CheckBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void cancel(object obj)
        {
            CreateMultipyClassHours window = obj as CreateMultipyClassHours;

            window.Close();
        }
        void save(object obj)
        {
            CreateMultipyClassHours window = obj as CreateMultipyClassHours;

            if (!this.Validate())
            {
                return;
            }

            if (this.OpratorEnum == OperatorEnum.Add)
            {
                window.Add = new UIClassHourRule
                {
                    UID      = Guid.NewGuid().ToString(),
                    IsActive = this.IsActive,
                    Weight   = this.Weight,
                    FirstID  = this.SelectFirstHour == null ? 0 : this.SelectFirstHour.ID,
                    SecondID = this.SelectSecondHour == null ? 0 : this.SelectSecondHour.ID,
                    ThirdID  = this.SelectThirdHour == null ? 0 : this.SelectThirdHour.ID,
                };

                List <UIClassHour> classhours = new List <UIClassHour>();
                if (this.SelectFirstHour != null)
                {
                    classhours.Add(this.SelectFirstHour);
                }

                if (this.SelectSecondHour != null)
                {
                    classhours.Add(this.SelectSecondHour);
                }

                if (this.SelectThirdHour != null)
                {
                    classhours.Add(this.SelectThirdHour);
                }

                window.Add.ClassHours = classhours;
            }
            else
            {
                window.Modify = new UIClassHourRule
                {
                    UID      = this.UID,
                    Weight   = this.Weight,
                    IsActive = this.IsActive,
                    FirstID  = this.SelectFirstHour == null ? 0 : this.SelectFirstHour.ID,
                    SecondID = this.SelectSecondHour == null ? 0 : this.SelectSecondHour.ID,
                    ThirdID  = this.SelectThirdHour == null ? 0 : this.SelectThirdHour.ID,
                };

                List <UIClassHour> classhours = new List <UIClassHour>();
                if (this.SelectFirstHour != null)
                {
                    classhours.Add(this.SelectFirstHour);
                }

                if (this.SelectSecondHour != null)
                {
                    classhours.Add(this.SelectSecondHour);
                }

                if (this.SelectThirdHour != null)
                {
                    classhours.Add(this.SelectThirdHour);
                }

                window.Modify.ClassHours = classhours;
            }

            window.DialogResult = true;
        }