Пример #1
0
 public static void ClearMissedValues(WebPivotGridField webField)
 {
     webField.AddMissedValues   = false;
     webField.DiapasonStartDate = null;
     webField.DiapasonEndDate   = null;
     webField.UpdateImageIndex();
 }
Пример #2
0
 private void Init(WebPivotGridField webField, LayoutDetailDataSet ds)
 {
     if (webField == null || ds == null)
     {
         IsEmpty = true;
         return;
     }
     BasicCountFunctionId    = webField.BasicCountFunctionId;
     AggregateFunctionId     = webField.AggregateFunctionId;
     Precision               = webField.Precision;
     UnitLayoutSearchFieldId = webField.UnitLayoutSearchFieldId;
     DateLayoutSearchFieldId = webField.DateLayoutSearchFieldId;
     if (webField.PrivateGroupInterval.HasValue)
     {
         PrivateGroupInterval = (long)GroupIntervalHelper.GetDBGroupInterval(webField.PrivateGroupInterval.Value);
     }
     else
     {
         PrivateGroupInterval = null;
     }
     DiapasonStartDate = webField.DiapasonStartDate;
     DiapasonEndDate   = webField.DiapasonEndDate;
     AddMissedValues   = webField.AddMissedValues;
     LayoutDetailDataSet.LayoutSearchFieldRow row = GetLayoutSearchFieldRowByField(ds, webField);
     CaptionEn         = string.IsNullOrEmpty(row.strNewFieldENCaption) ? row.strOriginalFieldENCaption : row.strNewFieldENCaption;
     OriginalCaptionEn = row.strOriginalFieldENCaption;
     Caption           = string.IsNullOrEmpty(row.strNewFieldCaption) ? row.strOriginalFieldCaption : row.strNewFieldCaption;
     OriginalCaption   = row.strOriginalFieldCaption;
     IsEmpty           = false;
     IsDataArea        = webField.Area == PivotArea.DataArea;
 }
Пример #3
0
 public static void CopyMissedValues(WebPivotGridField source, WebPivotGridField dest)
 {
     dest.AddMissedValues   = source.AddMissedValues;
     dest.DiapasonStartDate = source.DiapasonStartDate;
     dest.DiapasonEndDate   = source.DiapasonEndDate;
     dest.UpdateImageIndex();
 }
Пример #4
0
//        public static void UpdateSummaryType
//            (Dictionary<string, CustomSummaryType> summaryTypes, IAvrPivotGridField field)
//        {
//            CustomSummaryType summaryTypeType =
//                summaryTypes.ContainsKey(
//                    field.FieldName)
//                    ? summaryTypes[field.FieldName]
//                    : field.GetDefaultSummaryType();
//            if (!summaryTypes.ContainsKey(field.FieldName))
//            {
//                summaryTypes.Add(
//                    field.FieldName, summaryTypeType);
//            }
//            else
//                summaryTypes[field.FieldName] = summaryTypeType;
//            PivotSummaryType summaryType = summaryTypeType == CustomSummaryType.Count
//                                               ? PivotSummaryType.Count
//                                               : PivotSummaryType.Custom;
//            field.CustomSummaryType = summaryTypeType;
//            field.SummaryType = summaryType;
//
//
//        }

        private static SearchFieldType GetSearchFieldType(WebPivotGridField webField)
        {
            string fieldName = webField.Name;
            //DataView view = null;
            DataRow fieldRow;
            bool    isLookup;
            int     pos = fieldName.IndexOf("__", StringComparison.Ordinal);

            if (pos > 0)
            {
                string[] fieldParts    = webField.OriginalFieldName.Split(new[] { "__" }, StringSplitOptions.RemoveEmptyEntries);
                int      i             = SearchFieldLookup.Find(fieldParts[0]);
                DataRow  paramRow      = LookupCache.GetLookupRow(webField.OriginalFieldName, LookupTables.ParameterForFFType.ToString());
                object   referenceType = paramRow["idfsReferenceType"];
                isLookup = !bv.common.Core.Utils.IsEmpty(referenceType);
                fieldRow = SearchFieldLookup[i].Row;
            }
            else
            {
                int i = SearchFieldLookup.Find(webField.OriginalFieldName);
                fieldRow = SearchFieldLookup[i].Row;
                isLookup = IsLookupField(fieldRow);
            }
            if (isLookup)
            {
                return(SearchFieldType.ID);
            }
            return((SearchFieldType)fieldRow["idfsSearchFieldType"]);
        }
Пример #5
0
        public static void CopyMissedValuesToField(WebPivotGridField webField, List <WebPivotGridField> fields)
        {
            WebPivotGridField copy =
                fields.Find(
                    f =>
                    !f.IsHiddenFilterField && f.OriginalFieldName == webField.OriginalFieldName && f.ID != webField.ID &&
                    ((f.Area == PivotArea.ColumnArea || f.Area == PivotArea.RowArea) && f.AreaIndex >= 0));

            if (copy != null)
            {
                CopyMissedValues(copy, webField);
            }
        }
Пример #6
0
        public static void CopyMissedValuesFromField(WebPivotGridField webField, List <WebPivotGridField> fields)
        {
            IEnumerable <WebPivotGridField> copies =
                fields.Where(
                    f =>
                    !f.IsHiddenFilterField && f.OriginalFieldName == webField.OriginalFieldName && f.ID != webField.ID &&
                    ((f.Area == PivotArea.ColumnArea || f.Area == PivotArea.RowArea) && f.AreaIndex >= 0));

            foreach (WebPivotGridField copy in copies)
            {
                CopyMissedValues(webField, copy);
            }
        }
Пример #7
0
            public void InstantiateIn(Control container)
            {
                var c = (PivotGridHeaderTemplateContainer)container;
                PivotGridHeaderHtmlTable table = c.CreateHeader();

                var cell = new TableCell {
                    CssClass = "imagecell"
                };
                WebPivotGridField field = GetWebPivotGridFieldByName(m_Model.PivotSettings.Fields, c.Field.ID);

                cell.Controls.Add(new Image
                {
                    ImageUrl = string.Format("/Content/images/{0}", field == null ? "string.png" : field.FieldImage)
                });
                table.Rows[0].Cells.AddAt(0, cell);
                c.Controls.Add(table);
            }
Пример #8
0
        private static void SetInterval(MVCxPivotGrid pivotGrid, PivotGroupInterval interval)
        {
            AvrPivotGridModel model = GetModelFromSession(pivotGrid.Request);

            foreach (PivotGridField field in pivotGrid.Fields)
            {
                WebPivotGridField webField = GetWebPivotGridFieldByFieldName(model.PivotSettings.Fields, field.FieldName);
                if (webField != null)
                {
                    webField.DefaultGroupInterval            = interval;
                    field.GroupInterval                      = webField.GroupInterval;
                    model.PivotSettings.DefaultGroupInterval = (long)GroupIntervalHelper.GetDBGroupInterval(interval);
                }
                else
                {
                    field.GroupInterval = interval;
                }
            }
        }
Пример #9
0
        private static void PivotGridOnFieldAreaChanged(object sender, PivotFieldEventArgs pivotFieldEventArgs)
        {
            var pivotGrid              = (MVCxPivotGrid)sender;
            AvrPivotGridModel model    = GetModelFromSession(pivotGrid.Request);
            PivotGridField    field    = pivotFieldEventArgs.Field;
            WebPivotGridField webField = GetWebPivotGridFieldByName(model.PivotSettings.Fields, field.ID);

            if (field.Area == webField.Area && field.AreaIndex == webField.AreaIndex && field.Visible == webField.Visible)
            {
                return;
            }

            bool copyAddMissedValues = field.Visible &&
                                       (field.Area == PivotArea.ColumnArea || field.Area == PivotArea.RowArea) &&
                                       (!webField.Visible || !(webField.Area == PivotArea.ColumnArea ||
                                                               webField.Area == PivotArea.RowArea));
            bool clearMissedValues = !field.Visible ||
                                     !(field.Area == PivotArea.ColumnArea || field.Area == PivotArea.RowArea);

            webField.Area      = field.Area;
            webField.AreaIndex = field.AreaIndex;
            webField.Visible   = field.Visible;
            if (copyAddMissedValues)
            {
                CopyMissedValuesToField(webField, model.PivotSettings.Fields);
            }
            else if (clearMissedValues)
            {
                ClearMissedValues(webField);
            }
            var adminUnitsList = AvrPivotGridHelper.GetAdministrativeUnitView(model.PivotSettings.QueryId,
                                                                              model.PivotSettings.Fields.ToList <IAvrPivotGridField>());

            foreach (PivotGridField f in pivotGrid.Fields)
            {
                WebPivotGridField webF = GetWebPivotGridFieldByName(model.PivotSettings.Fields, f.ID);
                if (f.Visible && f.Area == field.Area && f.ID != field.ID)
                {
                    webF.AreaIndex = f.AreaIndex;
                }
                if (webF.UnitLayoutSearchFieldId != -1 && webF.UnitLayoutSearchFieldId != 0)
                {
                    if (adminUnitsList == null || adminUnitsList.Count == 0 || webF.Area != PivotArea.RowArea)
                    {
                        webF.UnitLayoutSearchFieldId = -1L;
                    }
                    else if (!webF.UnitLayoutSearchFieldId.Equals(adminUnitsList[0]["Id"]))
                    {
                        webF.UnitLayoutSearchFieldId = DBNull.Value.Equals(adminUnitsList[0]["Id"])
                                                           ? -1L
                                                           : (long)adminUnitsList[0]["Id"];
                    }
                }
            }
            if (model.PivotSettings.ShowMissedValues)
            {
                AddMissedValues(model, true);
                pivotGrid.JSProperties["cpNeedCallback"] = true;
                //pivotGrid.ReloadData();
            }
            else
            {
                LayoutValidateResult validateResult = FillEmptyValuesInDataArea(model);
                pivotGrid.JSProperties["cpNeedCallback"] = validateResult.IsCancelOrUserDialogCancel();
            }
            // because AvrPivotGridHelperWeb which used inside m_CustomSummaryHandler should be re-initialized
            m_CustomSummaryHandler = null;
        }
Пример #10
0
        private static PivotGridSettings CreateLayoutPivotGridSettings(AvrPivotGridModel model)
        {
            var  settings = new PivotGridSettings();
            bool readOnly = model.PivotSettings.IsPublished | !AvrPermissions.UpdatePermission;

            settings.Name = "pivotGrid";
            settings.CallbackRouteValues =
                new
            {
                Controller = "Layout",
                Action     = "PivotGridPartial",
                //queryId = model.PivotSettings.QueryId,
                layoutId = model.PivotSettings.LayoutId
            };
            settings.CustomActionRouteValues =
                new
            {
                Controller = "Layout",
                Action     = "PivotGridPartial",
                //queryId = model.PivotSettings.QueryId,
                layoutId = model.PivotSettings.LayoutId
            };
            settings.OptionsView.HorizontalScrollBarMode = model.PivotSettings.FreezeRowHeaders ? ScrollBarMode.Auto : ScrollBarMode.Hidden;
            if (model.PivotSettings.FreezeRowHeaders)
            {
                settings.Width = Unit.Percentage(99);
            }
            settings.OptionsView.ShowFilterHeaders              = false;
            settings.OptionsView.ShowColumnHeaders              = true;
            settings.OptionsView.ShowRowHeaders                 = true;
            settings.OptionsView.DataHeadersDisplayMode         = PivotDataHeadersDisplayMode.Popup;
            settings.OptionsView.DataHeadersPopupMaxColumnCount = 3;
            //settings.OptionsDataField.RowHeaderWidth = 100;
            settings.OptionsPager.Position    = PagerPosition.Bottom;
            settings.OptionsPager.RowsPerPage = BaseSettings.AvrRowsPerPage;

            // note: this option disables paging. commented by Ivan because of out of memory
            //  settings.OptionsPager.Visible = false;
            settings.OptionsBehavior.BestFitMode = PivotGridBestFitMode.FieldValue; // PivotGridBestFitMode.Cell;

            settings.CustomLoadCallbackState = CustomLoadCallbackState;

            settings.OptionsCustomization.AllowDrag   = !readOnly;
            settings.OptionsCustomization.AllowExpand = !readOnly;
            settings.OptionsCustomization.AllowDragInCustomizationForm = true;
            settings.OptionsCustomization.AllowHideFields        = AllowHideFieldsType.Always;
            settings.OptionsCustomization.CustomizationFormStyle = CustomizationFormStyle.Simple;
            settings.OptionsCustomization.AllowCustomizationForm = !readOnly;
            SetTotalSettings(settings.OptionsView, model.PivotSettings);
            if (!readOnly)
            {
                settings.PivotCustomizationExtensionSettings.Name           = "pivotCustomization";
                settings.PivotCustomizationExtensionSettings.Enabled        = true;
                settings.PivotCustomizationExtensionSettings.Visible        = true;
                settings.PivotCustomizationExtensionSettings.AllowedLayouts =
                    CustomizationFormAllowedLayouts.TopPanelOnly;
                settings.PivotCustomizationExtensionSettings.Layout      = CustomizationFormLayout.TopPanelOnly;
                settings.PivotCustomizationExtensionSettings.AllowSort   = true;
                settings.PivotCustomizationExtensionSettings.AllowFilter = false;
                settings.PivotCustomizationExtensionSettings.Height      = Unit.Percentage(100);
                settings.PivotCustomizationExtensionSettings.Width       = Unit.Percentage(100);
            }
            settings.OptionsCustomization.AllowPrefilter = false;
            settings.Prefilter.Enabled = false;
            settings.OptionsView.EnableFilterControlPopupMenuScrolling = true;
            settings.Prefilter.Criteria = CriteriaOperator.TryParse(model.PivotSettings.FilterCriteriaString);
            settings.Styles.PrefilterBuilderCloseButtonStyle.CssClass = "invisible";
            settings.Styles.PrefilterBuilderHeaderStyle.CssClass      = "roundbox";
            settings.PopupMenuCreated += PopupMenuCreated;
            settings.Styles.PrefilterBuilderMainAreaStyle.CssClass = "filterwindow";
            settings.FilterControlOperationVisibility = (sender, args) =>
            {
                WebPivotGridField webField = GetWebPivotGridFieldByName(model.PivotSettings.Fields, args.PropertyInfo.PropertyName);
                if (webField == null)
                {
                    args.Visible = false;
                    return;
                }
                switch (webField.SearchFieldType)
                {
                case SearchFieldType.ID:     //lookup
                    args.Visible = IsValidLookupClause(args.Operation);
                    break;

                case SearchFieldType.String:
                    args.Visible = IsValidStringClause(args.Operation);
                    break;

                case SearchFieldType.Date:
                    args.Visible = IsValidDateClause(args.Operation);
                    break;

                default:
                    args.Visible = IsValidDefaultClause(args.Operation);
                    break;
                }
            };
            settings.FilterControlCustomValueDisplayText = (sender, args) =>
            {
                if (args.Value == null)
                {
                    args.DisplayText = Translator.GetMessageString("FilterConrol_EmptyEnter");
                }
                else if (args.PropertyInfo.PropertyType == typeof(DateTime))
                {
                    args.DisplayText = string.Format("{0:d}", args.Value);
                }
            };
            settings.OptionsCustomization.AllowFilterInCustomizationForm = true;
            settings.Theme = GeneralSettings.Theme;
            settings.Fields.Clear();

            foreach (WebPivotGridField webField in
                     model.PivotSettings.Fields.Where(f => f.Visible && f.Area != PivotArea.FilterArea).OrderBy(f => (long)f.Area * 100000 + f.AreaIndex))
            {
                settings.Fields.Add(webField);
            }
            foreach (WebPivotGridField webField in
                     model.PivotSettings.Fields.Where(f => !f.Visible || f.Area == PivotArea.FilterArea).OrderBy(f => f.Caption))
            {
                settings.Fields.Add(webField);
            }

            settings.Init = (sender, args) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
                if (model.ShowingPrefilter)
                {
                    pivotGrid.PrefilterCriteriaChanged += PrefilterCriteriaChanged;
                }
                pivotGrid.FieldAreaChanged += PivotGridOnFieldAreaChanged;
                pivotGrid.HeaderTemplate    = new HeaderTemplate(model);
            };
            settings.PreRender = (sender, e) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
                pivotGrid.BeginUpdate();
                pivotGrid.HeaderTemplate = new HeaderTemplate(model);
                pivotGrid.EndUpdate();
            };

            settings.BeforeGetCallbackResult = (sender, e) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
                if (model.ShowPrefilter)
                {
                    pivotGrid.IsPrefilterPopupVisible = true;
                    CriteriaOperator criteria = CriteriaOperator.TryParse(model.PivotSettings.FilterCriteriaString);
                    criteria = ValidatePrefilterCriteria(criteria);
                    pivotGrid.Prefilter.Criteria = criteria;

                    model.ShowPrefilter    = false;
                    model.ShowingPrefilter = true;
                    return;
                }
                model.ShowingPrefilter = false;
                pivotGrid.BeginUpdate();
                try
                {
                    pivotGrid.Prefilter.Enabled = false;
                    UpdatePivotGridField(pivotGrid, model);

                    model.PivotSettings.UpdatedField = null;
                    if (model.PivotSettings.UpdateGroupInterval)
                    {
                        PivotGroupInterval interval = GroupIntervalHelper.GetGroupInterval(model.PivotSettings.DefaultGroupInterval);
                        SetInterval(pivotGrid, interval);
                        model.PivotSettings.UpdateGroupInterval = false;
                    }
                    SetTotalSettings(pivotGrid.OptionsView, model.PivotSettings);

                    pivotGrid.OptionsView.HorizontalScrollBarMode = model.PivotSettings.FreezeRowHeaders ? ScrollBarMode.Auto : ScrollBarMode.Hidden;
                    if (model.PivotSettings.FreezeRowHeaders)
                    {
                        pivotGrid.Width = Unit.Percentage(99);
                    }
                    else
                    {
                        pivotGrid.Width = Unit.Empty;
                    }
                    pivotGrid.ReloadData();
                }
                finally
                {
                    pivotGrid.EndUpdate();
                }
            };

            //settings.ClientSideEvents.EndCallback = "layoutPivotGrid.resizePivotGridEvent";

            settings.AfterPerformCallback = (sender, e) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;

                if (pivotGrid.HeaderTemplate == null)
                {
                    pivotGrid.HeaderTemplate = new HeaderTemplate(model);
                }
                //pivotGrid.BeginUpdate();
                //pivotGrid.ReloadData();
                //pivotGrid.EndUpdate();
            };

            settings.ClientSideEvents.CallbackError = "layoutPivotGrid.onCallbackError";
            settings.ClientSideEvents.EndCallback   = "layoutPivotGrid.onEndCallback";

            settings.CustomCellDisplayText = (sender, e) =>
            {
                InitDisplayTexthandler();

                m_DisplayTextHandler.DisplayAsterisk(new WebPivotCellDisplayTextEventArgs(e));
                if (e.DataField == null)
                {
                    return;
                }
                if (model.PivotSettings.FieldsDictionary.ContainsKey(e.DataField.FieldName))
                {
                    WebPivotGridField field = model.PivotSettings.FieldsDictionary[e.DataField.FieldName];
                    m_DisplayTextHandler.DisplayCellText(new WebPivotCellDisplayTextEventArgs(e), field.CustomSummaryType, field.Precision);
                }
            };

            settings.FieldValueDisplayText = (sender, e) =>
            {
                InitDisplayTexthandler();
                var eventArgs = new WebPivotFieldDisplayTextEventArgs(e);
                m_DisplayTextHandler.DisplayAsterisk(eventArgs);
                m_DisplayTextHandler.DisplayBool(eventArgs);

                if (m_CustomSummaryHandler == null)
                {
                    var helper = new AvrPivotGridHelperWeb((ASPxPivotGrid)sender)
                    {
                        SingleSearchObject = model.PivotSettings.IsSingleSearchObject
                    };

                    m_CustomSummaryHandler = new CustomSummaryHandler(helper);
                }
                var summaryTypes = new List <CustomSummaryType>();


                List <IAvrPivotGridField> dataFields = AvrPivotGridHelper.GetFieldCollectionFromArea(model.PivotSettings.Fields,
                                                                                                     PivotArea.DataArea);
                foreach (IAvrPivotGridField field in dataFields)
                {
                    summaryTypes.Add(field.CustomSummaryType);
                    m_DisplayTextHandler.DisplayStatisticsTotalCaption(eventArgs, summaryTypes);
                }
            };

            settings.CustomSummary = (sender, e) =>
            {
                if (m_CustomSummaryHandler == null)
                {
                    var helper = new AvrPivotGridHelperWeb((ASPxPivotGrid)sender);

                    m_CustomSummaryHandler = new CustomSummaryHandler(helper);
                }

                WebPivotGridField settingsField = model.PivotSettings.Fields.Find(f => f.FieldName == e.DataField.FieldName);
                var field = e.DataField as IAvrPivotGridField;

                if (settingsField != null && field != null && ((int)field.CustomSummaryType <= 0))
                {
                    field.CustomSummaryType    = settingsField.CustomSummaryType;
                    field.BasicCountFunctionId = settingsField.BasicCountFunctionId;
                    field.AggregateFunctionId  = settingsField.AggregateFunctionId;


                    field.UnitLayoutSearchFieldId = settingsField.UnitLayoutSearchFieldId;
                    field.UnitSearchFieldAlias    = settingsField.UnitSearchFieldAlias;
                    field.SearchFieldDataType     = settingsField.SearchFieldDataType;

                    field.DefaultGroupInterval = settingsField.DefaultGroupInterval;

                    field.Ordinal           = settingsField.Ordinal;
                    field.AddMissedValues   = settingsField.AddMissedValues;
                    field.DiapasonStartDate = settingsField.DiapasonStartDate;
                    field.DiapasonEndDate   = settingsField.DiapasonEndDate;
                    field.Precision         = settingsField.Precision;

                    field.AggregateFunctionId     = settingsField.AggregateFunctionId;
                    field.BasicCountFunctionId    = settingsField.BasicCountFunctionId;
                    field.UnitLayoutSearchFieldId = settingsField.UnitLayoutSearchFieldId;
                    field.UnitSearchFieldAlias    = settingsField.UnitSearchFieldAlias;
                    field.DateLayoutSearchFieldId = settingsField.DateLayoutSearchFieldId;
                    field.DateSearchFieldAlias    = settingsField.DateSearchFieldAlias;

                    if (settingsField.IsDateTimeField)
                    {
                        field.GroupInterval = settingsField.DefaultGroupInterval;
                    }

                    field.AllowMissedReferenceValues = settingsField.AllowMissedReferenceValues;
                    field.LookupTableName            = settingsField.LookupTableName;
                    field.GisReferenceTypeId         = settingsField.GisReferenceTypeId;
                    field.ReferenceTypeId            = settingsField.ReferenceTypeId;
                    field.LookupAttributeName        = settingsField.LookupAttributeName;
                    field.HaCode = settingsField.HaCode;

                    field.AllPivotFields       = settingsField.AllPivotFields;
                    field.FieldNamesDictionary = settingsField.FieldNamesDictionary;
                }
                m_CustomSummaryHandler.OnCustomSummary(sender, new WebPivotGridCustomSummaryEventArgs(e));
            };
            settings.CustomCellStyle = (sender, args) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
            };
            settings.HtmlCellPrepared = (sender, args) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
            };
            settings.HtmlFieldValuePrepared = (sender, args) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
            };
            settings.GridLayout = (sender, args) =>
            {
                var pivotGrid = (MVCxPivotGrid)sender;
                model.PivotSettings.HasChanges = true;
                var fieldsToDelete = new List <PivotGridFieldBase>();
                foreach (PivotGridField field in pivotGrid.Fields)
                {
                    WebPivotGridField webField = GetWebPivotGridFieldByFieldName(model.PivotSettings.Fields, field.FieldName);
                    if (webField != null)
                    {
                        PivotFieldItemBase visualField =
                            pivotGrid.Fields.Data.VisualItems.Data.FieldItems.SingleOrDefault(
                                s => s.FieldName == field.FieldName);
                        Dbg.Assert(visualField != null, "field {0} is not found in pivot fields list",
                                   field.FieldName);
                        if (!visualField.Visible && visualField.Area != PivotArea.FilterArea)
                        {
                            webField.Area      = PivotArea.FilterArea;
                            webField.AreaIndex = -1;
                            webField.FilterValues.Clear();
                            webField.SortOrder = field.SortOrder;
                            webField.Width     = field.Width;
                            ClearMissedValues(webField);
                        }
                        else
                        {
                            webField.Area      = field.Area;
                            webField.AreaIndex = field.AreaIndex;
                            webField.Visible   = field.Visible;
                            webField.SortOrder = field.SortOrder;
                            webField.Width     = field.Width;
                            webField.FilterValues.Assign(field.FilterValues);
                            //if (webField.IsDateTimeField && webField.GroupInterval == PivotGroupInterval.Default)
                            //{
                            //    webField.DefaultGroupInterval = GroupIntervalHelper.GetGroupInterval(model.PivotSettings.DefaultGroupInterval);
                            //    field.GroupInterval = webField.GroupInterval;
                            //}
                        }
                    }
                    else
                    {
                        fieldsToDelete.Add(field);
                    }
                }
                foreach (PivotGridFieldBase field in fieldsToDelete)
                {
                    field.Visible   = false;
                    field.Area      = PivotArea.FilterArea;
                    field.AreaIndex = -1;
                    pivotGrid.Fields.Remove(field);
                }
                //if (model.PivotSettings.ShowMissedValues)
                //{
                //    List<IAvrPivotGridField> fields = model.PivotSettings.Fields.Cast<IAvrPivotGridField>().ToList();
                //    AvrPivotGridHelper.AddMissedValuesInRowColumnArea(model, fields);
                //}
                if (fieldsToDelete.Count > 0)
                {
                    pivotGrid.ReloadData();
                }
            };
            return(settings);
        }
Пример #11
0
        public void SaveChanges(WebPivotGridField webField, LayoutDetailDataSet ds)
        {
            if (!Equals(BasicCountFunctionId, webField.BasicCountFunctionId))
            {
                webField.BasicCountFunctionId = BasicCountFunctionId;
                webField.HasChanges           = true;
            }
            if (!Equals(AggregateFunctionId, webField.AggregateFunctionId))
            {
                webField.AggregateFunctionId = AggregateFunctionId;
                webField.HasChanges          = true;
            }
            if (!Equals(Precision, webField.Precision))
            {
                webField.Precision  = Precision;
                webField.HasChanges = true;
            }
            if (!Equals(UnitLayoutSearchFieldId, webField.UnitLayoutSearchFieldId))
            {
                webField.UnitLayoutSearchFieldId = UnitLayoutSearchFieldId;
                if (UnitLayoutSearchFieldId != -1)
                {
                    var unitRow = ds.LayoutSearchField.Rows.Find(UnitLayoutSearchFieldId) as LayoutDetailDataSet.LayoutSearchFieldRow;

                    webField.UnitSearchFieldAlias = unitRow == null
                        ? string.Empty
                        : unitRow.strSearchFieldAlias;
                }
                webField.HasChanges = true;
            }
            if (!Equals(DateLayoutSearchFieldId, webField.DateLayoutSearchFieldId))
            {
                webField.DateLayoutSearchFieldId = DateLayoutSearchFieldId;
                webField.HasChanges = true;
            }
            PivotGroupInterval?interval = null;

            if (PrivateGroupInterval.HasValue)
            {
                interval = GroupIntervalHelper.GetGroupInterval(PrivateGroupInterval.Value);
            }
            if (!Equals(interval, webField.PrivateGroupInterval))
            {
                webField.PrivateGroupInterval = interval;
                webField.HasChanges           = true;
            }

            if (!Equals(DiapasonStartDate, webField.DiapasonStartDate))
            {
                webField.DiapasonStartDate = DiapasonStartDate;
                webField.HasChanges        = true;
            }
            if (!Equals(DiapasonEndDate, webField.DiapasonEndDate))
            {
                webField.DiapasonEndDate = DiapasonEndDate;
                webField.HasChanges      = true;
            }
            if (!Equals(AddMissedValues, webField.AddMissedValues))
            {
                webField.AddMissedValues = AddMissedValues;
                webField.UpdateImageIndex();
                webField.HasChanges = true;
            }
            LayoutDetailDataSet.LayoutSearchFieldRow row = GetLayoutSearchFieldRowByField(ds, webField);
            webField.Caption = (ModelUserContext.CurrentLanguage == Localizer.lngEn) ? CaptionEn : Caption;
            if (
                !Equals(string.IsNullOrEmpty(row.strNewFieldENCaption) ? row.strOriginalFieldENCaption : row.strNewFieldENCaption, CaptionEn))
            {
                row.strNewFieldENCaption = CaptionEn;
                webField.HasChanges      = true;
            }
            if (ModelUserContext.CurrentLanguage != Localizer.lngEn)
            {
                if (!Equals(string.IsNullOrEmpty(row.strNewFieldCaption) ? row.strOriginalFieldCaption : row.strNewFieldCaption, Caption))
                {
                    row.strNewFieldCaption = Caption;
                    webField.HasChanges    = true;
                }
            }
        }
Пример #12
0
 public void CancelChanges(WebPivotGridField webField, LayoutDetailDataSet ds)
 {
     Init(webField, ds);
 }
Пример #13
0
 private LayoutDetailDataSet.LayoutSearchFieldRow GetLayoutSearchFieldRowByField(LayoutDetailDataSet ds, WebPivotGridField webField)
 {
     return(AvrPivotGridHelper.GetLayoutSearchFieldRowByField(webField, ds));
 }
Пример #14
0
 public WebPivotGridFieldClone(WebPivotGridField webField, LayoutDetailDataSet ds)
 {
     Caption = webField.Caption;
     Init(webField, ds);
 }