示例#1
0
        public static Message Get(string languageCode, Message.Enum enumBC)
        {
            Message result = null;
            Dictionary <Message.Enum, Message> dic = null;

            Message.LanguageEnum languageEnum = Message.GetLanguageEnum(languageCode);
            if (!dicMultiLanguage.TryGetValue(languageEnum, out dic))
            {
                lock (thisLock)
                {
                    dic    = new Dictionary <Message.Enum, Message>();
                    result = new Message(languageEnum, enumBC);
                    dic.Add(enumBC, result);
                }
                dicMultiLanguage.Add(languageEnum, dic);
            }
            else
            {
                if (!dic.TryGetValue(enumBC, out result))
                {
                    lock (thisLock)
                    {
                        result = new Message(languageEnum, enumBC);
                    }
                    dic.Add(enumBC, result);
                }
            }
            return(result);
        }
示例#2
0
        public static string GetMessage(Message.Enum MessageCaseEnum, params string[] extraMessage)
        {
            string result = "";

            try
            {
                Message MessageCase = Get(GetLang(), MessageCaseEnum);
                if (MessageCase != null)
                {
                    if (extraMessage != null && extraMessage.Length > 0)
                    {
                        result = String.Format(MessageCase.message, extraMessage);
                    }
                    else
                    {
                        result = MessageCase.message;
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error("Co exception khi SetParam co tham so phu.", ex);
            }
            return(result);
        }
示例#3
0
        private static string GetMessage(Message.Enum en, string languageCode)
        {
            languageCode = string.IsNullOrWhiteSpace(languageCode) ? Message.LanguageCode.VI : languageCode;
            Message message = DatabaseMessage.Get(languageCode, en);

            return(message != null ? message.message : null);
        }
示例#4
0
 public static void SetMessage(CommonParam param, Message.Enum en, params string[] extraMessage)
 {
     try
     {
         string message = GetMessage(en, param.LanguageCode);
         if (extraMessage != null && extraMessage.Length > 0)
         {
             message = String.Format(message, extraMessage);
         }
         AddMessage(param, message);
     }
     catch (Exception ex)
     {
         LogSystem.Error("Co exception khi SetParam co tham so phu.", ex);
     }
 }