Пример #1
0
        public void EmptyColumnBandViewSerializeTest()
        {
            var    view    = new AvrView(-1, "layoutName", -1);
            string viewXml = AvrViewSerializer.Serialize(view);

            Assert.IsNotNull(viewXml);

            var    bandSerializer = new EidssSerializer <AvrViewBand>();
            var    band           = new AvrViewBand();
            string bandXml        = bandSerializer.Serialize(band);

            Assert.IsNotNull(bandXml);

            var colSerializer = new EidssSerializer <AvrViewColumn>();
            var column        = new AvrViewColumn();

            column.FieldType = typeof(string);
            string columnXml = colSerializer.Serialize(column);

            Assert.IsNotNull(columnXml);

            AvrViewColumn newColumn = colSerializer.Deserialize(columnXml);

            Assert.AreEqual(column.FieldType, newColumn.FieldType);
        }
Пример #2
0
 public ColumnElement(AvrViewBand band)
 {
     this.uniquePath  = band.UniquePath;
     this.fullPath    = band.FullPath;
     this.displayText = band.DisplayText;
     this.info        = model.Resources.EidssMessages.Get("Band");
     this.isBand      = true;
 }
Пример #3
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 }
            //};
        }
Пример #4
0
 // create in grid(control) the children of current band
 // only here we set properties of grid(control) band
 private static void AddToGrid(AvrViewBand obj, MVCxGridViewColumnCollection Columns, PdfExportHelper pdfHelper)
 {
     Columns.AddBand(newband =>
     {
         newband.Name       = obj.UniquePath;
         newband.Caption    = obj.DisplayText;
         newband.Visible    = obj.IsVisible;
         newband.FixedStyle = obj.IsFreezed ? GridViewColumnFixedStyle.Left : GridViewColumnFixedStyle.None;
         newband.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
         obj.Bands.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(b => AddToGrid(b, newband.Columns, pdfHelper));
         obj.Columns.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(c => AddToGrid(c, newband.Columns, pdfHelper));
     });
 }
Пример #5
0
        public static ColumnElement SelectedColBandObject(this AvrView obj)
        {
            AvrViewColumn col = obj.GetColumnByOriginalName(obj.SelectedColBand);

            if (col != null)
            {
                return(new ColumnElement(col));
            }
            AvrViewBand band = obj.GetBandByOriginalName(obj.SelectedColBand);

            if (band != null)
            {
                return(new ColumnElement(band));
            }
            return(new ColumnElement());
        }