Beispiel #1
0
        public ActionResult AggregateColumnDlgSave([Bind] long layoutId, [Bind] string uniquePath, [Bind] string displayName, [Bind] long?cbAggregate, [Bind] int?Precision, [Bind] string cbSourceColumn, [Bind] string cbDenominator)
        //public ActionResult AggregateColumnDlgSave( long layoutId, string uniquePath, string displayName,
        //                                            string cbAggregate, string precision,
        //                                            string cbSourceColumn, string cbDenominator )
        {
            string error;
            var    viewModel = GetModelFromSession(layoutId, out error);

            if (viewModel == null)
            {
                return(new JsonResult
                {
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                    Data = new { result = "error", error = error }
                });
            }

            if (uniquePath == null)
            {
                uniquePath = viewModel.ViewHeader.SelectedColBand;
            }
            AvrViewColumn col = viewModel.ViewHeader.GetColumnByOriginalName(uniquePath);

            if (col != null)
            {
                col.DisplayText = displayName;
                if (col.IsAggregate)
                {
                    col.AggregateFunction     = bv.common.Core.Utils.ToNullableLong(cbAggregate);
                    col.Precision             = bv.common.Core.Utils.ToNullableInt(Precision);
                    col.SourceViewColumn      = cbSourceColumn;
                    col.DenominatorViewColumn = cbDenominator;

                    AggregateCasheWeb.FillAggregateColumn(viewModel.ViewData, col, viewModel.ViewHeader.GetSortExpression());
                }
            }
            else
            {
                AvrViewBand band = viewModel.ViewHeader.GetBandByOriginalName(uniquePath);
                if (band != null)
                {
                    band.DisplayText = displayName;
                }
            }

            viewModel.ViewHeader.GridViewSettings = null;
            ViewBag.LayoutId = layoutId;
            return(RedirectToAction("ViewLayout", new { layoutId = layoutId }));
            //return new JsonResult
            //{
            //    JsonRequestBehavior = JsonRequestBehavior.AllowGet,
            //    Data = new { result = "refresh", function = "ViewLayout?layoutId=" + layoutId }
            //};
        }
Beispiel #2
0
        private AvrPivotViewModel AdjustToNew(long layoutId, AvrView view, AvrPivotViewModel model)
        {
            view.SetOrders();
            view.AdjustToNew(model.ViewHeader);
            view.SetColumnsTypes(model.ViewData);

            view.GetAggregateColumnsList().ForEach(c => AggregateCasheWeb.FillAggregateColumn(model.ViewData, c, view.GetSortExpression()));

            var modelView = new AvrPivotViewModel(view, model.ViewData);

            ObjectStorage.Put(Session.SessionID, layoutId, layoutId, StoragePrefix, modelView);
            return(modelView);
        }