Exemplo n.º 1
0
        public EcasParameter(string strName, EcasValueType t, EcasEnum eEnumValues)
        {
            if(strName == null) throw new ArgumentNullException("strName");

            m_strName = strName;
            m_type = t;
            m_vEnumValues = eEnumValues;
        }
Exemplo n.º 2
0
        public EcasParameter(string strName, EcasValueType t, EcasEnum eEnumValues)
        {
            if (strName == null)
            {
                throw new ArgumentNullException("strName");
            }

            m_strName     = strName;
            m_type        = t;
            m_vEnumValues = eEnumValues;
        }
Exemplo n.º 3
0
        public static string ParametersToString(IEcasObject ecasObj,
                                                EcasParameter[] vParamInfo)
        {
            if (ecasObj == null)
            {
                throw new ArgumentNullException("ecasObj");
            }
            if (ecasObj.Parameters == null)
            {
                throw new ArgumentException();
            }

            bool bParamInfoValid = true;

            if ((vParamInfo == null) || (ecasObj.Parameters.Count > vParamInfo.Length))
            {
                Debug.Assert(false);
                bParamInfoValid = false;
            }

            StringBuilder sb = new StringBuilder();

            EcasCondition eCond = (ecasObj as EcasCondition);

            if (eCond != null)
            {
                if (eCond.Negate)
                {
                    sb.Append(KPRes.Not);
                }
            }

            for (int i = 0; i < ecasObj.Parameters.Count; ++i)
            {
                string strParam = ecasObj.Parameters[i];
                string strAppend;

                if (bParamInfoValid)
                {
                    EcasValueType t = vParamInfo[i].Type;
                    if (t == EcasValueType.String)
                    {
                        strAppend = strParam;
                    }
                    else if (t == EcasValueType.Bool)
                    {
                        strAppend = (StrUtil.StringToBool(strParam) ? KPRes.Yes : KPRes.No);
                    }
                    else if (t == EcasValueType.EnumStrings)
                    {
                        uint uEnumID;
                        if (uint.TryParse(strParam, out uEnumID) == false)
                        {
                            Debug.Assert(false);
                        }
                        EcasEnum ee = vParamInfo[i].EnumValues;
                        if (ee != null)
                        {
                            strAppend = ee.GetItemString(uEnumID, string.Empty);
                        }
                        else
                        {
                            Debug.Assert(false); strAppend = strParam;
                        }
                    }
                    else if (t == EcasValueType.Int64)
                    {
                        strAppend = FilterTypeI64(strParam);
                    }
                    else if (t == EcasValueType.UInt64)
                    {
                        strAppend = FilterTypeU64(strParam);
                    }
                    else
                    {
                        Debug.Assert(false); strAppend = strParam;
                    }
                }
                else
                {
                    strAppend = strParam;
                }

                if (string.IsNullOrEmpty(strAppend))
                {
                    continue;
                }
                string strAppTrimmed = strAppend.Trim();
                if (strAppTrimmed.Length == 0)
                {
                    continue;
                }
                if (sb.Length > 0)
                {
                    sb.Append(", ");
                }
                sb.Append(strAppTrimmed);
            }

            return(sb.ToString());
        }