Esempio n. 1
0
        public void AddColumn(ReportColumn c)
        {
            _columns.Add(c);

            if (c.Type != null)
            {
                _cols.Add(c.Source, c.Type);
            }
        }
        private static string AttrFor(
         DataColumn dc, 
         ReportColumn.ColourDelegateFromRole bgColour, 
         string theValue)
        {
            var sAttr = "";
             if (dc != null)
             {
            if (dc.DataType == Type.GetType("System.Decimal") ||
                dc.DataType == Type.GetType("System.Int32"))
               sAttr = "ALIGN='RIGHT'";
            if (dc.DataType != null && dc.DataType == Type.GetType("System.String"))
               sAttr = "ALIGN='CENTER'";

            if (bgColour != null)
            {
               if ((!string.IsNullOrEmpty(theValue)))
                  sAttr += " BGCOLOR=" + bgColour(theValue);
            }
             }
             return sAttr + " VALIGN='TOP'";
        }
        private static string AttrFor(
         DataColumn dc, 
         ReportColumn.ColourDelegate bgColour, 
         string theValue)
        {
            var sAttr = "";
             if (dc != null)
             {
            if (dc.DataType == Type.GetType("System.Decimal") ||
                dc.DataType == Type.GetType("System.Int32"))
               sAttr = "ALIGN='RIGHT'";
               //sAttr = "class='num'";
            if (dc.DataType != null && dc.DataType == Type.GetType("System.String"))
               sAttr = "ALIGN='CENTER'";

            if (bgColour != null)
            {
               if ( ( !string.IsNullOrEmpty( theValue ) ) )
               {
                  //  look for data with a colon in it (we only need to use the number)
                  var numberSpot = theValue.IndexOf(":", StringComparison.Ordinal);
                  if ( numberSpot > -1 )
                  {
                     var numberPart = theValue.Substring( 0, numberSpot );
                     if (numberPart.Equals( "-" ))
                        numberPart = theValue.Substring( 0, 2 );
                     if ( !string.IsNullOrEmpty( numberPart ) )
                        if (!numberPart.Equals( ":" ))
                           sAttr += " BGCOLOR=" + bgColour( Int32.Parse( numberPart ) );
                  }
                  else
                     sAttr += " BGCOLOR=" + bgColour( (int) Decimal.Parse( theValue ) );
               }
            }
             }
             return sAttr + " VALIGN='TOP'";
        }
        public void AddColumn(ReportColumn c)
        {
            _columns.Add(c);

             if (c.Type != null)
            _cols.Add(c.Source, c.Type);
        }