コード例 #1
0
        public static string isValidOperation(LogisticsConstants.Operation operation)
        {
            var    constants = new LogisticsConstants();
            string acces     = "";
            var    ewCache   = UserAccountHelper.GetUserPermissionCache(CatsGlobals.Applications.Logistics);

            if (ewCache.CheckAccess(constants.ItemName(operation), DateTime.Now) == AuthorizationType.Allow)
            {
                acces = operation.ToString();
            }
            return(acces);
        }
コード例 #2
0
        public static MvcHtmlString LogisticsOperationButton(this HtmlHelper helper, string url, LogisticsConstants.Operation operation, string text = "", string ccsClass = "", string dataButtontype = "", string id = "")
        {
            var constants = new LogisticsConstants();
            var ewCache   = UserAccountHelper.GetUserPermissionCache(CatsGlobals.Applications.Logistics);
            var html      = string.Empty;

            // If cache is null then force the user to sign-in again
            if (null == ewCache)
            {
                Signout();
                return(MvcHtmlString.Create(string.Empty));
            }
            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));
        }