public static void SetConditionalTrigger(this FormProperty formProperty, string triggerKey)
 {
     if (!string.IsNullOrWhiteSpace(triggerKey))
     {
         formProperty.Metadata.Add("_trigger", triggerKey);
     }
 }
Beispiel #2
0
 public JsonResult DeleteProperty_POST(FormProperty property)
 {
     _formAdminService.DeleteFormProperty(property);
     return(Json(new FormActionResult {
         success = true
     }));
 }
Beispiel #3
0
        public FormProperty GetCurrentProperties(bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name          = this.Name,
                BackColor     = treeDataGridView.DefaultCellStyle.BackColor,
                ForeColor     = treeDataGridView.DefaultCellStyle.ForeColor,
                GroupingModes = groupingSetupControl.Groupings.Select(o => new DataModel.Grouping()
                {
                    Enabled = o.Checked, Mode = o.Mode, Name = o.Text
                }).ToList(),
                PivotModes = checkedPivots.Select(o => new DataModel.Pivot()
                {
                    Mode = o.Mode, Name = o.Text
                }).ToList(),
                SortColumns = sortColumns.Select(o => new DataModel.SortColumn()
                {
                    Index = o.Index, Order = o.Order
                }).ToList(),
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index        = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            if (!pivotToo)
            {
                result.ColumnProperties.RemoveAll(o => !initialColumnSortOrders.Contains(o.Index));
            }

            return(result);
        }
Beispiel #4
0
 public JsonResult AddProperty([IoCModelBinder(typeof(AddFormPropertyModelBinder))] FormProperty formProperty)
 {
     _formAdminService.AddFormProperty(formProperty);
     return(Json(new FormActionResult {
         success = true
     }));
 }
Beispiel #5
0
 public void SetOrders(List <SortItem> items)
 {
     _session.Transact(session => items.ForEach(item =>
     {
         FormProperty formItem = session.Get <FormProperty>(item.Id);
         formItem.DisplayOrder = item.Order;
         session.Update(formItem);
     }));
 }
        public static string?GetConditionalTriggerTarget(this FormProperty formProperty)
        {
            if (formProperty.Metadata.TryGetValue("_trigger-target", out var triggerTargetValue) && triggerTargetValue is string triggerTarget)
            {
                return(triggerTarget);
            }

            return(null);
        }
        public TagBuilder AppendRequiredMessage(FormProperty formProperty)
        {
            var tagBuilder = new TagBuilder("span");

            tagBuilder.AddCssClass("field-validation-valid");
            tagBuilder.Attributes["data-valmsg-for"]     = formProperty.Name;//.GetHtmlId();
            tagBuilder.Attributes["data-valmsg-replace"] = "true";
            //data-valmsg-for="LastName" data-valmsg-replace="true"
            return(tagBuilder);
        }
Beispiel #8
0
        public TagBuilder AppendLabel(FormProperty formProperty)
        {
            var tagBuilder = new TagBuilder("label");

            tagBuilder.Attributes["for"] = formProperty.GetHtmlId();

            tagBuilder.InnerHtml = string.IsNullOrWhiteSpace(formProperty.LabelText)
                                       ? formProperty.Name
                                       : formProperty.LabelText;

            return(tagBuilder);
        }
Beispiel #9
0
        public void AddFormProperty(FormProperty property)
        {
            _session.Transact(session =>
            {
                if (property.Webpage.FormProperties != null)
                {
                    property.DisplayOrder = property.Webpage.FormProperties.Count;
                }

                session.Save(property);
            });
        }
Beispiel #10
0
 private MatchEvaluator AddLabel(IList <FormProperty> formProperties)
 {
     return(match =>
     {
         FormProperty formProperty =
             formProperties.FirstOrDefault(
                 property => property.Name.Equals(match.Groups[1].Value, StringComparison.OrdinalIgnoreCase));
         return formProperty == null
                               ? string.Empty
                               : _labelRenderer.AppendLabel(formProperty).ToString();
     });
 }
Beispiel #11
0
        protected virtual bool updatePivots(FormProperty formProperty)
        {
            var oldCheckedPivots = new List <PivotBy>(checkedPivots.Select(o => o.Mode));

            pivotSetupControl.Pivots.ForEach(o => pivotSetupControl.SetPivot(o.Mode, false));
            foreach (var pivot in formProperty.PivotModes)
            {
                pivotSetupControl.SetPivot(pivot.Mode, true);
            }

            // determine if checked pivots changed
            return(!oldCheckedPivots.SequenceEqual(checkedPivots.Select(o => o.Mode)));
        }
 public TagBuilder GetElementContainer(FormRenderingType formRendererType, FormProperty property)
 {
     if (formRendererType == FormRenderingType.Bootstrap3)
     {
         if (property is TextBox || property is TextArea || property is DropDownList || property is FileUpload)
         {
             TagBuilder elementContainer = new TagBuilder("div");
             elementContainer.AddCssClass("form-group");
             return(elementContainer);
         }
     }
     return(null);
 }
Beispiel #13
0
        protected internal virtual void initializeFormProperties(FormDataImpl formData, ExecutionEntity execution)
        {
            IList <FormProperty> formProperties = new List <FormProperty>();

            foreach (FormPropertyHandler formPropertyHandler in formPropertyHandlers)
            {
                if (formPropertyHandler.Readable)
                {
                    FormProperty formProperty = formPropertyHandler.createFormProperty(execution);
                    formProperties.Add(formProperty);
                }
            }
            formData.FormProperties = formProperties;
        }
Beispiel #14
0
        private void PropertyCollection_Inserted(int index, object value)
        {
            XElement formProp = Node.Element(Ns.Form + "properties");

            if (formProp == null)
            {
                formProp = new XElement(Ns.Form + "properties");
                Node.Add(formProp);
            }

            FormProperty prop = (FormProperty)value;

            formProp.Add(prop.Node);
        }
Beispiel #15
0
 private string SanitizeValue(FormProperty formProperty, string value)
 {
     if (formProperty is CheckboxList)
     {
         if (value != null)
         {
             var list = value.Split(',').ToList();
             list.Remove(CheckBoxListRenderer.CbHiddenValue);
             return(!list.Any() ? null : string.Join(",", list));
         }
         return(value);
     }
     return(value);
 }
Beispiel #16
0
        public FormPropertyAdapter(FormProperty formProperty) : base()
        {
            this.formProperty = formProperty;

            validationConstraints = new List <FormFieldValidationConstraint>();
            if (formProperty.Required)
            {
                validationConstraints.Add(new FormFieldValidationConstraintImpl("required", null));
            }
            if (!formProperty.Writable)
            {
                validationConstraints.Add(new FormFieldValidationConstraintImpl("readonly", null));
            }
        }
Beispiel #17
0
 public static void MemoryState(Form form, string section, string entry)
 {
     form.Load += (s1, e1) =>
     {
         var state = ClientInfo.Config.Get(section, entry, "");
         if (string.IsNullOrEmpty(state) == false)
         {
             FormProperty.SetProperty(state, form, ClientInfo.IsMinimizeMode());
         }
     };
     form.FormClosed += (s1, e1) =>
     {
         var state = FormProperty.GetProperty(form);
         ClientInfo.Config.Set(section, entry, state);
     };
 }
Beispiel #18
0
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            Type type = GetTypeByName(controllerContext);

            bindingContext.ModelMetadata =
                ModelMetadataProviders.Current.GetMetadataForType(
                    () => CreateModel(controllerContext, bindingContext, type), type);

            FormProperty formProperty = base.BindModel(controllerContext, bindingContext) as FormProperty;

            if (formProperty != null && formProperty.Webpage != null)
            {
                formProperty.Webpage.FormProperties.Add(formProperty);
            }
            return(formProperty);
        }
        private void PropertyCollection_Inserted(int index, object value)
        {
            XmlNode form_prop;

            form_prop = this.Node.SelectSingleNode("form:properties", this._document.NamespaceManager);

            if (form_prop == null)
            {
                form_prop = _document.CreateNode("properties", "form");
            }

            FormProperty prop = value as FormProperty;

            form_prop.AppendChild(prop.Node);
            this.Node.AppendChild(form_prop);
        }
        private void PropertyCollection_Removed(int index, object value)
        {
            XmlNode form_prop;

            form_prop = this.Node.SelectSingleNode("form:properties", this._document.NamespaceManager);

            if (form_prop != null)
            {
                FormProperty prop = value as FormProperty;
                form_prop.RemoveChild(prop.Node);
                if (index == 0)
                {
                    Node.RemoveChild(form_prop);
                }
            }
        }
Beispiel #21
0
        private void PropertyCollection_Removed(int index, object value)
        {
            XElement formProp = Node.Element(Ns.Form + "properties");

            if (formProp == null)
            {
                return;
            }
            FormProperty prop = (FormProperty)value;

            prop.Node.Remove();
            if (index == 0)
            {
                formProp.Remove();
            }
        }
Beispiel #22
0
        public void LoadLayout(FormProperty formProperty)
        {
            if (formProperty == null)
            {
                return;
            }

            var columnlist = _columnSettings.Keys.ToList();

            foreach (var column in columnlist)
            {
                var columnProperty = formProperty.ColumnProperties.SingleOrDefault(x => x.Name == column.Name);

                //if rowSettings is null it is likely an unsaved pivotColumn, keep defualt
                if (columnProperty == null)
                {
                    continue;
                }

                _columnSettings[column] = columnProperty;
            }

            treeDataGridView.ForeColor       = treeDataGridView.DefaultCellStyle.ForeColor = formProperty.ForeColor ?? SystemColors.WindowText;
            treeDataGridView.BackgroundColor = treeDataGridView.GridColor = treeDataGridView.DefaultCellStyle.BackColor = formProperty.BackColor ?? SystemColors.Window;

            var sortColumnSettings = formProperty.SortColumns;

            if (formProperty.SortColumns != null && formProperty.SortColumns.Count > 0)
            {
                var newSortColumns = new List <SortColumn>();
                foreach (var sortColumn in formProperty.SortColumns)
                {
                    newSortColumns.Add(new SortColumn()
                    {
                        Index = sortColumn.Index,
                        Order = sortColumn.Order
                    });
                }
                Sort(newSortColumns.First().Index);
                sortColumns = newSortColumns;
            }

            setColumnVisibility();
            applySort();

            treeDataGridView.Refresh();
        }
Beispiel #23
0
        public FormProperty GetCurrentProperties(bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name             = this.Name,
                BackColor        = dataGridView.DefaultCellStyle.BackColor,
                ForeColor        = dataGridView.DefaultCellStyle.ForeColor,
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index        = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            return(result);
        }
Beispiel #24
0
        protected virtual bool updateGroupings(FormProperty formProperty)
        {
            var oldCheckedGroupings = new List <GroupBy>(checkedGroupings.Select(o => o.Mode));

            var groupings = new List <Grouping <GroupBy> >();

            foreach (var grouping in formProperty.GroupingModes)
            {
                groupings.Add(new Grouping <GroupBy>(grouping.Enabled)
                {
                    Mode = grouping.Mode,
                    Text = grouping.Name
                });
            }
            setGroupings(groupings.ToArray());

            // determine if checked groupings changed
            return(!oldCheckedGroupings.SequenceEqual(checkedGroupings.Select(o => o.Mode)));
        }
Beispiel #25
0
        public JsonResult SaveForm()
        {
            List <string> RequestKeys = Request.Form.AllKeys.ToList();

            RejectDbEntities DatabaseConnection = new RejectDbEntities();
            tbRejectRecord   Rejectrecord;
            PropertyInfo     FormProperty;
            int RejectNo = -1;

            for (int i = 0; i < RequestKeys.Count; i++)
            {
                if (RequestKeys.ElementAt(i).ToString() == "RejectNo")
                {
                    RejectNo = Int32.Parse(Request.Form.Get(i));
                }
            }

            //try
            //{
            if (RejectNo != -1)
            {
                Rejectrecord = DatabaseConnection.tbRejectRecords.Find(RejectNo);

                for (int i = 0; i < RequestKeys.Count; i++)
                {
                    FormProperty = Rejectrecord.GetType().GetProperty(RequestKeys.ElementAt(i));
                    FormProperty.SetValue(Rejectrecord, Convert.ChangeType(Request.Form.Get(i).Replace("'", "''"), FormProperty.PropertyType));
                }

                DatabaseConnection.SaveChanges();
            }
            //}
            //catch
            //{
            //    return Json("Error Caught", JsonRequestBehavior.AllowGet);
            //}

            //return RedirectToAction("Tickets", "TicketGrid");
            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
Beispiel #26
0
        public FormProperty GetCurrentProperties(bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name        = this.Name,
                BackColor   = treeDataGridView.DefaultCellStyle.BackColor,
                ForeColor   = treeDataGridView.DefaultCellStyle.ForeColor,
                SortColumns = sortColumns.Select(o => new DataModel.SortColumn()
                {
                    Index = o.Index, Order = o.Order
                }).ToList(),
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index        = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            return(result);
        }
Beispiel #27
0
        private MatchEvaluator AddElement(IList <FormProperty> formProperties, FormSubmittedStatus submittedStatus)
        {
            return(match =>
            {
                FormProperty formProperty =
                    formProperties.FirstOrDefault(
                        property => property.Name.Equals(match.Groups[1].Value, StringComparison.OrdinalIgnoreCase));
                if (formProperty == null)
                {
                    return string.Empty;
                }
                string existingValue = submittedStatus.Data[formProperty.Name];

                IFormElementRenderer renderer = _elementRendererManager.GetElementRenderer(formProperty);

                return
                renderer.AppendElement(formProperty, existingValue, _siteSettings.FormRendererType)
                .ToString(renderer.IsSelfClosing
                                                     ? TagRenderMode.SelfClosing
                                                     : TagRenderMode.Normal);
            });
        }
Beispiel #28
0
        public void LoadLayout(FormProperty formProperty)
        {
            if (formProperty == null)
            {
                return;
            }

            var columnlist       = _columnSettings.Keys.ToList();
            var untouchedColumns = _columnSettings.Keys.ToList();

            foreach (var column in columnlist)
            {
                var columnProperty = formProperty.ColumnProperties.SingleOrDefault(x => x.Name == column.Name);

                if (columnProperty == null)
                {
                    continue;
                }

                _columnSettings[column] = columnProperty;

                untouchedColumns.Remove(column);
            }

            //Set unspecified columns to blend in better
            foreach (var column in untouchedColumns)
            {
                _columnSettings[column].Visible   = null;
                _columnSettings[column].BackColor = formProperty.BackColor;
                _columnSettings[column].ForeColor = formProperty.ForeColor;
            }

            dataGridView.ForeColor       = dataGridView.DefaultCellStyle.ForeColor = formProperty.ForeColor ?? SystemColors.WindowText;
            dataGridView.BackgroundColor = dataGridView.GridColor = dataGridView.DefaultCellStyle.BackColor = formProperty.BackColor ?? SystemColors.Window;

            setColumnVisibility();

            dataGridView.Refresh();
        }
Beispiel #29
0
 public override void ClonePart(Webpage @from, Webpage to, SiteCloneContext siteCloneContext)
 {
     if ([email protected]())
     {
         return;
     }
     _session.Transact(session =>
     {
         foreach (FormProperty property in @from.FormProperties)
         {
             FormProperty copy = property.GetCopyForSite(to.Site);
             copy.Webpage      = to;
             if (to.FormProperties == null)
             {
                 to.FormProperties = new List <FormProperty>();
             }
             to.FormProperties.Add(copy);
             siteCloneContext.AddEntry(property, copy);
             session.Save(copy);
             session.Update(to);
         }
     });
 }
Beispiel #30
0
 set => SetValue(FormProperty, value);
        public void LoadLayout(FormProperty formProperty)
        {
            if (formProperty == null)
                return;

            var columnlist = _columnSettings.Keys.ToList();
            var untouchedColumns = _columnSettings.Keys.ToList();

            foreach (var column in columnlist)
            {
                var columnProperty = formProperty.ColumnProperties.SingleOrDefault(x => x.Name == column.Name);

                if (columnProperty == null)
                    continue;

                _columnSettings[column] = columnProperty;

                untouchedColumns.Remove(column);
            }

            //Set unspecified columns to blend in better
            foreach (var column in untouchedColumns)
            {
                _columnSettings[column].Visible = null;
                _columnSettings[column].BackColor = formProperty.BackColor;
                _columnSettings[column].ForeColor = formProperty.ForeColor;
            }

            dataGridView.ForeColor = dataGridView.DefaultCellStyle.ForeColor = formProperty.ForeColor ?? SystemColors.WindowText;
            dataGridView.BackgroundColor = dataGridView.GridColor = dataGridView.DefaultCellStyle.BackColor = formProperty.BackColor ?? SystemColors.Window;

            setColumnVisibility();

            dataGridView.Refresh();
        }
Beispiel #32
0
        public void LoadLayout (FormProperty formProperty)
        {
            if (formProperty == null)
                return;

            //_unusedPivotSettings = listOfSettings.Where(x => x.Type == "PivotColumn").ToList();

            var columnlist = _columnSettings.Keys.ToList();
            var untouchedColumns = _columnSettings.Keys.ToList();

            foreach (var column in columnlist)
            {
                var columnProperty = formProperty.ColumnProperties.SingleOrDefault(x => x.Name == column.Name);

                //if rowSettings is null it is likely an unsaved pivotColumn, keep defualt
                if (columnProperty == null)
                    continue;

                //if (_unusedPivotSettings.Contains(rowSettings))
                //    _unusedPivotSettings.Remove(rowSettings);

                _columnSettings[column] = columnProperty;

                untouchedColumns.Remove(column);
            }

            //Set unspecified columns (most likely pivotColumns) to blend in better
            foreach (var column in untouchedColumns)
            {
                _columnSettings[column].Visible = null;
                _columnSettings[column].BackColor = formProperty.BackColor;
                _columnSettings[column].ForeColor = formProperty.ForeColor;
            }

            treeDataGridView.ForeColor = treeDataGridView.DefaultCellStyle.ForeColor = formProperty.ForeColor ?? SystemColors.WindowText;
            treeDataGridView.BackgroundColor = treeDataGridView.GridColor = treeDataGridView.DefaultCellStyle.BackColor = formProperty.BackColor ?? SystemColors.Window;

            var sortColumnSettings = formProperty.SortColumns;
            if (formProperty.SortColumns != null && formProperty.SortColumns.Count > 0)
            {
                var newSortColumns = new List<SortColumn>();
                foreach (var sortColumn in formProperty.SortColumns)
                    newSortColumns.Add(new SortColumn()
                    {
                        Index = sortColumn.Index,
                        Order = sortColumn.Order
                    });
                Sort(newSortColumns.First().Index);
                sortColumns = newSortColumns;
            }

            bool pivotsChanged = updatePivots(formProperty);
            bool groupingChanged = updateGroupings(formProperty);

            setColumnVisibility();

            if (pivotsChanged || groupingChanged)
                resetData();
            else
                applySort();

            treeDataGridView.Refresh();
        }
Beispiel #33
0
        protected virtual bool updateGroupings (FormProperty formProperty)
        {
            var oldCheckedGroupings = new List<GroupBy>(checkedGroupings.Select(o => o.Mode));

            var groupings = new List<Grouping<GroupBy>>();
            foreach (var grouping in formProperty.GroupingModes)
                groupings.Add(new Grouping<GroupBy>(grouping.Enabled)
                {
                    Mode = grouping.Mode,
                    Text = grouping.Name
                });
            setGroupings(groupings.ToArray());

            // determine if checked groupings changed
            return !oldCheckedGroupings.SequenceEqual(checkedGroupings.Select(o => o.Mode));
        }
 protected override bool updatePivots (FormProperty formProperty)
 {
     checkedPivots = new List<Pivot<PivotBy>>();
     return false;
 }
Beispiel #35
0
        public FormProperty GetCurrentProperties (bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name = this.Name,
                BackColor = treeDataGridView.DefaultCellStyle.BackColor,
                ForeColor = treeDataGridView.DefaultCellStyle.ForeColor,
                GroupingModes = groupingSetupControl.Groupings.Select(o => new DataModel.Grouping() { Enabled = o.Checked, Mode = o.Mode, Name = o.Text }).ToList(),
                PivotModes = checkedPivots.Select(o => new DataModel.Pivot() { Mode = o.Mode, Name = o.Text }).ToList(),
                SortColumns = sortColumns.Select(o => new DataModel.SortColumn() { Index = o.Index, Order = o.Order }).ToList(),
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            if (!pivotToo)
                result.ColumnProperties.RemoveAll(o => !initialColumnSortOrders.Contains(o.Index));

            return result;
        }
        protected override bool updateGroupings (FormProperty formProperty)
        {
            bool groupingChanged = false;
            if (groupingSetupControl != null && formProperty.GroupingModes != null)
                groupingChanged = base.updateGroupings(formProperty);
            else
                setGroupings(new Grouping<GroupBy>(true) { Mode = GroupBy.Source, Text = "Group/Source" },
                             new Grouping<GroupBy>() { Mode = GroupBy.Spectrum, Text = "Spectrum" },
                             new Grouping<GroupBy>() { Mode = GroupBy.Analysis, Text = "Analysis" },
                             new Grouping<GroupBy>() { Mode = GroupBy.Charge, Text = "Charge" },
                             new Grouping<GroupBy>() { Mode = GroupBy.Peptide, Text = "Peptide" });

            groupingSetupControl.GroupingChanging += groupingSetupControl_GroupingChanging;

            if (groupingChanged)
                setColumnVisibility();

            return groupingChanged;
        }
Beispiel #37
0
        protected virtual bool updatePivots (FormProperty formProperty)
        {
            var oldCheckedPivots = new List<PivotBy>(checkedPivots.Select(o => o.Mode));

            pivotSetupControl.Pivots.ForEach(o => pivotSetupControl.SetPivot(o.Mode, false));
            foreach (var pivot in formProperty.PivotModes)
                pivotSetupControl.SetPivot(pivot.Mode, true);

            // determine if checked pivots changed
            return !oldCheckedPivots.SequenceEqual(checkedPivots.Select(o => o.Mode));
        }
        public FormProperty GetCurrentProperties(bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name = this.Name,
                BackColor = dataGridView.DefaultCellStyle.BackColor,
                ForeColor = dataGridView.DefaultCellStyle.ForeColor,
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            return result;
        }
        public void LoadLayout (FormProperty formProperty)
        {
            if (formProperty == null)
                return;

            var columnlist = _columnSettings.Keys.ToList();

            foreach (var column in columnlist)
            {
                var columnProperty = formProperty.ColumnProperties.SingleOrDefault(x => x.Name == column.Name);

                //if rowSettings is null it is likely an unsaved pivotColumn, keep defualt
                if (columnProperty == null)
                    continue;

                _columnSettings[column] = columnProperty;
            }

            treeDataGridView.ForeColor = treeDataGridView.DefaultCellStyle.ForeColor = formProperty.ForeColor ?? SystemColors.WindowText;
            treeDataGridView.BackgroundColor = treeDataGridView.GridColor = treeDataGridView.DefaultCellStyle.BackColor = formProperty.BackColor ?? SystemColors.Window;

            var sortColumnSettings = formProperty.SortColumns;
            if (formProperty.SortColumns != null && formProperty.SortColumns.Count > 0)
            {
                var newSortColumns = new List<SortColumn>();
                foreach (var sortColumn in formProperty.SortColumns)
                    newSortColumns.Add(new SortColumn()
                    {
                        Index = sortColumn.Index,
                        Order = sortColumn.Order
                    });
                Sort(newSortColumns.First().Index);
                sortColumns = newSortColumns;
            }

            setColumnVisibility();
            applySort();

            treeDataGridView.Refresh();
        }
        public FormProperty GetCurrentProperties (bool pivotToo)
        {
            var result = new FormProperty()
            {
                Name = this.Name,
                BackColor = treeDataGridView.DefaultCellStyle.BackColor,
                ForeColor = treeDataGridView.DefaultCellStyle.ForeColor,
                SortColumns = sortColumns.Select(o => new DataModel.SortColumn() { Index = o.Index, Order = o.Order }).ToList(),
                ColumnProperties = _columnSettings.Values.ToList()
            };

            foreach (var kvp in _columnSettings)
            {
                kvp.Value.Index = kvp.Key.Index;
                kvp.Value.DisplayIndex = kvp.Key.Index;
            }

            return result;
        }