Пример #1
0
        ///// <summary>
        ///// Registers the default values for the EmailHelper class
        ///// </summary>
        public static void RegisterEmailHelper()
        {
            GlobalConfiguration globalConfiguration = new GlobalConfigurations().GetGlobalConfiguration();

            EmailHelper.DefaultFrom = "\"" + globalConfiguration.SiteName + "\"<" + globalConfiguration.NotificationEmail + ">";
            EmailHelper.DefaultTo   = globalConfiguration.NotificationEmail;
        }
Пример #2
0
        private void BuildTreeTablePageList(List <AdminPage> adminPageList, int currentLevel, int?pageParentId, StringBuilder treeTablePageList, string pageName)
        {
            if (adminPageList != null)
            {
                List <AdminPage> pagesObj = (from page in adminPageList
                                             where page.PageParentId == pageParentId
                                             select page).ToList();

                if (pagesObj != null && pagesObj.Count() > 0)
                {
                    if (currentLevel == 1)
                    {
                        treeTablePageList.Append("<div class=\"AdminPagesTreeControl btn-group\">" + Environment.NewLine +
                                                 "<a class=\"btn btn-default btn-xs\" href=\"#\"><i class=\"fa fa-compress fa-flip-horizontal\"></i> " + Resources.Strings.CollapseAll + "</a>" + Environment.NewLine +
                                                 "<a class=\"btn btn-default btn-xs\" href=\"#\"><i class=\"fa fa-expand fa-flip-horizontal\"></i> " + Resources.Strings.ExpandAll + "</a>" + Environment.NewLine +
                                                 "<a class=\"btn btn-default btn-xs\" href=\"#\"><i class=\"fa fa-arrows-alt\"></i> " + Resources.Strings.ToggleAll + "</a>" + Environment.NewLine +
                                                 "</div>");
                    }
                    treeTablePageList.Append(Environment.NewLine + "<ul");
                    if (currentLevel == 1)
                    {
                        treeTablePageList.Append(" class=\"AdminPagesTree\" ");
                    }
                    treeTablePageList.Append(">" + Environment.NewLine);
                    if (currentLevel == 1)
                    {
                        treeTablePageList.Append("<li><table class=\"table table-condensed table-bordered table-hover\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><thead><tr class=\"webgrid-header\">" +
                                                 "<th class=\"\">" + Resources.Strings.PageName + "</th>" +
                                                 "<th class=\"col-120\">" + Resources.Strings.Actions + "</th>" +
                                                 "<th class=\"col-60\">" + Resources.Strings.Active + "</th>" +
                                                 "<th class=\"col-100\">" + Resources.Strings.ShowInMenu + "</th>" +
                                                 "</tr></thead></table></li>");
                    }

                    string imgYes = "<i class=\"fa fa-check\"></i>";
                    GlobalConfiguration globalConfiguration = new GlobalConfigurations().GetGlobalConfiguration();
                    string highlight;

                    AdminPages adminPages = new AdminPages();
                    AdminPage  adminPage  = adminPages.GetPageByCurrentAction();

                    foreach (AdminPage pageObj in pagesObj)
                    {
                        if (pageName.IsNotEmptyOrWhiteSpace() && pageObj.PageName.Contains(pageName, StringComparison.OrdinalIgnoreCase))
                        {
                            highlight = "success";
                        }
                        else
                        {
                            highlight = "";
                        }

                        treeTablePageList.Append("<li><table id=\"r-" + pageObj.PageId.ToString() + "\" class=\"table table-condensed table-bordered table-hover\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" +
                                                 "<thead class=\"thead-hide\">" +
                                                 "<th class=\"\">" + Resources.Strings.PageName + "</th>" +
                                                 "<th class=\"col-120\">" + Resources.Strings.Actions + "</th>" +
                                                 "<th class=\"col-60\">" + Resources.Strings.Active + "</th>" +
                                                 "<th class=\"col-100\">" + Resources.Strings.ShowInMenu + "</th>" +
                                                 "</thead>" +
                                                 "<tbody><tr>" +
                                                 "<td class=\"" + highlight + "\">" + pageObj.PageName + "</td>" +
                                                 "<td class=\"text-center\"><div class=\"btn-group\">");
                        if (adminPages.IsPermissionGranted(adminPage.PageId, PermissionCode.Add))
                        {
                            treeTablePageList.Append("<a href=\"/Admin/AdminPagesAdd/" + pageObj.PageId.ToString() + "\" class=\"btn btn-default btn-xs\" data-toggle=\"tooltip\" title=\"" + Resources.Strings.AdminPagesAdd + "\" ><i class=\"fa fa-plus\"></i></a>");
                        }
                        if (adminPages.IsPermissionGranted(adminPage.PageId, PermissionCode.Edit))
                        {
                            treeTablePageList.Append("<a href=\"/Admin/AdminPagesEdit/" + pageObj.PageId.ToString() + "\" class=\"btn btn-default btn-xs\" data-toggle=\"tooltip\" title=\"" + Resources.Strings.AdminPagesEdit + "\" ><i class=\"fa fa-pencil\"></i></a>");
                        }
                        if (adminPages.IsPermissionGranted(adminPage.PageId, PermissionCode.Delete))
                        {
                            treeTablePageList.Append("<button type=\"submit\" data-action=\"/Admin/AdminPagesDelete\" data-id=\"" + pageObj.PageId.ToString() + "\" data-toggle=\"tooltip\" title=\"" + Resources.Strings.AdminPagesDelete + "\" class=\"btn btn-default btn-xs btn-admin-pages action-delete\" data-action-delete-item=\"" + pageObj.PageName + "\"><i class=\"fa fa-trash-o\"></i></button>");
                        }
                        if (adminPages.IsPermissionGranted(adminPage.PageId, PermissionCode.Edit))
                        {
                            treeTablePageList.Append("<button type=\"submit\" data-action=\"/Admin/AdminPagesMoveUp/#r-" + pageObj.PageId.ToString() + "\" data-id=\"" + pageObj.PageId.ToString() + "\" data-toggle=\"tooltip\" title=\"" + Resources.Strings.MovePageUpInSameLevel + "\" class=\"btn btn-default btn-xs btn-admin-pages action-post-id\" \"><i class=\"fa fa-chevron-up\"></i></button>" +
                                                     "<button type=\"submit\" data-action=\"/Admin/AdminPagesMoveDown/#r-" + pageObj.PageId.ToString() + "\" data-id=\"" + pageObj.PageId.ToString() + "\" data-toggle=\"tooltip\" title=\"" + Resources.Strings.MovePageDownInSameLevel + "\" class=\"btn btn-default btn-xs btn-admin-pages action-post-id\" \"><i class=\"fa fa-chevron-down\"></i></button>");
                        }
                        treeTablePageList.Append("</div></td>" +
                                                 "<td class=\"text-center\">" + (pageObj.IsActive.ConvertTo <bool>(false, true) ? imgYes : "") + "</td>" +
                                                 "<td class=\"text-center\">" + (pageObj.ShowInMenu.ConvertTo <bool>(false, true) ? imgYes : "") + "</td>" +
                                                 "</tr></tbody></table>" + Environment.NewLine);

                        currentLevel++;

                        BuildTreeTablePageList(adminPageList, currentLevel, pageObj.PageId, treeTablePageList, pageName);

                        currentLevel--;

                        treeTablePageList.Append("</li>" + Environment.NewLine);
                    }
                    treeTablePageList.Append("</ul>" + Environment.NewLine);
                }
            }
        }