Example #1
0
        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);
        }
Example #2
0
        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);
        }