示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static void TranslateDescription(Messaggio AMessage, CacheKeys AKey)
        {
            if ((AMessage != null) && (AKey != CacheKeys.NULL))
            {
                ListaDecodificaMessaggi FList = CacheManager <ListaDecodificaMessaggi> .get(AKey, VincoloType.FILESYSTEM);

                if (FList != null)
                {
                    ListaDecodificaMessaggi.ErroreRow FRow = FList.Errore.FindBycod(AMessage.Codice);

                    if (FRow != null)
                    {
                        AMessage.Descrizione = FRow.desc;
                        if (AMessage.IsVariable)
                        {
                            foreach (KeyValuePair <string, string[]> item in AMessage.Variabili)
                            {
                                if (item.Value != null)
                                {
                                    AMessage.Descrizione = AMessage.Descrizione.Replace("\\" + item.Key + "\\", string.Join("||", item.Value));
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string decodeMapperMessage(Messaggio msg)
        {
            string sRet = string.Empty;

            sRet = string.Format("Livello:{0}, Codice:{1}, la decodifica del messaggio è assente!", msg.Livello, msg.Codice);
            if (messaggi != CacheKeys.NULL)
            {
                ListaDecodificaMessaggi el =
                    CacheManager <ListaDecodificaMessaggi> .get(
                        messaggi, VincoloType.FILESYSTEM);

                ListaDecodificaMessaggi.ErroreRow _errorerow =
                    el.Errore.FindBycod(msg.Codice);


                if (_errorerow != null)
                {
                    sRet = _errorerow.desc;
                    if (msg.IsVariable)
                    {
                        foreach (KeyValuePair <string, string[]> item in msg.Variabili)
                        {
                            if (item.Value != null)
                            {
                                sRet = sRet.Replace("\\" + item.Key + "\\", string.Join("||", item.Value));
                            }
                            else
                            {
                                sRet = sRet.Replace("\\" + item.Key + "\\", "");
                            }
                        }
                    }
                }
            }
            return(sRet);
        }