예제 #1
0
        void initFilters(ISettings sInfoFilters)
        {
            _filters.Clear();
            if (sInfoFilters != null)
            {
                string[] filters = sInfoFilters.getAllSettings();
                foreach (string filter in filters)
                {
                    FilterInfo fInfo = new FilterInfo();
                    //
                    fInfo.type            = sInfoFilters.getStringAttr(filter, _attrFType);
                    fInfo.code            = filter;
                    fInfo.desc            = _environment.translate(sInfoFilters.getStringAttr(filter, _attrName));
                    fInfo.dataReference   = _environment.getRefFactory().get(sInfoFilters.getStringAttr(filter, _attrRef));
                    fInfo.valueColumns    = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsVal));
                    fInfo.showColumns     = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsShow));
                    fInfo.showColumnsDesc = _environment.translate(ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrRefColsShowDesc)));

                    fInfo.sqlPlaces     = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlPlace));
                    fInfo.sqlTables     = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlTable));
                    fInfo.sqlColumns    = ToolString.explodeGroupList(sInfoFilters.getStringAttr(filter, _attrSqlCols));
                    fInfo.sqlParameters = ToolString.explodeList(sInfoFilters.getStringAttr(filter, _attrSqlParams));;
                    fInfo.sqlParameter  = sInfoFilters.getStringAttr(filter, _attrSqlParam);
                    Type type = ToolType.parse(sInfoFilters.getStringAttr(filter, _attrSqlParamType));
                    fInfo.sqlParameterValue = sInfoFilters.getAttr(filter, _attrSqlParamValue, type, DBNull.Value);

                    fInfo.flagRequire = sInfoFilters.getBoolAttr(filter, _attrRequire);
                    fInfo.flagMulti   = sInfoFilters.getBoolAttr(filter, _attrMulti);
                    //
                    _filters.Add(new ImplFilter(_environment, this, fInfo));
                }
            }
        }
예제 #2
0
        public string formatlistarr(string[] vars)
        {
            if (vars.Length < 3)
            {
                throw new MyException.MyExceptionError(MessageCollection.T_MSG_ERROR_INVALID_ARGS_COUNT);
            }

            StringBuilder sb = new StringBuilder();


            string format_ = getVar(vars[0]).ToString();
            string arr_    = getVar(vars[1]).ToString();

            if (!string.IsNullOrEmpty(arr_))
            {
                string join_ = getVar(vars[2]).ToString();

                string[] typesTmp_ = ToolArray.sub <string>(vars, 3);
                Type[]   types_    = new Type[typesTmp_.Length];

                for (int i = 0; i < types_.Length; ++i)
                {
                    types_[i] = ToolType.parse(typesTmp_[i]);
                }


                string[][] values_ = ToolString.explodeGroupList(arr_);


                for (int x = 0; x < values_.Length; ++x)
                {
                    string[] itms  = values_[x];
                    object[] data_ = new object[itms.Length];

                    for (int i = 0; i < data_.Length; ++i)
                    {
                        Type type_ = i < types_.Length ? types_[i] : ToolTypeSet.helper.tString;

                        data_[i] = PARSE(itms[i], type_);
                    }

                    sb.Append(string.Format(format_, data_));
                    if (x < values_.Length - 1)
                    {
                        sb.Append(join_);
                    }
                }
            }

            return(sb.ToString());
        }
예제 #3
0
 public object parse(string value, Type type)
 {
     if (type == _typeSet.tString)
     {
         return(value);
     }
     else
     if (type == _typeSet.tDouble)
     {
         return(double.Parse(value, NumberStyles.Any, numberFormat));
     }
     else
     if (type == _typeSet.tDouble)
     {
         return(float.Parse(value, NumberStyles.Any, numberFormat));
     }
     else
     if (type == _typeSet.tShort)
     {
         return(short.Parse(value, NumberStyles.Any, numberFormat));
     }
     else
     if (type == _typeSet.tInt)
     {
         return(int.Parse(value, NumberStyles.Any, numberFormat));
     }
     else
     if (type == _typeSet.tBool)
     {
         return(BoolValue.parse(value));
     }
     else
     if (type == _typeSet.tDateTime)
     {
         return(DateTime.ParseExact(value, dateFormat.FullDateTimePattern, dateFormat));
     }
     else
     if (type == _typeSet.tType)
     {
         return(ToolType.parse(value));
     }
     else
     if (type == _typeSet.tObject)
     {
         return(value);
     }
     return(null);
 }
예제 #4
0
 public Type parseType(string value)
 {
     return(ToolType.parse(value));
 }