Exemple #1
0
        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());
        }
Exemple #2
0
        public virtual int Compare(object o1, object o2)
        {
            Row row  = (Row)o1;
            Row row2 = (Row)o2;
            int num  = ConvertTool.compare(row.evaluate(this.expParse_0), row2.evaluate(this.expParse_0));

            if (this.bool_0)
            {
                num = -num;
            }
            return(num);
        }
Exemple #3
0
        public virtual void calcProperties()
        {
            ShortMap propEngMap = ExpMap.PropEngMap;

            if (propEngMap != null)
            {
                if (row != null)
                {
                    row.DataSet.CurrentRow = row;
                }
                for (int i = 0; i < propEngMap.size(); i++)
                {
                    short key = propEngMap.getKey(i);
                    if ((key != 304) && (key != 305))
                    {
                        var expInfo = (ExpParseInfo)propEngMap.getValue(i);
                        setPropResult(key, ConvertTool.getSingleValue(expInfo.Exp.calculate()));
                    }
                }
            }
        }
Exemple #4
0
 public virtual void calculate()
 {
     if (((ExpMap != null) && (ExpMap.Exp != null)) && (object_1 == originObject))
     {
         //if (prevCell != null)
         //{
         //    prevCell.testValue();
         //}
         //if (nextCell != null)
         //{
         //    nextCell.testValue();
         //}
         fetchRow();
         object obj2       = ExpMap.Exp.calculate();
         int    extensible = Extensible;
         if ((ExpMap.PropGetMap == null) || !PropertyDefine.CDT_SUBREPORT.Equals(ExpMap.PropGetMap[PropertyDefine.GRID_DATA_TYPE /*301*/]))
         {
             if (PropertyDefine.CEX_VERTICAL != extensible && PropertyDefine.CEX_HORIZONTAL != extensible)
             {
                 setPropResult(PropertyDefine.GRID_DISPLAY_VALUE /*305*/, getDisplayValue(obj2));
                 object_1 = ConvertTool.getValue(obj2);
                 if (obj2 is Row)
                 {
                     row = (Row)obj2;
                 }
             }
             else if (!(obj2 is ArrayList))
             {
                 object_1 = ConvertTool.getValue(obj2);
                 setPropResult(PropertyDefine.GRID_DISPLAY_VALUE /*305*/, getDisplayValue(obj2));
                 ExtCells = new CellExt[] { this };
                 if (obj2 is Row)
                 {
                     row = (Row)obj2;
                 }
                 else if (obj2 is Group)
                 {
                     @group = (Group)obj2;
                     if (@group.RowCount > 0)
                     {
                         row = @group.getRow(0);
                     }
                 }
             }
             else
             {
                 ArrayList list  = (ArrayList)obj2;
                 int       count = list.Count;
                 if (count != 0)
                 {
                     object[] objArray2 = new object[count];
                     object[] objArray  = new object[count];
                     for (int i = 0; i < count; i++)
                     {
                         object o = list[i];
                         objArray2[i] = ConvertTool.getValue(o);
                         objArray[i]  = getDisplayValue(o);
                     }
                     if (PropertyDefine.CEX_VERTICAL.Equals(extensible))
                     {
                         CellSet.extendRow(this, count);
                     }
                     else
                     {
                         CellSet.extendCol(this, count);
                     }
                     for (int j = 0; j < count; j++)
                     {
                         ExtCells[j].object_1 = objArray2[j];
                         if (objArray[j] != null)
                         {
                             ExtCells[j].setPropResult(PropertyDefine.GRID_DISPLAY_VALUE /*305*/, objArray[j]);
                             ExtCells[j].setPropValue(PropertyDefine.GRID_DISPLAY_VALUE /*305*/, objArray[j]);
                         }
                         object obj3 = list[j];
                         if (obj3 is Row)
                         {
                             ExtCells[j].row = (Row)obj3;
                         }
                         else if (obj3 is Group)
                         {
                             Group group = (Group)obj3;
                             ExtCells[j].@group = group;
                             if (group.RowCount > 0)
                             {
                                 ExtCells[j].row = group.getRow(0);
                             }
                         }
                     }
                 }
                 else
                 {
                     object_1 = null;
                 }
             }
         }
         else
         {
             CellExt1 subRpt = (CellExt1)obj2;
             if (subRpt.SubRptType != CellExt1.SRT_IMPORT)
             {
                 object_1 = obj2;
             }
             else
             {
                 new Class6(CellSet, this, subRpt).vmethod_0();
             }
         }
     }
 }
Exemple #5
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);
     }
 }
Exemple #6
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);
        }
Exemple #7
0
        protected internal virtual Unit createNode()
        {
            char ch  = this.string_0[this.int_0];
            int  num = -1;

            switch (ch)
            {
            case '"':
            case '\'':
            {
                num = ExpString.scanQuotation(this.string_0, this.int_0);
                if (num == -1)
                {
                    throw new ReportError("引号不匹配");
                }
                string str3 = this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1));
                this.int_0 = num + 1;
                return(new Constant(str3));
            }
            }
            if ((this.cellExt1_0 != null) && (ch == '{'))
            {
                num = ExpString.scanBrace(this.string_0, this.int_0);
                if (num == -1)
                {
                    throw new ReportError("大括号不匹配");
                }
                FunctionUnit unit7 = LoadFunction.newFunction("select", this.env_0, this.cellExt1_0, this.dataSet_0);
                unit7.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1)));
                this.int_0 = num + 1;
                return(unit7);
            }
            if ((this.cellExt1_0 != null) && (ch == '['))
            {
                FunctionUnit unit6;
                num = ExpString.scanBracket(this.string_0, this.int_0);
                if (num == -1)
                {
                    throw new ReportError("中括号不匹配");
                }
                if ((this.unit_1 != null) && !this.unit_1.Operator)
                {
                    if (this.unit_1 is CSVar)
                    {
                        unit6 = LoadFunction.newFunction("move", this.env_0, this.cellExt1_0, this.dataSet_0);
                        unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1)));
                    }
                    else
                    {
                        unit6 = LoadFunction.newFunction("offset", this.env_0, this.cellExt1_0, this.dataSet_0);
                        unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1)));
                    }
                }
                else
                {
                    unit6 = LoadFunction.newFunction("list", this.env_0, this.cellExt1_0, this.dataSet_0);
                    unit6.setParameter(this.string_0.Substring(this.int_0 + 1, num - (this.int_0 + 1)));
                }
                this.int_0 = num + 1;
                return(unit6);
            }
            string id = this.scanId();

            if (id.ToUpper().Equals("and".ToUpper()))
            {
                return(new And());
            }
            if (id.ToUpper().Equals("or".ToUpper()))
            {
                return(new Or());
            }
            if (id.ToUpper().Equals("not".ToUpper()))
            {
                return(new Not());
            }
            if (id.ToUpper().Equals("in".ToUpper()))
            {
                return(new In());
            }
            if (id.ToUpper().Equals("to".ToUpper()))
            {
                return(new To());
            }
            if (id.ToUpper().Equals("like".ToUpper()))
            {
                return(new Like());
            }
            DataSet ds    = this.dataSet_0;
            int     index = id.IndexOf('.');

            if ((index > 0) && !char.IsDigit(id[0]))
            {
                string str2 = id.Substring(0, index);
                if (this.env_0.isDataSetName(str2))
                {
                    ds = this.env_0.getDataSet(str2);
                    id = id.Substring(index + 1);
                    Unit unit5 = this.createDSNode(ds, id, true);
                    if (unit5 == null)
                    {
                        throw new ReportError("有不可识别的数据集函数" + id.ToString().ToString());
                    }
                    return(unit5);
                }
            }
            if (this.dataSet_0 != null)
            {
                Unit unit4 = this.createDSNode(this.dataSet_0, id, true);
                if (unit4 != null)
                {
                    return(unit4);
                }
            }
            if (this.unit_1 is DSMember)
            {
                Unit unit3 = this.createDSNode(this.dataSet_0, id, false);
                if (unit3 != null)
                {
                    return(unit3);
                }
            }
            bool isSaved = false;

            if (id[0] != '@')
            {
                if (id[0] == '$')
                {
                    id      = id.Substring(1);
                    isSaved = true;
                }
            }
            else
            {
                id = id.Substring(1);
            }
            if ((this.cellExt1_0 != null) && id.ToUpper().Equals("value".ToUpper()))
            {
                return(new CSCurrent(this.cellExt1_0));
            }
            if (this.env_0.isParamName(id))
            {
                return(new Constant(this.env_0.getParam(id)));
            }
            if ((this.cellExt1_0 != null) && this.cellExt1_0.isSource(id.ToLower()))
            {
                id = id.ToLower();
                if (this.cellExt1_0.getSource(id) != null)
                {
                    return(new CSVar(this.cellExt1_0.getSource(id), isSaved));
                }
                return(new CSVar(this.cellExt1_0, id));
            }
            if (!this.Boolean_0)
            {
                return(new Constant(ConvertTool.parse(id)));
            }
            if (!LoadFunction.isFunName(id))
            {
                throw new ReportError("未知的函数" + id.ToString().ToString());
            }
            FunctionUnit unit2 = LoadFunction.newFunction(id, this.env_0, this.cellExt1_0, this.dataSet_0);

            unit2.setParameter(this.scanParameter());
            return(unit2);
        }