//protected virtual string GetContent(string pk) //{ // Durados.Web.Mvc.View contentView = (Durados.Web.Mvc.View)Map.Database.Views[GetContentViewName()]; // contentView.Database.Logger.Log(contentView.Name, "Start", "GetContent", "Notifier", "", 14, DateTime.Now.Millisecond.ToString(), DateTime.Now); // DataRow contentRow = contentView.GetDataRow(pk); // if (contentRow == null) // return null; // string content = contentView.GetDisplayValue(GetContentFieldName(), contentRow); // contentView.Database.Logger.Log(contentView.Name, "End", "GetContent", "Notifier", "", 14, DateTime.Now.Millisecond.ToString(), DateTime.Now); // return content; //} protected virtual string GetContent(Durados.Workflow.INotifier controller, string pk) { Durados.Web.Mvc.View contentView = (Durados.Web.Mvc.View)controller.GetNonConfigView(GetContentViewName()); Field field = contentView.Fields[GetContentFieldName()]; return(controller.GetFieldValue((ColumnField)field, pk) ?? pk); }
protected string[] GetEmailsFromParameter(Durados.Workflow.INotifier controller, string parameter, Durados.View view, Dictionary <string, object> values, DataRow prevRow, string pk, string connectionString, string currentUserId, string currentUsername, string currentUserRole) { //// replace the tokens in the parameter if (!string.IsNullOrEmpty(pk) && ((parameter.Contains('[') && parameter.Contains(']')) || (parameter.Contains(Database.DictionaryPrefix) && parameter.Contains(Database.DictionaryPostfix)) || parameter.Contains('$'))) { if (nameValueDictionary.Count == 0 && prevRow != null) { controller.LoadValues(nameValueDictionary, prevRow, (Durados.Web.Mvc.View)view, null, (Durados.Web.Mvc.View)view, view.DisplayName + ".", "[", "]", dicFields, view.Name + "."); } parameter = parameter.ReplaceAllTokens(view, values, pk, currentUserId, currentUsername, currentUserRole, prevRow); parameter = parameter.Replace(nameValueDictionary, controller.GetTableViewer(), view); parameter = parameter.Replace(dicFields.ToDictionary(k => k.Key, v => ((Durados.Workflow.DictionaryField)v.Value).Value), controller.GetTableViewer(), view); } parameter = parameter.Replace(values, controller.GetTableViewer(), view); string[] parameters = parameter.Split(';'); Dictionary <string, string> emails = new Dictionary <string, string>(); if (parameters != null) { for (int i = 0; i < parameters.Length; i++) { string param = parameters[i]; string email = GetEmail(param, view, values, prevRow, pk, connectionString); if (!string.IsNullOrEmpty(email) && !emails.ContainsKey(email)) { emails.Add(email, email); } } } return(emails.Values.ToArray()); }
public string GetContent(Durados.Workflow.INotifier controller, string content, Durados.View view, Dictionary <string, object> nameValueDictionary, string pk, string siteWithoutQueryString, string mainSiteWithoutQueryString) { content = controller.HtmlDecode(content); string viewDisplayName = view.DisplayName; content = content.Replace("[MainAppPath]", mainSiteWithoutQueryString); content = content.Replace("[AppPath]", siteWithoutQueryString); content = content.Replace("{{MainAppPath}}", mainSiteWithoutQueryString); content = content.Replace("{{AppPath}}", siteWithoutQueryString); if (nameValueDictionary != null && content.Contains('[') && content.Contains(']')) { content = content.Replace(nameValueDictionary, controller.GetTableViewer(), view); } return(content); }
public string[] GetSubjectAndMessage(Durados.Workflow.INotifier controller, string subjectKey, string messageKey, Durados.View view, Dictionary <string, object> values, string pk, string siteWithoutQueryString, string mainSiteWithoutQueryString) { string messageContent = GetContent(controller, messageKey); string subjectContent = GetContent(controller, subjectKey); string[] s = new string[2] { subjectKey, messageKey }; if (messageContent == null && subjectContent == null) { return(s); } Dictionary <string, object> nameValueDictionary = new Dictionary <string, object>(); Dictionary <string, Durados.Workflow.DictionaryField> dicFields = new Dictionary <string, Durados.Workflow.DictionaryField>(); string viewDisplayName = view.DisplayName; if (!string.IsNullOrEmpty(pk) && ((messageContent.Contains('[') && messageContent.Contains(']')) || (subjectContent.Contains('[') && subjectContent.Contains(']')))) { DataRow row = view.GetDataRow(pk); controller.LoadValues(nameValueDictionary, row, (Durados.Web.Mvc.View)view, null, (Durados.Web.Mvc.View)view, viewDisplayName + ".", "[", "]", dicFields, view.Name + "."); } else { return(s); } if (messageContent != null && messageContent.Contains('[') && messageContent.Contains(']')) { s[1] = GetContent(controller, messageContent, view, nameValueDictionary, pk, siteWithoutQueryString, mainSiteWithoutQueryString); } if (subjectContent != null && subjectContent.Contains('[') && subjectContent.Contains(']')) { s[0] = GetContent(controller, subjectContent, view, nameValueDictionary, pk, siteWithoutQueryString, mainSiteWithoutQueryString); } return(s); }
public string GetMessage(Durados.Workflow.INotifier controller, string messageKey, Durados.View view, Dictionary <string, object> values, string pk, string siteWithoutQueryString, string mainSiteWithoutQueryString) { string content = GetContent(controller, messageKey); if (content == null) { return(messageKey); } content = controller.HtmlDecode(content); string viewDisplayName = view.DisplayName; if (Maps.MultiTenancy) { content = content.Replace("[AppPath]", ((Database)view.Database).Map.Url); content = content.Replace("[MainAppPath]", mainSiteWithoutQueryString); content = content.Replace("{{AppPath}}", ((Database)view.Database).Map.Url); content = content.Replace("{{MainAppPath}}", mainSiteWithoutQueryString); } else { content = content.Replace("[AppPath]", siteWithoutQueryString); content = content.Replace("{{AppPath}}", siteWithoutQueryString); } content = content.Replace("[Product]", ((Database)view.Database).Map.AppName); content = content.Replace("{{AppName}}", ((Database)view.Database).Map.AppName); if (!string.IsNullOrEmpty(pk) && (content.Contains('[') && content.Contains(']') || content.Contains(Database.DictionaryPrefix) && content.Contains(Database.DictionaryPostfix))) { DataRow row = view.GetDataRow(pk); if (nameValueDictionary.Count == 0) { controller.LoadValues(nameValueDictionary, row, (Durados.Web.Mvc.View)view, null, (Durados.Web.Mvc.View)view, viewDisplayName + ".", "[", "]", dicFields, view.Name + "."); } content = content.Replace(nameValueDictionary, controller.GetTableViewer(), view); content = content.Replace(dicFields.ToDictionary(k => k.Key, v => ((Durados.Workflow.DictionaryField)v.Value).Value), controller.GetTableViewer(), view); try { content = content.Replace(values, controller.GetTableViewer(), view); } catch { } if (content.Contains("[User.First Name]")) { if (row.Table.Columns.Contains("FirstName")) { if (!row.IsNull("FirstName")) { content = content.Replace("[User.First Name]", row["FirstName"].ToString()); } } } } else { content = content.Replace(values, controller.GetTableViewer(), view); } return(content); }
public string GetSubject(Durados.Workflow.INotifier controller, string subjectKey, Durados.View view, Dictionary <string, object> values, string pk) { //return GetContent(controller, subjectKey); return(GetMessage(controller, subjectKey, view, values, pk, string.Empty, string.Empty)); }