/// <summary> /// Get Translation /// </summary> /// <param name="AD_Language">language</param> /// <returns>trl</returns> private MMailTextTrl GetTranslation(String AD_Language) { MMailTextTrl trl = null; String sql = "SELECT * FROM R_MailText_Trl WHERE R_MailText_ID=@textid AND AD_Language=@lang"; IDataReader dr = null; try { SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@textid", GetR_MailText_ID()); param[1] = new SqlParameter("@lang", AD_Language); dr = DataBase.DB.ExecuteReader(sql, param); if (dr.Read()) { trl = new MMailTextTrl(); trl.AD_Language = dr["AD_Language"].ToString(); trl.mailHeader = dr["MailHeader"].ToString(); trl.mailText = dr["MailText"].ToString(); trl.mailText2 = dr["MailText2"].ToString(); trl.mailText3 = dr["MailText3"].ToString(); } dr.Close(); } catch (Exception e) { if (dr != null) { dr.Close(); } log.Log(Level.SEVERE, sql, e); } return(trl); }
/// <summary> /// Translate to BPartner Language /// </summary> private void Translate() { if (_bpartner != null && _bpartner.GetAD_Language() != null) { String key = _bpartner.GetAD_Language() + Get_ID(); MMailTextTrl trl = cacheTrl[key]; if (trl == null) { trl = GetTranslation(_bpartner.GetAD_Language()); if (trl != null) { cacheTrl.Add(key, trl); } } if (trl != null) { _mailHeader = trl.mailHeader; _mailText = trl.mailText; _mailText2 = trl.mailText2; _mailText3 = trl.mailText3; } } // No Translation _mailHeader = base.GetMailHeader(); _mailText = base.GetMailText(); _mailText2 = base.GetMailText2(); _mailText3 = base.GetMailText3(); }
/// <summary> /// Translate to BPartner Language /// </summary> private void Translate() { string language = ""; if (_bpartner != null && _bpartner.GetAD_Language() != null) { language = _bpartner.GetAD_Language(); } else if (!Env.IsBaseLanguage(GetCtx().GetAD_Language(), "")) { language = GetCtx().GetAD_Language(); } if (!string.IsNullOrEmpty(language) && language.Length > 0) { String key = language + Get_ID(); MMailTextTrl trl = cacheTrl[key]; if (trl == null) { trl = GetTranslation(language); if (trl != null) { cacheTrl.Add(key, trl); } } if (trl != null) { _mailHeader = trl.mailHeader; _mailText = trl.mailText; _mailText2 = trl.mailText2; _mailText3 = trl.mailText3; return; } } // No Translation _mailHeader = base.GetMailHeader(); _mailText = base.GetMailText(); _mailText2 = base.GetMailText2(); _mailText3 = base.GetMailText3(); }