예제 #1
0
파일: ConvertTool.cs 프로젝트: ikvm/test
        public static string format(object o, string format)
        {
            if (o is DateTime)
            {
                DateTime time = (DateTime)o;
                return(time.ToString(format));
            }
            if (isNumber(o))
            {
                if (o is double)
                {
                    double num8 = (double)o;
                    return(num8.ToString(format));
                }
                if (o is int)
                {
                    int num7 = (int)o;
                    return(num7.ToString(format));
                }
                if (o is short)
                {
                    short num6 = (short)o;
                    return(num6.ToString(format));
                }
                if (o is float)
                {
                    float num5 = (float)o;
                    return(num5.ToString(format));
                }
                if (o is long)
                {
                    long num4 = (long)o;
                    return(num4.ToString(format));
                }
                if (o is decimal)
                {
                    decimal num3 = (decimal)o;
                    return(num3.ToString(format));
                }
            }
            if (!(o is ArrayList))
            {
                return(toString(o));
            }
            ArrayList     list    = (ArrayList)o;
            StringBuilder builder = new StringBuilder();
            int           num     = 0;
            int           num2    = list.Count;

            while (num < num2)
            {
                if (num > 0)
                {
                    builder.Append(',');
                }
                builder.Append(ConvertTool.format(list[num], format));
                num++;
            }
            return(builder.ToString());
        }
예제 #2
0
 public virtual void prepareCalculate()
 {
     try
     {
         int_4 = 0;
         if (ExpMap.ExpStr != null)
         {
             if (!PropertyDefine.CEX_DEFAULT.Equals(Extensible))
             {
                 ExpMap.Exp = new ExpParse(CellSet, ExpMap.ExpStr);
                 // bool flag1 = !PropertyDefine.CEX_HORIZONTAL.Equals(Extensible) ? PropertyDefine.CEX_VERTICAL.Equals(Extensible) : true;
             }
             else
             {
                 ExpMap.Exp = new ExpParse(CellSet, ExpMap.ExpStr, true);
                 CellExt ext = CellSet.getCell(0, 0);
                 if (ExpMap.Exp.Extended)
                 {
                     if ((prevCell == ext) && (nextCell != ext))
                     {
                         Extensible = PropertyDefine.CEX_HORIZONTAL;
                     }
                     else if ((prevCell != ext) && (nextCell != ext))
                     {
                         Extensible = PropertyDefine.CEX_NONE;
                     }
                     else
                     {
                         Extensible = PropertyDefine.CEX_VERTICAL;
                     }
                 }
             }
             object_1 = originObject;
         }
         else
         {
             ShortMap propGetMap = ExpMap.PropGetMap;
             if (propGetMap != null)
             {
                 object_1 = propGetMap[302];
                 object obj2 = propGetMap[301];
                 if (((object_1 != null) && ((obj2 == null) || obj2.Equals(PropertyDefine.CDT_TEXT))) && (object_1 is string))
                 {
                     object_1 = ConvertTool.parse((string)object_1, false);
                     if (propGetMap[305] == null)
                     {
                         //string s = (string) propGetMap[304];
                         //if (!StringUtils.isSpaceString(s))
                         //{
                         propGetMap.put(305, ConvertTool.format(object_1, "{0}"));//s));
                         //}
                     }
                 }
             }
         }
         ShortMap propEngMap = ExpMap.PropEngMap;
         if (propEngMap != null)
         {
             for (int i = 0; i < propEngMap.size(); i++)
             {
                 ExpParseInfo expInfo = (ExpParseInfo)propEngMap.getValue(i);
                 expInfo.Exp = new ExpParse(CellSet, expInfo.ExpStr);
             }
         }
     }
     catch (ReportError error)
     {
         error.CellId = SourceId;
         throw error;
     }
     catch (Exception exception)
     {
         throw new ReportError(new StringBuilder("单元格").Append(SourceId).Append("中有错误,").Append(exception.Message).ToString().ToString(), exception);
     }
 }
예제 #3
0
        private string getDisplayValue(object object_2)
        {
            string str = null;

            if (ExpMap.PropGetMap != null)
            {
                str = (string)ExpMap.PropGetMap[PropertyDefine.GRID_DISPLAY_VALUE /*305*/];
                if (str != null)
                {
                    return(str);
                }
                object obj4 = ExpMap.PropGetMap[PropertyDefine.GRID_DATA_TYPE /*301*/];
                if ((obj4 != null) && !PropertyDefine.CDT_TEXT.Equals(obj4))
                {
                    return(null);
                }
            }
            string s      = null;
            object obj3   = object_1;
            Group  group1 = this.@group;
            Row    row    = this.row;

            try
            {
                object_1 = ConvertTool.getValue(object_2);
                if (object_2 is Group)
                {
                    this.@group = (Group)object_2;
                }
                if (object_2 is Row)
                {
                    this.row = (Row)object_2;
                }
                if (this.@group != null)
                {
                    [email protected] = this.@group;
                }
                if (this.row != null)
                {
                    this.row.DataSet.CurrentRow = this.row;
                }
                if (ExpMap.PropEngMap != null)
                {
                    var expInfo = (ExpParseInfo)ExpMap.PropEngMap[PropertyDefine.GRID_DISPLAY_VALUE /*305*/];
                    if (expInfo != null)
                    {
                        object_1 = ConvertTool.getSingleValue(expInfo.Exp.calculate());
                    }
                    expInfo = (ExpParseInfo)ExpMap.PropEngMap[PropertyDefine.GRID_DISPLAY_STYLE /*304*/];
                    if (expInfo != null)
                    {
                        object obj2 = ConvertTool.getSingleValue(expInfo.Exp.calculate());
                        if (obj2 is string)
                        {
                            s = (string)obj2;
                        }
                    }
                }
                if ((s == null) && (ExpMap.PropGetMap != null))
                {
                    s = (string)ExpMap.PropGetMap[PropertyDefine.GRID_DISPLAY_STYLE /*304*/];
                }
                if (!StringUtils.isSpaceString(s))
                {
                    return(ConvertTool.format(object_1, s));
                }
                if (!(object_1 is sbyte[]))
                {
                    str = ConvertTool.toString(object_1);
                }
            }
            finally
            {
                object_1    = obj3;
                this.@group = group1;
                this.row    = row;
            }
            return(str);
        }