错误码字典key类
Beispiel #1
0
        /// <summary>
        /// 查询指定错误码类和语言的错误码描述
        /// </summary>
        /// <param name="errNo">错误码</param>
        /// <param name="modelName">错误码模块名称</param>
        /// <param name="languageId">语种ID</param>
        /// <returns>ErrDes</returns>
        public string GetErrDesc(uint errNo, string modelName, int languageId)
        {
            string ErrDes = string.Format("{0,10:X}", errNo);

            if (null != errNoDesc && errNoDesc.Count > 0)
            {
                //log.Trace("try get err desc,The errNo:{0},the modelName:{1},the languageId:{2},the total error is:{3}", errNo, modelName, languageId, errNoDesc.Count);
                SmcErrKey errKey     = new SmcErrKey();
                string    tempErrDes = string.Empty;
                errKey.ErrNo      = Convert.ToInt32(errNo);
                errKey.Model      = modelName;
                errKey.LanguageId = languageId;
                if (errNoDesc.TryGetValue(errKey, out tempErrDes))
                {
                    ErrDes = tempErrDes.Replace("'", "\'");
                }
                //log.Trace("the err desc result is:{0}", ErrDes);
            }
            else
            {
                //log.Trace("The errDes is null!");
            }

            return(ErrDes);
        }
Beispiel #2
0
 /// <summary>
 /// 初始化res
 /// </summary>
 /// <param name="ErrDesc">错误列表</param>
 public void InitialRes(List <ErrNoDesc> ErrDesc)
 {
     if (null != ErrDesc && ErrDesc.Count != 0)
     {
         errNoDesc.Clear();
         //log.Trace("clear errDesc success!");
         foreach (ErrNoDesc errDesc in ErrDesc)
         {
             SmcErrKey errKey = new SmcErrKey();
             errKey.Model      = errDesc.Model;
             errKey.ErrNo      = errDesc.ErrNo;
             errKey.LanguageId = errDesc.Languageid;
             try
             {
                 //Link_
                 if (!errNoDesc.ContainsKey(errKey))
                 {
                     errNoDesc.Add(errKey, errDesc.ErrDesc);
                 }
             }
             catch (Exception)
             {
                 throw new Exception("Repeat to init smcErr key,the key is " + errKey.ErrNo + "!the smcErr desc is :" + errDesc.ErrDesc);
             }
         }
     }
     else
     {
         //log.Info("Init errDesc failed,the errdesc is null!");
     }
 }
Beispiel #3
0
        /// <summary>
        /// 判断两个是否相同
        /// </summary>
        /// <param name="obj">object</param>
        /// <returns>bool</returns>
        public override bool Equals(object obj)
        {
            bool result = false;

            if (null == obj)
            {
                return(false);
            }

            SmcErrKey errKey = obj as SmcErrKey;

            if (errKey != null)
            {
                if (errKey.ErrNo == this.ErrNo && errKey.LanguageId == this.LanguageId && errKey.Model == this.Model)
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// 查询指定错误码类和语言的错误码描述
        /// </summary>
        /// <param name="errNo">错误码</param>
        /// <param name="modelName">错误码模块名称</param>
        /// <param name="languageId">语种ID</param>
        /// <returns>ErrDes</returns>
        public string GetErrDesc(uint errNo, string modelName, int languageId)
        {
            string ErrDes = string.Format("{0,10:X}", errNo);
            if (null != errNoDesc && errNoDesc.Count>0)
            {
                //log.Trace("try get err desc,The errNo:{0},the modelName:{1},the languageId:{2},the total error is:{3}", errNo, modelName, languageId, errNoDesc.Count);
                SmcErrKey errKey = new SmcErrKey();
                string tempErrDes = string.Empty;
                errKey.ErrNo = Convert.ToInt32(errNo);
                errKey.Model = modelName;
                errKey.LanguageId = languageId;
                if (errNoDesc.TryGetValue(errKey, out tempErrDes))
                {
                    ErrDes = tempErrDes.Replace("'", "\'");
                }
                //log.Trace("the err desc result is:{0}", ErrDes);
            }
            else
            {
                //log.Trace("The errDes is null!");
            }

            return ErrDes;
        }
Beispiel #5
0
 /// <summary>
 /// 初始化res
 /// </summary>
 /// <param name="ErrDesc">错误列表</param>
 public void InitialRes(List<ErrNoDesc> ErrDesc)
 {
     if (null != ErrDesc && ErrDesc.Count != 0)
     {
         errNoDesc.Clear();
         //log.Trace("clear errDesc success!");
         foreach (ErrNoDesc errDesc in ErrDesc)
         {
             SmcErrKey errKey = new SmcErrKey();
             errKey.Model = errDesc.Model;
             errKey.ErrNo = errDesc.ErrNo;
             errKey.LanguageId = errDesc.Languageid;
             try
             {
                 //Link_
                 if (!errNoDesc.ContainsKey(errKey))
                 {
                     errNoDesc.Add(errKey, errDesc.ErrDesc);
                 }
             }
             catch (Exception)
             {
                 throw new Exception("Repeat to init smcErr key,the key is " + errKey.ErrNo + "!the smcErr desc is :" + errDesc.ErrDesc);
             }
         }
     }
     else
     {
         //log.Info("Init errDesc failed,the errdesc is null!");
     }
 }