Exemplo n.º 1
0
 private bool ExpressionSumContains(Cell cell, string mapname)
 {
     if (cell is ICalculateColumn)
     {
         string   expression  = (cell as ICalculateColumn).Expression;
         string[] expressions = ExpressionService.SplitExpression(expression);
         foreach (string e in expressions)
         {
             if (e.Trim().ToLower() == mapname.ToLower())
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        public void AddColumn(IMapName map)
        {
            if (!(map is IDataSource) && !_datasources.Contains(map.MapName.Trim()))
            {
                DataType dt = DataType.String;
                if (map is IDecimal)
                {
                    dt = DataType.Decimal;
                }
                else if (map is IDateTime || ((map is IBDateTime) && (map as IBDateTime).bDateTime))
                {
                    dt = DataType.DateTime;
                }
                else if (map is ICalculateColumn && !ExpressionService.bExpressionReallyNotADecimalType((map as ICalculateColumn).Expression, this.DataSources))
                {
                    dt = DataType.Decimal;
                }

                //DataSource ds = new DataSource(map.MapName.Trim(), dt);
                //ds.bAppend  = true;
                //if (map is ICalculateColumn && map.MapName.ToLower() != (map as ICalculateColumn).Expression.ToLower())
                //    ds.Tag = (map as ICalculateColumn).Expression;
                //_datasources.Add(ds);
                if (!(map is ICalculateColumn) || map.MapName.ToLower() != (map as ICalculateColumn).Expression.ToLower())
                {
                    DataSource ds = new DataSource(map.MapName.Trim(), dt);
                    ds.bAppend = true;
                    if (map is ICalculateColumn && map.MapName.ToLower() != (map as ICalculateColumn).Expression.ToLower())
                    {
                        ds.Tag = (map as ICalculateColumn).Expression;
                        if (ds.Tag.Contains(@"/"))
                        {
                            ds.Tag = "isnull(" + ds.Tag + ",0)";
                        }
                    }
                    _datasources.Add(ds);
                }
            }
        }