Exemple #1
0
 private void SetEditableGroupControls(BaseLayoutItem Item, bool isEditable)
 {
     if (Item == null) return;
     var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
     List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
     ILayoutControl Layout = Item.Owner;
     if (Layout != null) {
         Layout.BeginUpdate();
         BaseLayoutItem li;
         for (int i = Items.Count - 1; i >= 0; --i) {
             li = Items[i];
             if (!li.Equals(Item) && li.Name != Item.Name) {
                 if (li is LayoutControlItem) {
                     Control TempControl = (li as LayoutControlItem).Control;
                     if (TempControl is BaseEdit) {
                         (TempControl as BaseEdit).Properties.ReadOnly = !isEditable;
                         (TempControl as BaseEdit).Properties.AllowFocused = isEditable;
                     }
                 }
             }
         }
         Layout.EndUpdate();
     }
 }
Exemple #2
0
        public bool Validate()
        {
            bool isValid = true;
            bool isRequiredAll = false;
            try {
                var Item = layoutControlGroupQuestion1;
                if (Item == null) return false;
                var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
                List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
                ILayoutControl Layout = Item.Owner;
                if (Layout != null) {
                    Layout.BeginUpdate();
                    BaseLayoutItem li;
                    DropboxData data;
                    for (int i = Items.Count - 1; i >= 0; --i) {
                        li = Items[i];
                        if (!li.Equals(Item) && li.Name != Item.Name) {
                            if (li is LayoutControlItem) {
                                Control TempControl = (li as LayoutControlItem).Control;
                                if (TempControl != null) {
                                    data = TempControl.Tag as DropboxData;
                                    if (data != null) {
                                        if (data.Required) { if (!isRequiredAll) isRequiredAll = true; }
                                        if (data.Required && !data.HasValue) {
                                            TempControl.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
                                            if (isValid) isValid = false;
                                        } else {
                                            TempControl.BackColor = this.BackColor;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    Layout.EndUpdate();
                }

            } catch {
            }

            if (ctlFooter != null) {
                if (!isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(false, true);
                } else if (isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, true);
                } else if (!isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, false);
                }
            }

            return isValid;
        }
Exemple #3
0
        public bool Validate()
        {
            bool isValid = true;
            bool isRequiredAll = false;
            try {
                var Item = layoutControlGroupQuestion1;
                if (Item == null) return false;
                var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
                List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
                ILayoutControl Layout = Item.Owner;
                if (Layout != null) {
                    Layout.BeginUpdate();
                    BaseLayoutItem li;
                    MultiplechoiceData data;
                    for (int i = Items.Count - 1; i >= 0; --i) {
                        li = Items[i];
                        if (!li.Equals(Item) && li.Name != Item.Name) {
                            if (li is LayoutControlItem) {
                                Control TempControl = (li as LayoutControlItem).Control;
                                if (TempControl != null) {
                                    data = TempControl.Tag as MultiplechoiceData;
                                    //special case for checkedit's because it is in group of selection
                                    if (TempControl is CheckEdit) {
                                        //do nothing. use below loop for validation of all checkedit
                                    } else {
                                        if (data != null) {
                                            if (data.Required) if (!isRequiredAll) isRequiredAll = true;
                                            if (data.Required && !data.HasValue) {
                                                TempControl.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
                                                if (isValid) isValid = false;
                                            } else {
                                                TempControl.BackColor = this.BackColor;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    var opt = Questionnaire.Form.Settings.AnswerOptions[0];
                    if (opt != null) {
                        if (opt.MultipleChoiceRequired) { if (!isRequiredAll) isRequiredAll = true; }
                        if (opt.MultipleChoiceRequired && opt.MultipleChoiceValues != null) {
                            var vals = opt.MultipleChoiceValues;
                            int count = 0;
                            foreach (MultipleChoiceValue val in vals) {
                                if (!val.Checked) { count++; }
                            }
                            if (vals.Count == count) {
                                isValid = false;
                                //prompt message to require selection of checkboxes.
                                if (simpleLabelItemValidation != null) {
                                    simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                                }
                            } else {
                                if (simpleLabelItemValidation != null) {
                                    simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                                }
                            }
                        }
                    }
                    Layout.EndUpdate();
                }

            } catch {
            }

            if (ctlFooter != null) {
                if (!isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(false, true);
                } else if (isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, true);
                } else if (!isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, false);
                }
            }

            return isValid;
        }
Exemple #4
0
        //Note: CloseDialogEditor is obsoleted. Use this method instead
        private void DisposeGroupControls(BaseLayoutItem Item)
        {
            if (Item == null) return;
            var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
            List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
            ILayoutControl Layout = Item.Owner;
            if (Layout != null)
            {
                Layout.BeginUpdate();
                BaseLayoutItem li;
                for (int i = Items.Count - 1; i >= 0; --i)
                {
                    li = Items[i];
                    if (!li.Equals(Item) && li.Name != Item.Name)
                    {
                        if (li is LayoutControlItem)
                        {
                            Control TempControl = (li as LayoutControlItem).Control;
                            if (TempControl != null)
                            {
                                TempControl.Dispose();
                            }

                            li.Dispose();
                            Items.RemoveAt(i);
                        }
                        else
                        {
                            li.Dispose();
                            Items.RemoveAt(i);
                        }
                    }
                }
                Layout.EndUpdate();
            }

            for (int cnt = 0; cnt < controlsInDialog.Count; cnt++) {
                controlsInDialog[0].Owner = null;
                controlsInDialog[cnt].Dispose();
            }
            controlsInDialog.Clear();
            var lcgItem = Item as LayoutControlGroup;
            lcgItem.Clear();
        }
Exemple #5
0
        private void SetEditableGroupControls(BaseLayoutItem Item, bool isEditable)
        {
            if (Item == null) return;
            var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
            List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
            ILayoutControl Layout = Item.Owner;
            if (Layout != null) {
                Layout.BeginUpdate();
                BaseLayoutItem li;
                for (int i = Items.Count - 1; i >= 0; --i) {
                    li = Items[i];
                    if (!li.Equals(Item) && li.Name != Item.Name) {
                        if (li is LayoutControlItem) {
                            Control TempControl = (li as LayoutControlItem).Control;
                            if (TempControl is SimpleButton) {
                                if (TempControl.Name.Equals("PreviewBooking") ||
                                    TempControl.Name.Equals("DeleteMeeting") ||
                                    TempControl.Text.Equals("Add Caller") ||
                                    TempControl.Text.Equals("Add Additional") ||
                                    TempControl.Text.Equals("Delete"))
                                {

                                    if (this.lblScheduleDetails != null && this.lblScheduleDetails.Text != "" && isEditable)
                                        TempControl.Enabled = true;
                                    else
                                        TempControl.Enabled = false;

                                    /*
                                     * https://brightvision.jira.com/browse/PLATFORM-3227
                                     * DAN: Force to enable PreviewBooking button even if isEditable is false.
                                    */
                                    if (this.lblScheduleDetails != null && this.lblScheduleDetails.Text != "" && TempControl.Name.Equals("PreviewBooking"))
                                        TempControl.Enabled = true;

                                    continue;
                                }

                                if (TempControl.Enabled != isEditable)
                                    TempControl.Enabled = isEditable;

                                //if (TempControl.Name.IndexOf("PreviewDetails_simpleButton") != -1 ||
                                //    TempControl.Name.IndexOf("CreateMeeting_simpleButton") != -1 ||
                                //    TempControl.Name.IndexOf("DeleteMeeting_simpleButton") != -1) {
                                //        if (TempControl.Tag != null && TempControl.Tag.ToString() == "HasMeeting")
                                //        {
                                //            if (TempControl.Name.IndexOf("DeleteMeeting_simpleButton") != -1)
                                //            {
                                //                if (lookUpEdit2.EditValue != null)
                                //                    TempControl.Enabled = isEditable;
                                //                else
                                //                    TempControl.Enabled = false;
                                //            }
                                //            else
                                //            {
                                //                TempControl.Enabled = isEditable;
                                //            }
                                //        }
                                //        else if(TempControl.Name.IndexOf("PreviewDetails_simpleButton") != -1) {
                                //            TempControl.Enabled = isEditable;
                                //        }
                                //    //Do Nothing
                                //} else {
                                //    TempControl.Enabled = isEditable;
                                //}
                            }
                            else if (TempControl is BaseEdit) {
                                //
                                var tagData = TempControl.Tag as ScheduleData;
                                if (TempControl.Name.IndexOf("SalesPerson_lookUpEdit") != -1 ||
                                    TempControl.Name.IndexOf("ScheduleType_comboBoxEdit") != -1 ||
                                    (tagData != null && tagData.IsMeeting)) {
                                        if (tagData.Name.Equals("ListOfBookingsAvailable"))
                                        {
                                            if (m_HasSchedules) {
                                                (TempControl as BaseEdit).Properties.ReadOnly = false;
                                                (TempControl as BaseEdit).Properties.AllowFocused = true;
                                            }
                                            else {
                                                (TempControl as BaseEdit).Properties.ReadOnly = true;
                                                (TempControl as BaseEdit).Properties.AllowFocused = false;
                                            }
                                        }
                                        else {
                                            (TempControl as BaseEdit).Properties.ReadOnly = true;
                                            (TempControl as BaseEdit).Properties.AllowFocused = false;
                                        }

                                    //(TempControl as BaseEdit).Properties.ReadOnly = true;
                                    //(TempControl as BaseEdit).Properties.AllowFocused = false;
                                }
                                else if (TempControl.Tag.Equals("ListOfBookingsAvailable")) {
                                    if (m_HasSchedules) {
                                        (TempControl as BaseEdit).Properties.ReadOnly = false;
                                        (TempControl as BaseEdit).Properties.AllowFocused = true;
                                    }
                                    else {
                                        (TempControl as BaseEdit).Properties.ReadOnly = true;
                                        (TempControl as BaseEdit).Properties.AllowFocused = false;
                                    }
                                }
                                else {
                                    (TempControl as BaseEdit).Properties.ReadOnly = !isEditable;
                                    (TempControl as BaseEdit).Properties.AllowFocused = isEditable;
                                }
                            }
                        }
                    }
                }
                Layout.EndUpdate();
            }

            //this.CreateMeeting.Enabled = isEditable;
            //this.DeleteMeeting.Enabled = isEditable;
            //this.simpleButton1.Enabled = isEditable;
        }
Exemple #6
0
        public bool Validate()
        {
            bool isValid = true;
            bool isRequiredAll = false;
            try {
                var Item = layoutControlGroupQuestion1;
                if (Item == null) return false;
                var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
                List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
                ILayoutControl Layout = Item.Owner;
                if (Layout != null) {
                    Layout.BeginUpdate();
                    BaseLayoutItem li;
                    ScheduleData data;
                    for (int i = Items.Count - 1; i >= 0; --i) {
                        li = Items[i];
                        if (!li.Equals(Item) && li.Name != Item.Name) {
                            if (li is LayoutControlItem) {
                                Control TempControl = (li as LayoutControlItem).Control;
                                if (TempControl != null) {
                                    data = TempControl.Tag as ScheduleData;
                                    if (data != null) {
                                        if (data.Required) { if (!isRequiredAll) isRequiredAll = true; }
                                        if (data.Required && !data.HasValue) {
                                            TempControl.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
                                            if (isValid) isValid = false;
                                        } else {
                                            TempControl.BackColor = this.BackColor;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    var opt = Questionnaire.Form.Settings.AnswerOptions[0];
                    if (opt != null) {
                        if (opt.AttendiesRequired)  {
                           if (!isRequiredAll) isRequiredAll = true;
                        }
                        if (opt.AttendiesRequired && opt.Attendies != null) {
                            var vals = opt.Attendies;
                            if(vals.Count <= 0) {
                                //prompt message to require to add at least one attendie
                                if (simpleLabelItemValidation != null) {
                                    simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                                    if(isValid) isValid = false;
                                }
                            } else {
                                if (simpleLabelItemValidation != null) {
                                    simpleLabelItemValidation.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                                }
                            }
                        }
                    }
                    Layout.EndUpdate();
                }

            } catch {
            }

            if (ctlFooter != null) {
                if (!isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(false, true);
                } else if (isValid && isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, true);
                } else if (!isRequiredAll) {
                    ctlFooter.SetQuestionRequired(true, false);
                }
            }

            return isValid;
        }
Exemple #7
0
        public bool Validate()
        {
            bool isValid = true;
            bool isRequired = Questionnaire.Form.Settings.AnswerOptions[0].Required;
            bool hasValue = gridValues.Count > 0 ? true : false;
            try
            {
                var Item = layoutControlGroupQuestion1;
                if (Item == null) return false;
                var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
                List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
                ILayoutControl Layout = Item.Owner;
                if (Layout != null)
                {
                    Layout.BeginUpdate();
                    BaseLayoutItem li;

                    if (isRequired && !hasValue)
                    {
                        gridViewHistory.Appearance.Empty.BackColor = Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
                        if (isValid) isValid = false;
                    }
                    else
                    {
                        gridViewHistory.Appearance.Empty.BackColor = this.BackColor;
                    }
                    Layout.EndUpdate();
                }

            }
            catch
            {
            }

            if (ctlFooter != null)
            {
                if (!isValid && isRequired)
                {
                    ctlFooter.SetQuestionRequired(false, true);
                }
                else if (isValid && isRequired)
                {
                    ctlFooter.SetQuestionRequired(true, true);
                }
                else if (!isRequired)
                {
                    ctlFooter.SetQuestionRequired(true, false);
                }
            }

            return isValid;
        }
Exemple #8
0
        private void SetEditableGroupControls(BaseLayoutItem Item, bool isEditable)
        {
            if (Item == null) return;
            var FlatList = new DevExpress.XtraLayout.Helpers.FlatItemsList();
            List<BaseLayoutItem> Items = FlatList.GetItemsList(Item);
            ILayoutControl Layout = Item.Owner;
            if (Layout != null)
            {
                Layout.BeginUpdate();
                BaseLayoutItem li;
                for (int i = Items.Count - 1; i >= 0; --i)
                {
                    li = Items[i];
                    if (!li.Equals(Item) && li.Name != Item.Name)
                    {
                        if (li is LayoutControlItem)
                        {
                            Control TempControl = (li as LayoutControlItem).Control;
                            if (TempControl is BaseEdit)
                            {
                                (TempControl as BaseEdit).Properties.ReadOnly = !isEditable;
                                (TempControl as BaseEdit).Properties.AllowFocused = isEditable;
                            }

                        }
                    }
                }
                simpleButtonCancel.Enabled = isEditable;
                simpleButtonSave.Enabled = isEditable;
                this.isEditable = isEditable;
                /**
                 * [@jeff 05.17.2012]: https://brightvision.jira.com/browse/PLATFORM-1415
                 * added read-only setting for the grid view.
                 */
                gridViewHistory.OptionsBehavior.ReadOnly = !isEditable;
                gridControlHistory.RefreshDataSource();
                Layout.EndUpdate();

                if (isEditable) {
                    HasChanged = false;
                }
            }
        }