コード例 #1
0
ファイル: ExhibitVmProcess.cs プロジェクト: Joffpa/iBars
 private static void SetGridAttribsFromRowAttribs(GridVm grid, Attributes rowAttrib)
 {
     grid.HasSelectCol = (rowAttrib.CanSelect ?? false) || grid.HasSelectCol;
     grid.HasCollapseCol = (rowAttrib.CanCollapse ?? false) || grid.HasCollapseCol;
     grid.HasAddCol = (rowAttrib.CanAdd ?? false) || grid.HasAddCol;
     grid.HasDeleteCol = (rowAttrib.CanDelete ?? false) || grid.HasDeleteCol;
 }
コード例 #2
0
ファイル: ExhibitVmProcess.cs プロジェクト: Joffpa/iBars
 private static RowVm BuildRowVmFromAttributes(Attributes attrib, List<UspGetRowRelationship_Result> relations)
 {
     //NOTE: We do not append template rows here, as the template rows may not have been built at this point.
     //Template Rows are added later in the GetGridVmForUi method
     var uiParentRelation = relations.FirstOrDefault(r => r.ChRowCode == attrib.RowCode && IsCollapseAndSumChildrenToParentRelationContext(r));
     return new RowVm()
     {
         GridCode = attrib.GridCode,
         RowCode = attrib.RowCode,
         Type = attrib.Type,
         CanSelect = attrib.CanSelect ?? false,
         CanCollapse = attrib.CanCollapse ?? false,
         CanAdd = attrib.CanAdd ?? false,
         CanDelete = attrib.CanDelete ?? false,
         Cells = new List<CellVm>(),
         Class = GetRowClassByType(attrib.Type),
         DisplayOrder = attrib.DisplayOrder ?? 0,
         IsSelected = false,
         IsCollapsed = false,
         ChildrenAreCollapsed = false,
         //IsHidden = attrib.IsHidden ?? false,  //todo: DisplayInCycle
         IsHidden = attrib.DisplayInCycle == "None",
         IsEditable = attrib.IsEditable ?? false,
         ParentRowCode = uiParentRelation != null ? uiParentRelation.ParRowCode : null,
         ChildRowCodes = relations.Where(r => r.ParRowCode == attrib.RowCode && IsCollapseAndSumChildrenToParentRelationContext(r)).Select(r => r.ChRowCode).ToList()
     };
 }
コード例 #3
0
ファイル: ExhibitVmProcess.cs プロジェクト: Joffpa/iBars
 private static CellVm BuildCellVmFromAttributes(GridVm grid, RowVm row, ColumnVm col, Attributes cellAttrib)
 {
     var overrideColSettings = cellAttrib.OverrideColSettings ?? false;
     var cellType = overrideColSettings ? cellAttrib.Type            : col.Type;
     var decimals = overrideColSettings ? cellAttrib.DecimalPlaces   : col.DecimalPlaces;
     var maxChars = overrideColSettings ? cellAttrib.MaxChars        : col.MaxChars;
     var cellVal = cellAttrib.Value;
     var textColor = "";
     if (row.Type != Literals.Attribute.RowType.Blank && (IsNumericOrPercentType(cellType)))
     {
         double parsedNum;
         var parsed = double.TryParse(cellAttrib.Value, out parsedNum);
         if (parsed)
         {
             cellVal = String.Format("{0:n" + decimals + "}", parsedNum);
             //if (parsedNum < 0) textColor = "red";
         }
     }
     if (!string.IsNullOrEmpty(cellAttrib.HoverBase)) textColor = "green";
     if (!string.IsNullOrEmpty(cellAttrib.HoverAddition))
     {
         double parsedHoverAddition;
         var parsed = double.TryParse(cellAttrib.HoverAddition, out parsedHoverAddition);
         if (parsed && parsedHoverAddition != 0)
         {
             textColor = "red";
         }
     }
     //var valParsed = double.TryParse(cellVal, out numval);
     var span = cellAttrib.ColSpan ?? col.ColSpan;
     return new CellVm()
     {
         GridCode = grid.GridCode,
         RowCode = row.RowCode,
         ColCode = col.ColCode,
         Type = cellType,
         MaxChars = maxChars,
         DecimalPlaces = decimals,
         ColSpan = GetCellSpan(grid, row, col, cellAttrib.ColSpan),
         ColumnHeader = col.DisplayText,
         Indent = cellAttrib.Indent ?? 0,
         IsEditable = (cellAttrib.IsEditable ?? false) && row.IsEditable && col.IsEditable && grid.IsEditable,
         //IsHidden = cellAttrib.IsHidden ?? false,  //todo: DisplayInCycle
         IsHidden = cellAttrib.DisplayInCycle == "None",
         Value = cellVal,
         //NumValue = valParsed ? numval : 0,
         Width = (span == 1 ? col.Width : "100%"),
         Alignment = cellAttrib.Alignment ?? "right",
         HoverBase = cellAttrib.HoverBase,
         HoverAddition = cellAttrib.HoverAddition,
         TextColor = textColor,
         Calcs = null
     };
 }
コード例 #4
0
ファイル: ExhibitVmProcess.cs プロジェクト: Joffpa/iBars
 private static ColumnVm BuildColVmFromAttributes(Attributes attrib)
 {
     return new ColumnVm()
     {
         ColCode = attrib.ColCode,
         ColSpan = attrib.ColSpan ?? 1,
         Type = attrib.Type,
         MaxChars = attrib.MaxChars,
         DecimalPlaces = attrib.DecimalPlaces,
         DisplayOrder = attrib.DisplayOrder ?? new decimal(1.0),
         DisplayText = attrib.DisplayText,
         HasHeader = attrib.HasHeader ?? true,
         // IsHidden = attrib.IsHidden ?? false, //todo: DisplayInCycle
         IsHidden = attrib.DisplayInCycle == "None",
         Level = attrib.Level ?? 0,
         Width = attrib.Width,
         IsEditable = attrib.IsEditable ?? false,
         Alignment = attrib.Alignment,
         Cells = new List<CellVm>()
     };
 }