Пример #1
0
        private void BindFilterFile()
        {
            CriteriaOperator currentCriteria = _view.Context.GetFilter(_gridFilter);
            var viewItems = GetListFilterItems();
            IEnumerable <ListFilterItem> items     = viewItems.OrderBy(i => i.Order).ToList();
            GalleryItemGroup             itemGroup = new GalleryItemGroup();

            foreach (ListFilterItem item in items)
            {
                GalleryItem galleryItem = new GalleryItem();
                galleryItem.Caption    = item.FilterName + " ";
                galleryItem.Image      = (Image)Properties.Resources.ResourceManager.GetObject("tag");
                galleryItem.HoverImage = galleryItem.Image;
                string filterString   = item.FilterString;
                bool   isCrietiaEqual = IsCriteriaOperatorEquals(currentCriteria, CriteriaOperator.TryParse(filterString));
                galleryItem.Checked = isCrietiaEqual;
                galleryItem.Tag     = item.FilterString + "¹" + item.Name;
                itemGroup.Items.Add(galleryItem);
            }
            if (!itemGroup.Items.Cast <GalleryItem>().Any(i => i.Checked) && itemGroup.Items.Count > 0)
            {
                itemGroup.Items.Cast <GalleryItem>().Last().Checked = true;
            }
            this.Gallery.Groups.Clear();
            this.GalleryDropDown.Gallery.Groups.Clear();
            this.Gallery.Groups.Add(itemGroup);
            this.GalleryDropDown.Gallery.Groups.AddRange(new[] { itemGroup });
        }
Пример #2
0
    protected void ASPxGridView1_ProcessColumnAutoFilter(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewAutoFilterEventArgs e)
    {
        if (e.Column.FieldName != "UnitPrice")
        {
            return;
        }

        if (e.Kind == GridViewAutoFilterEventKind.CreateCriteria)
        {
            if ((e.Value.Length > 1) && ((e.Value[0] == '<') || (e.Value[0] == '>')))
            {
                e.Criteria = CriteriaOperator.TryParse("[UnitPrice]" + e.Value);
            }
        }
        else if (e.Kind == GridViewAutoFilterEventKind.ExtractDisplayText)
        {
            if (e.Value.Length > 0)
            {
                BinaryOperator bo             = (BinaryOperator)e.Criteria;
                string         operatorSymbol = String.Empty;
                switch (bo.OperatorType)
                {
                case BinaryOperatorType.Greater:
                    operatorSymbol = ">";
                    break;

                case BinaryOperatorType.Less:
                    operatorSymbol = "<";
                    break;
                }
                e.Value = operatorSymbol + e.Value;
            }
        }
    }
Пример #3
0
        private void BindFilterFile()
        {
            CriteriaOperator currentCriteria = _viewContext.GetFilter(_gridFilter);
            var viewItems = GetListFilterItems();
            var items     = viewItems.OrderBy(i => i.Order).ToList();
            GalleryItemGroup itemGroup = new GalleryItemGroup();

            foreach (var item in items)
            {
                GalleryItem galleryItem = new FilterGalleryItem(item);
                galleryItem.Caption    = item.DisplayName;
                galleryItem.Image      = WinFormsResourceService.GetBitmap("tag");
                galleryItem.HoverImage = galleryItem.Image;
                string filterString   = item.FilterString;
                bool   isCrietiaEqual = IsCriteriaOperatorEquals(currentCriteria, CriteriaOperator.TryParse(filterString));
                galleryItem.Checked = isCrietiaEqual;
                itemGroup.Items.Add(galleryItem);
            }
            if (!itemGroup.Items.Cast <GalleryItem>().Any(i => i.Checked) && itemGroup.Items.Count > 0)
            {
                itemGroup.Items.Cast <GalleryItem>().Last().Checked = true;
            }
            this.Gallery.Groups.Clear();
            this.Gallery.Groups.Add(itemGroup);
        }
Пример #4
0
        public void InitEntityView(string entityName)
        {
            EntityName = entityName;
            EntityGridView.BeginUpdate();
            EntityGridView.LoadDefaultLayout(entityName);
            EntityGridView.InitColumns(entityName);
            _persistenceService = new UserDataPersistenceService(entityName + "List");
            object savedLayout = _persistenceService["GridLayout"];

            if (savedLayout != null)
            {
                string layoutXml = savedLayout.ToString();
                EntityGridView.RestoreLayoutFromString(layoutXml);
            }

            if (_persistenceService["Fileter"] != null)
            {
                string           filter   = _persistenceService["Fileter"].ToString();
                CriteriaOperator criteria = CriteriaOperator.TryParse(filter);
                Context.SetFilter("GridFilter", criteria);
            }
            LoadUserFormatCondition();
            EntityGridView.EndUpdate();
            InitConvert();
        }
Пример #5
0
        void SendFilterMessage(object sender, AppFramework.Utils.EventArgs <string> e)
        {
            CriteriaOperator filter = CriteriaOperator.TryParse(e.Data);

            EventAggregationManager.SendMessage(new FilterChangedMessage
            {
                ObjectName = ObjectName,
                Filter     = filter
            });
        }
Пример #6
0
 private bool SetFilterString(string filterString)
 {
     viewCustomers.ActiveFilter.Clear();
     try {
         viewCustomers.ActiveFilterCriteria = CriteriaOperator.TryParse(filterString);
         return(true);
     } catch {
         return(false);
     }
 }
Пример #7
0
 private void SetFilter(GalleryItem galleryItem)
 {
     if (galleryItem != null)
     {
         galleryItem.GalleryGroup.Items.Cast <GalleryItem>().ToList().ForEach(i => i.Checked = false);
         galleryItem.Checked = true;
         string[]         tagInfos = galleryItem.Tag.ToString().Split(new char[] { '¹' });
         CriteriaOperator filter   = CriteriaOperator.TryParse(tagInfos[0]);
         _view.Context.SetFilter(_gridFilter, filter);
         _view.Context.RefreshData();
     }
 }
Пример #8
0
        private List <CriteriaOperator> GetSecurityCriteria(Type type)
        {
            if (selectDataSecurity != null)
            {
                IList <string> criteria = selectDataSecurity.GetObjectCriteria(type);
                if (criteria != null)
                {
                    return(criteria.Select(c => CriteriaOperator.TryParse(c)).Where(c => !ReferenceEquals(c, null)).ToList());
                }
            }

            return(new List <CriteriaOperator>());
        }
Пример #9
0
        private void ReadFilter()
        {
            if (string.IsNullOrEmpty(this.ObjectName))
            {
                throw new Exception("ObjectName is empty in filter");
            }
            CriteriaOperator projectOperator   = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + ProjectConfigId, null));
            CriteriaOperator iterationOperator = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + IterationConfigId, null));
            CriteriaOperator memberOperator    = CriteriaOperator.TryParse(_config.Get <string>(this.ObjectName + MemberConfigId, null));

            this.Context.SetFilter("ProjectId", projectOperator);
            Context.SetFilter("ProjectIterationId", iterationOperator);
            Context.SetFilter("MemberId", memberOperator);
        }
Пример #10
0
        object GetObjectKeyCore(IObjectSpace objectSpace, Type type, string objectKeyString)
        {
            if (objectKeyString.CanChange(((XPObjectSpace)objectSpace).GetObjectKeyType(type)))
            {
                try {
                    return(objectSpace.GetObjectKey(type, objectKeyString));
                } catch {
                }
            }
            var criteriaOperator = CriteriaOperator.TryParse(objectKeyString);

            if (!ReferenceEquals(criteriaOperator, null))
            {
                return(criteriaOperator);
            }

            throw new ArgumentException(objectKeyString, "objectKeyString");
        }
Пример #11
0
        object GetObjectKeyCore(IObjectSpace objectSpace, Type type, string objectKeyString)
        {
            if (objectKeyString.CanChange(objectSpace.GetObjectKeyType(type)))
            {
                try {
                    return(objectSpace.GetObjectKey(type, objectKeyString));
                    // ReSharper disable once EmptyGeneralCatchClause
                } catch {
                }
            }
            var criteriaOperator = CriteriaOperator.TryParse(objectKeyString);

            if (!ReferenceEquals(criteriaOperator, null))
            {
                return(criteriaOperator);
            }

            throw new ArgumentException(objectKeyString, nameof(objectKeyString));
        }
        protected override object Visit(BinaryOperator theOperator)
        {
            switch (theOperator.OperatorType)
            {
            case BinaryOperatorType.Like:
                var property = (OperandProperty)theOperator.LeftOperand;
                property = (OperandProperty)Visit(property);
                FunctionOperator funOperator = new FunctionOperator(FunctionOperatorType.Contains, property, theOperator.RightOperand);
                return(funOperator);

            case BinaryOperatorType.Equal:
                string rightString = theOperator.RightOperand.ToString();
                if (rightString.EndsWith("#") && rightString.StartsWith("#"))
                {
                    rightString = rightString.TrimStart('#').TrimEnd('#');
                    string leftString = theOperator.LeftOperand.ToString();
                    string filter     = leftString + ">= #" + rightString + " 00:00:00# && " + leftString + "<= #" + rightString + " 23:59:59#";
                    return(CriteriaOperator.TryParse(filter));
                }
                break;
            }
            return(base.Visit(theOperator));
        }
Пример #13
0
        //private void BookRegister_Execute(object sender, SimpleActionExecuteEventArgs e)
        //{
        //    double numcredits = 0;
        //    Decimal sumTuitionFee = 0;
        //    ListEditor listEditor = ((ListView)View).Editor as ListEditor;
        //    PopUpMessage ms;
        //    DialogController dc;
        //    ObjectSpace objectSpace = Application.CreateObjectSpace();
        //    if (listEditor != null)
        //    {
        //        if (SecuritySystem.CurrentUser is Student)
        //        {

        //            //kiem tra rang buoc so tin chi min
        //            foreach (RegisterDetail regDetail in ((ListView)View).SelectedObjects)
        //            {
        //                numcredits += regDetail.Lesson.Subject.Credit;

        //            }
        //            ConstrainstParameter cparam = objectSpace.FindObject<ConstrainstParameter>(
        //            new BinaryOperator("Code", "MINCREDITS"));
        //            if (cparam != null && numcredits < Convert.ToDouble(cparam.Value))
        //            {

        //                ms = objectSpace.CreateObject<PopUpMessage>();
        //                ms.Title = "Lỗi đăng ký";
        //                ms.Message = string.Format("Không đăng ký ít hơn {0} tín chỉ!", cparam.Value);
        //                e.ShowViewParameters.CreatedView = Application.CreateDetailView(
        //                     objectSpace, ms);
        //                e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        //                e.ShowViewParameters.CreatedView.Caption = "Thông báo";
        //                dc = Application.CreateController<DialogController>();
        //                dc.AcceptAction.Active.SetItemValue("object", false);
        //                dc.CancelAction.Caption = "Đóng";
        //                dc.SaveOnAccept = false;
        //                e.ShowViewParameters.Controllers.Add(dc);

        //                return;
        //            }
        //            //kiem tra rang buoc so tin chi max
        //            cparam = View.ObjectSpace.FindObject<ConstrainstParameter>(
        //            new BinaryOperator("Code", "MAXCREDITS"));
        //            if (cparam != null && numcredits > Convert.ToDouble(cparam.Value))
        //            {

        //                ms = objectSpace.CreateObject<PopUpMessage>();
        //                ms.Title = "Lỗi đăng ký";
        //                ms.Message = string.Format("Không đăng ký nhiều hơn {0} tín chỉ!", cparam.Value);
        //                e.ShowViewParameters.CreatedView = Application.CreateDetailView(
        //                     objectSpace, ms);
        //                e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        //                e.ShowViewParameters.CreatedView.Caption = "Thông báo";
        //                dc = Application.CreateController<DialogController>();
        //                dc.AcceptAction.Active.SetItemValue("object", false);
        //                dc.CancelAction.Caption = "Đóng";
        //                dc.SaveOnAccept = false;
        //                e.ShowViewParameters.Controllers.Add(dc);


        //                return;
        //            }

        //            numcredits = 0;
        //            sumTuitionFee = 0;
        //            string lessonCodelist = "";

        //            foreach (RegisterDetail regDetail in ((ListView)View).SelectedObjects)
        //            {
        //                if (regDetail.RegisterState.Code == "SELECTED")
        //                {
        //                    numcredits += regDetail.Lesson.Subject.Credit;
        //                    sumTuitionFee += regDetail.Lesson.TuitionFee;
        //                    View.ObjectSpace.SetModified(regDetail);
        //                    View.ObjectSpace.SetModified(regDetail.Lesson);
        //                    regDetail.RegisterState = View.ObjectSpace.FindObject<RegisterState>(
        //                        new BinaryOperator ("Code","BOOKED"));
        //                    regDetail.CheckState = View.ObjectSpace.FindObject<RegisterState>(
        //                        new BinaryOperator("Code", "NOTCHECKED"));
        //                    regDetail.Lesson.NumRegistration++;
        //                    lessonCodelist += (String.Format("{0}({1})-", regDetail.Lesson.LessonName, regDetail.Lesson.Subject.SubjectCode));
        //                }
        //            }
        //            lessonCodelist = lessonCodelist.TrimEnd('-');
        //            //create Account transaction
        //            AccountTransaction act = View.ObjectSpace.CreateObject<AccountTransaction>();
        //            Student stud = View.ObjectSpace.FindObject<Student>(
        //                new BinaryOperator("Oid", SecuritySystem.CurrentUserId));
        //            act.Student = stud;
        //            act.MoneyAmount = -sumTuitionFee;
        //            act.TransactingDate = DateTime.Now;
        //            act.Description = string.Format("Học phí [{0}] phải đóng cho {1} tín chỉ đăng ký: [{2}], do [{3}] thực hiện đăng ký", stud.StudentCode, numcredits, lessonCodelist, stud.FullName);
        //            act.Save();

        //            View.ObjectSpace.CommitChanges();

        //            ms = objectSpace.CreateObject<PopUpMessage>();
        //            ms.Title = "Thực hiện đăng ký thành công";
        //            ms.Message = string.Format("Bạn đã chọn đăng ký {0} nhóm lớp môn học, với số tiền {1}", numcredits, sumTuitionFee);
        //            ms.Message += "\r\n Vui lòng xem kết quả giao dịch học phí!!!";
        //            e.ShowViewParameters.CreatedView = Application.CreateDetailView(
        //                 objectSpace, ms);
        //            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        //            e.ShowViewParameters.CreatedView.Caption = "Thông báo";
        //            dc = Application.CreateController<DialogController>();
        //            dc.AcceptAction.Active.SetItemValue("object", false);
        //            dc.CancelAction.Caption = "Đóng";
        //            dc.SaveOnAccept = false;
        //            e.ShowViewParameters.Controllers.Add(dc);

        //        }
        //        else
        //        {

        //            Dictionary<string, double> studentnumcredits = new Dictionary<string, double>();
        //            Dictionary<string, decimal> studentFee = new Dictionary<string, decimal>();
        //            Dictionary<string, string> studentLessonCodeList = new Dictionary<string, string>();
        //            Dictionary<string, string> lessonCannotReg = new Dictionary<string, string>();
        //            foreach (RegisterDetail regDetail in View.SelectedObjects)
        //            {

        //                if (!studentnumcredits.ContainsKey(regDetail.Student.StudentCode))
        //                {
        //                    studentnumcredits.Add(regDetail.Student.StudentCode, 0);
        //                }
        //                if (!studentFee.ContainsKey(regDetail.Student.StudentCode))
        //                {
        //                    studentFee.Add(regDetail.Student.StudentCode, 0);
        //                }
        //                if (!studentLessonCodeList.ContainsKey(regDetail.Student.StudentCode))
        //                {
        //                    studentLessonCodeList.Add(regDetail.Student.StudentCode, "");
        //                }
        //                View.ObjectSpace.SetModified(regDetail);
        //                View.ObjectSpace.SetModified(regDetail.Lesson);
        //                if (regDetail.RegisterState.Code == "SELECTED")
        //                {
        //                    if (regDetail.Lesson.NumRegistration >= regDetail.Lesson.NumExpectation)
        //                    {
        //                        if (!lessonCannotReg.ContainsKey(regDetail.Lesson.LessonName))
        //                        {
        //                            lessonCannotReg.Add(regDetail.Lesson.LessonName, "");
        //                        }
        //                        lessonCannotReg[regDetail.Lesson.LessonName] += string.Format("[{0}]-", regDetail.Student.StudentCode);
        //                        regDetail.Note = "Over Sized";
        //                    }
        //                    else
        //                    {
        //                        studentnumcredits[regDetail.Student.StudentCode] += regDetail.Lesson.Subject.Credit;
        //                        studentFee[regDetail.Student.StudentCode] += regDetail.Lesson.TuitionFee;
        //                        studentLessonCodeList[regDetail.Student.StudentCode] += (String.Format("{0}({1})-", regDetail.Lesson.LessonName, regDetail.Lesson.Subject.SubjectCode));


        //                        regDetail.RegisterState = View.ObjectSpace.FindObject<RegisterState>(
        //                        new BinaryOperator("Code", "BOOKED"));
        //                        regDetail.Lesson.NumRegistration++;
        //                    }
        //                }
        //            }
        //            int numstudent = 0;
        //            double credit = 0;
        //            decimal sumfee = 0;
        //            foreach (string studCode in studentLessonCodeList.Keys)
        //            {
        //                if (studentnumcredits[studCode] > 0)
        //                {
        //                    numstudent++;
        //                    credit += studentnumcredits[studCode];
        //                    sumfee += studentFee[studCode];

        //                    //create Account transaction
        //                    AccountTransaction act = View.ObjectSpace.CreateObject<AccountTransaction>();
        //                    Student studnew = View.ObjectSpace.FindObject<Student>(
        //                        new BinaryOperator("StudentCode", studCode));
        //                    act.Student = studnew;
        //                    act.MoneyAmount = -studentFee[studCode];
        //                    act.TransactingDate = DateTime.Now;
        //                    act.Description = string.Format("Học phí sinh viên [{0}] phải đóng cho {1} tín chỉ đăng ký là {2:0,0},\r\n bao gồm: [{3}],\r\n [{4}] thực hiện đăng ký",
        //                        studnew.StudentCode, studentnumcredits[studCode], studentFee[studCode], studentLessonCodeList[studCode].TrimEnd('-'), SecuritySystem.CurrentUserName);
        //                    act.Save();
        //                }
        //            }

        //            View.ObjectSpace.CommitChanges();

        //            ms = objectSpace.CreateObject<PopUpMessage>();
        //            ms.Title = "Thực hiện đăng ký (Booked) thành công";
        //            ms.Message = string.Format("Bạn đã chọn đăng ký cho {0} sinh viên, với số tiền {1:0,0} cho tổng số {2:0,0} tín chỉ học",
        //                numstudent, sumfee, credit);
        //            ms.Message += "\r\n Vui lòng xem kết quả giao dịch học phí!!!";
        //            if (lessonCannotReg.Count > 0)
        //            {
        //                string strmessage = "";
        //                foreach (KeyValuePair<string, string> keypair in lessonCannotReg)
        //                {
        //                    strmessage += string.Format("Nhóm lớp MH:[{0}], sinh viên [{1}] \r\n", keypair.Key, keypair.Value.TrimEnd('-'));
        //                }
        //                ms.Message += "\r\nKhông đăng ký được do quá sĩ số:\r\n" + strmessage;
        //            }
        //            e.ShowViewParameters.CreatedView = Application.CreateDetailView(
        //                 objectSpace, ms);
        //            e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        //            e.ShowViewParameters.CreatedView.Caption = "Thông báo";
        //            dc = Application.CreateController<DialogController>();
        //            e.ShowViewParameters.Controllers.Add(dc);
        //            dc.AcceptAction.Active.SetItemValue("object", false);
        //            dc.CancelAction.Caption = "Đóng";
        //            dc.SaveOnAccept = false;
        //        }
        //    }
        //}
        //private void ConfirmRegister_Execute(object sender, SimpleActionExecuteEventArgs e)
        //{

        //    ListEditor listEditor = ((ListView)View).Editor as ListEditor;
        //    if (listEditor != null)
        //    {
        //        int i = 0;
        //        string messsage = "";
        //        ObjectSpace objectSpace = Application.CreateObjectSpace();
        //        PopUpMessage ms = objectSpace.CreateObject<PopUpMessage>();
        //        ms.Message = messsage;
        //        DialogController dc = Application.CreateController<DialogController>();
        //        if (View.SelectedObjects.Count > 0)
        //        {
        //            foreach (RegisterDetail regDetail in ((ListView)View).SelectedObjects)
        //            {
        //                regDetail.RegisterState = View.ObjectSpace.FindObject<RegisterState>(
        //                        new BinaryOperator("Code", "PRINTED"));
        //                if (regDetail.CheckState.Code == "CHECKED")
        //                {
        //                    View.ObjectSpace.SetModified(regDetail);
        //                    regDetail.CheckState = View.ObjectSpace.FindObject<RegisterState>(
        //                        new BinaryOperator("Code", "CONFIRMED"));
        //                    i++;
        //                }
        //            }
        //            View.ObjectSpace.CommitChanges();
        //            messsage = string.Format("Đã xác nhận kết quả cho \"{0}\" Nhóm MH, \r\n Nhấn OK để in kết quả!", i);
        //            ms.Title = "Kết quả xác nhận!";
        //            dc.Accepting += dc_Accepting_Report;
        //            dc.SaveOnAccept = false;
        //        }
        //        else
        //        {
        //            messsage = "Vui lòng chọn tất cả các môn đã kiểm tra";
        //            ms.Title = "Chưa chọn môn xác nhận!";
        //        }


        //        e.ShowViewParameters.CreatedView = Application.CreateDetailView(
        //            objectSpace, ms);
        //        e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
        //        e.ShowViewParameters.CreatedView.Caption = "Thông báo";
        //        e.ShowViewParameters.Controllers.Add(dc);
        //    }
        //}

        #endregion

        void dc_Accepting_Report(object sender, DialogControllerAcceptingEventArgs e)
        {
            Controller  controller  = sender as Controller;
            ObjectSpace objectSpace = Application.CreateObjectSpace();
            ReportData  rd          = objectSpace.FindObject <ReportData>(
                new BinaryOperator("Name", "Kết quả ĐK 1 SV"));

            if (rd != null)
            {
                XafReport report = rd.LoadXtraReport(objectSpace);

                CriteriaOperator criteriaOperator = CriteriaOperator.TryParse(
                    String.Format("[Student.Oid] = '{0}'", SecuritySystem.CurrentUserId));
                Student student = objectSpace.FindObject <Student>(criteriaOperator);
                report.Filtering.Filter = criteriaOperator.ToString();
                MemoryStream stream = new MemoryStream();
                report.ExportToPdf(stream);
                if (HttpContext.Current != null)
                {
                    byte[] buffer             = stream.GetBuffer();
                    string contentType        = "application/pdf";
                    string contentDisposition = "attachment; filename=" + student.StudentCode + ".pdf";
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Buffer = false;
                    HttpContext.Current.Response.AppendHeader("Content-Type", contentType);
                    HttpContext.Current.Response.AppendHeader("Content-Transfer-Encoding", "binary");
                    HttpContext.Current.Response.AppendHeader("Content-Disposition", contentDisposition);
                    HttpContext.Current.Response.BinaryWrite(buffer);
                    HttpContext.Current.Response.End();
                }
                else
                {
                    report.ShowPreview();
                }
                controller.Dispose();
            }
        }
Пример #14
0
 void filterControl_OnObjectFilterChange(object sender, AppFramework.Utils.EventArgs <string, string> e)
 {
     _objectTypeFilter = CriteriaOperator.TryParse(e.Data1);
     _objectTypeName   = e.Data2;
     SetFilter();
 }
Пример #15
0
 public DevExpress.Data.Filtering.CriteriaOperator ParseCriteria(string criteria)
 {
     return(CriteriaOperator.TryParse(criteria));
 }
Пример #16
0
        private object GetIncrementalModeSummary(XtraReport report)
        {
            if (effectiveOwner == null)
            {
                Reset();
            }

            var dataContext = get_DataContext(report);
            var browser     = (ListBrowser)dataContext.GetDataBrowser(DataSource ?? report.DataSource, DataMember, false);

            if (browser == null)
            {
                return(null);
            }

            SortedListController listController;

            if (OverrideFilter != null)
            {
                if (unfilteredListController == null || unfilteredListControllerList != browser.List)
                {
                    unfilteredListControllerList = browser.List;
                    unfilteredListController     = new CustomSortedListController();
                    unfilteredListController.SetList(browser.List);
                    unfilteredListController.SetBrowser(browser);
                    unfilteredListController.Initialize(
                        ((SortedListController)browser.ListController).GetOriginalGroupFields(),
                        ((SortedListController)browser.ListController).GetSortingSummary(),
                        GetFilterCriteria(report, OverrideFilter));
                }
                listController = unfilteredListController;
            }
            else
            {
                listController = (SortedListController)browser.ListController;
            }


            if (effectiveOwner == null)
            {
                effectiveOwner              = Running ?? report;
                effectiveOwner.BeforePrint += effectiveOwner_BeforePrint;

                report.BeforePrint -= Report_BeforePrint;
                report.BeforePrint += Report_BeforePrint;
            }

            var currentListSource = listController.GetDataController().ListSource;

            if (lastCollection != currentListSource)
            {
                lastPosition   = -1;
                lastCollection = currentListSource;
            }

            int currentPosition;

            if (listController == browser.ListController)
            {
                currentPosition = browser.Position;
                if (currentPosition < lastPosition) // Charting doubles back
                {
                    lastPosition = -1;
                    Reset();
                }
            }
            else
            {
                currentPosition = -1;
                for (var i = 0; i < listController.Count; i++)
                {
                    if (listController.GetItem(i) == browser.Current)
                    {
                        currentPosition = i;
                        break;
                    }
                }
            }

            while (lastPosition < currentPosition)
            {
                lastPosition++;
                if (expressionEvaluator == null)
                {
                    expressionEvaluator = new ExpressionEvaluator(new CalculatedEvaluatorContextDescriptor(report.Parameters, this, dataContext), CriteriaOperator.TryParse(Expression));
                }
                AddSummaryValue(expressionEvaluator.Evaluate(listController.GetItem(lastPosition)), lastPosition);
            }

            return(GetCurrentSummaryResult());
        }
Пример #17
0
        private object GetImmediateModeSummary(XtraReport report)
        {
            report.AfterPrint -= report_AfterPrint;
            report.AfterPrint += report_AfterPrint;

            var dataContext = get_DataContext(report);

            if (expressionEvaluator == null)
            {
                isImmediateSummaryValid = false;
                expressionEvaluator     = new ExpressionEvaluator(new CalculatedEvaluatorContextDescriptor(report.Parameters, this, dataContext), CriteriaOperator.TryParse(Expression));
            }

            var isOverridingFilter = !string.IsNullOrWhiteSpace(OverrideFilter);

            if (isOverridingFilter && overrideFilterEvaluator == null)
            {
                isImmediateSummaryValid = false;
                overrideFilterEvaluator = new ExpressionEvaluator(new CalculatedEvaluatorContextDescriptor(report.Parameters, this, dataContext), CriteriaOperator.TryParse(OverrideFilter));
            }


            reset(summary);

            var dg = GetCurrentDataGroup(dataContext, Running ?? report);

            if (isImmediateSummaryValid && !dg.Equals(lastDataGroupInfo))
            {
                isImmediateSummaryValid = false;
            }
            lastDataGroupInfo = dg;

            if (isImmediateSummaryValid)
            {
                return(immediateSummary);
            }

            if (dg != null)
            {
                if (dg.Value.DataSource != (DataSource ?? report.DataSource))
                {
                    throw new EndUserConfigurationException($"The running band on summary field {Name} does not have the same data Source as the summary field. Otherwise, it is not able to be correlated with the summary field.");
                }
                if (!DataMemberUtils.AreEqual(DataMember, dg.Value.DataMember) && (!DataMemberUtils.IsAncestor(dg.Value.DataMember, DataMember) || string.IsNullOrEmpty(dg.Value.DataMember)))
                {
                    throw new EndUserConfigurationException($"The running band on summary field {Name} must have the same data member or must be a parent data member. Otherwise, it is not able to be correlated with the summary field.");
                }

                var groupListBrowser = dg.Value.ListBrowser;
                var childBrowsers    = DataMemberUtils.GetChildBrowsers(dataContext, dg.Value.DataSource, dg.Value.DataMember, DataMember);

                var groupStart    = dg.Value.GroupRowInfo == null ? 0 : dg.Value.GroupRowInfo.ChildControllerRow;
                var groupRowCount = dg.Value.GroupRowInfo == null ? groupListBrowser.Count : dg.Value.GroupRowInfo.ChildControllerRowCount;

                if (isOverridingFilter)
                {
                    var originalBrowser        = childBrowsers.Length == 0 ? groupListBrowser : childBrowsers[childBrowsers.Length - 1];
                    var originalBrowserAsChild = originalBrowser as IRelatedDataBrowser;

                    var newListController = new CustomSortedListController();
                    newListController.SetList(originalBrowser.List);
                    var newBrowser = originalBrowserAsChild != null
                        ? (ListBrowser) new CustomRelatedListBrowser((DataBrowser)originalBrowserAsChild.Parent, originalBrowserAsChild.RelatedProperty, newListController, false)
                        : new CustomListBrowser(originalBrowser.DataSource, newListController, false);
                    ((IPropertiesContainer)newBrowser).SetCustomProperties(originalBrowser.GetItemProperties().OfType <CalculatedPropertyDescriptorBase>().Cast <PropertyDescriptor>().ToArray());
                    newListController.SetBrowser(newBrowser);

                    // Filter outside the list controller so that we can ascertain grouping for rows the override filter excludes
                    newListController.Initialize(
                        ((SortedListController)originalBrowser.ListController).GetOriginalGroupFields(),
                        ((SortedListController)originalBrowser.ListController).GetSortingSummary(),
                        null);

                    if (childBrowsers.Length == 0)
                    {
                        groupListBrowser = newBrowser;
                        if (dg.Value.GroupRowInfo != null)
                        {
                            var currentListSourceIndex    = ((SortedListController)originalBrowser.ListController).GetDataController().GetListSourceRowIndex(originalBrowser.Position);
                            var currentPositionNewBrowser = newListController.GetDataController().GetControllerRow(currentListSourceIndex);
                            var newGroupInfo = DataGroupingUtils.GetGroupInfo(newBrowser, dg.Value.GroupRowInfo.Level, currentPositionNewBrowser);
                            groupStart    = newGroupInfo.ChildControllerRow;
                            groupRowCount = newGroupInfo.ChildControllerRowCount;
                        }
                        else
                        {
                            groupStart    = 0;
                            groupRowCount = newBrowser.Count;
                        }
                    }
                    else
                    {
                        childBrowsers[childBrowsers.Length - 1] = (RelatedListBrowser)newBrowser;
                    }
                }

                if (childBrowsers.Length == 0)
                {
                    for (var i = 0; i < groupRowCount; i++)
                    {
                        var currentRow = groupListBrowser.GetRow(i + groupStart);
                        if (!isOverridingFilter || ConvertOverrideFilterResult(overrideFilterEvaluator.Evaluate(currentRow)))
                        {
                            addValue(summary, expressionEvaluator.Evaluate(currentRow), i);
                        }
                    }
                }
                else
                {
                    var state = dataContext.SaveState();
                    try
                    {
                        groupListBrowser.Position = groupStart;
                        var sampleIndex = 0;
                        foreach (var childBrowser in childBrowsers)
                        {
                            childBrowser.Position = 0;
                        }

                        while (true)
                        {
                            var currentIndex   = childBrowsers.Length - 1;
                            var currentBrowser = childBrowsers[currentIndex];
                            if (!isOverridingFilter || ConvertOverrideFilterResult(overrideFilterEvaluator.Evaluate(currentBrowser.Current)))
                            {
                                addValue(summary, expressionEvaluator.Evaluate(currentBrowser.Current), sampleIndex);
                            }
                            sampleIndex++;

                            while (currentIndex > 0 && currentBrowser.Position == currentBrowser.Count - 1)
                            {
                                currentBrowser.Position = 0;
                                currentIndex--;
                                currentBrowser = childBrowsers[currentIndex];
                            }

                            if (currentBrowser.Position == currentBrowser.Count - 1)
                            {
                                if (groupListBrowser.Position == groupStart + groupRowCount - 1)
                                {
                                    break;
                                }
                                groupListBrowser.Position++;
                            }
                            else
                            {
                                currentBrowser.Position++;
                            }
                        }
                    }
                    finally
                    {
                        dataContext.LoadState(state);
                    }
                }
            }

            immediateSummary        = get_ValuesInfo(summary).Cast <Pair <object, int> >().All(p => p.First == null) ? null : summary.GetResult();
            isImmediateSummaryValid = true;
            return(immediateSummary);
        }
Пример #18
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);
        }