NetSqlAzMan Check Access Helper Class for NetSqlAzMan 'Logistics' Application
Inheritance: ILogisticsCheckAccess
Ejemplo n.º 1
0
        public static MvcHtmlString LogisticsOperationButton(this HtmlHelper helper, string url, LogisticsCheckAccess.Operation operation, string text = "", string ccsClass = "", string dataButtontype = "", string id = "")
        {
            var user = (UserIdentity)HttpContext.Current.User.Identity;
            var checkAccessHelper = DependencyResolver.Current.GetService<ILogisticsCheckAccess>();
            var dbUser = checkAccessHelper.Storage.GetDBUser(user.Profile.UserName).CustomSid;

            var html = string.Empty;

            if (checkAccessHelper.CheckAccess(operation, dbUser))
            {
                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);
        }
Ejemplo n.º 2
0
        public static MvcHtmlString LogisticOperationMenuItem(this HtmlHelper helper, string text, string url, LogisticsCheckAccess.Operation operation, string ccsClass="", string dataButtontype="")
        {
            var user = (UserIdentity)HttpContext.Current.User.Identity;
            var checkAccessHelper = DependencyResolver.Current.GetService<ILogisticsCheckAccess>();
            var dbUser = checkAccessHelper.Storage.GetDBUser(user.Profile.UserName).CustomSid;

            var html = string.Empty;

            if (checkAccessHelper.CheckAccess(operation, dbUser))
            {
                html = @"<a data-buttontype=" + dataButtontype + "  class=" + ccsClass + " href=" + url + ">" + text + "</a>";
            }
            return MvcHtmlString.Create(html);
        }