private static string GetTextByAnnex(Annex annex, AnnexTextType textType) { if (annex != null) { if (textType == AnnexTextType.DisplayName) { return(annex.DisplayName); } else if (textType == AnnexTextType.Description) { return(annex.Description); } else if (textType == AnnexTextType.Body) { return(annex.Body); } else if (textType == AnnexTextType.Remark) { return(annex.Remark); } else if (textType == AnnexTextType.Remark1) { return(annex.Remark1); } else if (textType == AnnexTextType.Remark2) { return(annex.Remark2); } else if (textType == AnnexTextType.Other) { return(annex.Other); } } return(string.Empty); }
private static string GetAnnexText(bool supportMultiLangs, AnnexTextType annexTextType, string className, string ctrlName, List <Annex> annexes, string defText) { if (supportMultiLangs) { var text = AnnexHelper.GetText(className, ctrlName, annexes, annexTextType, CultureHelper.CurrentLanguageCode, GetAnnexMode.OnlyByCurLang); if (text.IsNullOrEmpty()) { text = defText; } return(text); } else { return(defText); } }
//##GetTextByAnnex private static string GetTextByAnnex(Annex annex, AnnexTextType textType) { try { if (annex != null) { if (textType == AnnexTextType.DisplayName) { return(annex.DisplayName); } else if (textType == AnnexTextType.Description) { return(annex.Description); } else if (textType == AnnexTextType.Body) { return(annex.Body); } else if (textType == AnnexTextType.Remark) { return(annex.Remark); } else if (textType == AnnexTextType.Remark1) { return(annex.Remark1); } else if (textType == AnnexTextType.Remark2) { return(annex.Remark2); } else if (textType == AnnexTextType.Other) { return(annex.Other); } } return(string.Empty); } catch (Exception ex) { throw new ArgumentException("\n>> " + TypeName + ".GetTextByAnnex Error: " + ex.Message); } }
//#GetText by masterName, className can be empty public static string GetText(string className, string masterName, List <Annex> annexes, AnnexTextType textType, string curLangCode, GetAnnexMode getAnnexMode) { var annex = Get(className, masterName, annexes, curLangCode, getAnnexMode); if (annex == null) { return(string.Empty); } else { return(GetTextByAnnex(annex, textType)); } }
//#GetText by masterName public static string GetText(string className, string masterName, List <Annex> annexes, AnnexTextType textType, string curLangCode, GetAnnexMode getAnnexMode) { try { var annex = Get(className, masterName, annexes, curLangCode, getAnnexMode); if (annex == null) { return(string.Empty); } else { return(GetTextByAnnex(annex, textType)); } } catch (Exception ex) { throw new ArgumentException("\n>> " + TypeName + ".GetText Error: " + ex.Message); } }