private static AlertTemplate GetMessageTemplate(Hashtable templates, Hashtable locales, int eventTypeId, int messageTypeId, int languageId) { AlertTemplate ret; string locale = (string)locales[languageId]; string key = AlertTemplate.MakeKey(ref locale, languageId, eventTypeId, messageTypeId); locales[languageId] = locale; ret = (AlertTemplate)templates[key]; if (ret == null) { ret = new AlertTemplate(locale, key, languageId, eventTypeId, messageTypeId); ret.Load(); templates[key] = ret; } return ret; }
private static Message GetMessage( Hashtable messages, AlertTemplate tmpl, RecipientInfo rInfo, EventInfo eInfo, UserInfo uInfo) { Message ret = null; string key = string.Format("{0}|{1}|{2}", tmpl.Key, eInfo.EventId, uInfo.TimeZoneId); ret = (Message)messages[key]; if (ret == null || uInfo.IsExternal) { ArrayList variables = eInfo.GetVariablesArrayList(uInfo.LanguageId); ret = GetMessage(tmpl.Subject, tmpl.Body, uInfo, variables, eInfo.ObjectTypeId, eInfo.ObjectId, eInfo.ObjectUid); if (!uInfo.IsExternal) messages[key] = ret; } return ret; }
public bool Load(bool getFromDb) { return(AlertTemplate.GetTemplate(AlertTemplateTypes.Reminder, Locale, DateType.ToString(), getFromDb, out Subject, out Body)); }