예제 #1
0
        public static MvcHtmlString PSNPOperationMenuItem(this HtmlHelper helper, string text, string url, PsnpConstants.Operation operation, string ccsClass = "", string dataButtontype = "")
        {
            var constants = new PsnpConstants();
            var ewCache = UserAccountHelper.GetUserPermissionCache(CatsGlobals.Applications.PSNP);

            // If cache is null then force the user to sign-in again
            if (null == ewCache)
            {
                Signout();
            }

            var html = string.Empty;
            if (ewCache.CheckAccess(constants.ItemName(operation), DateTime.Now) == AuthorizationType.Allow)
            {
                html = @"<a data-buttontype=" + dataButtontype + "  class=" + ccsClass + " href=" + url + ">" + text + "</a>";
            }
            return MvcHtmlString.Create(html);
        }
예제 #2
0
        public static MvcHtmlString PSNPOperationButton(this HtmlHelper helper, string url, PsnpConstants.Operation operation, string text = "", string ccsClass = "", string dataButtontype = "", string id = "")
        {
            var constants = new PsnpConstants();
            var ewCache = UserAccountHelper.GetUserPermissionCache(CatsGlobals.Applications.PSNP);

            var html = string.Empty;
            // If cache is null then force the user to sign-in again
            if (null == ewCache)
            {
                Signout();
            }
            else if (ewCache.CheckAccess(constants.ItemName(operation), DateTime.Now) == AuthorizationType.Allow)
            {
                html = "<a href=" + url;
                if (ccsClass != "")
                {
                    html += " class=" + ccsClass;
                }
                if (id != "")
                {
                    html += " id=" + id;
                }
                if (dataButtontype != "")
                {
                    html += " data-buttontype=" + dataButtontype;
                }
                if (text != "")
                {
                    html += " >" + text + "</a>";
                }
                else
                {
                    html += " ></a>";
                }
            }
            return MvcHtmlString.Create(html);
        }