protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var  dataContextFactory = new DataContextFactory();
            var  _commonDbService   = new CommonDbService(dataContextFactory);
            bool status             = false;

            string[] allowedRoles          = AllowedRole.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   utility               = WebConfigurationManager.AppSettings["ProductName"];
            var      _authorizationService = new Authorization(_commonDbService.GetCommonDataBaseContext());
            var      userRoles             = _authorizationService.GetRoleForUtility(httpContext.User.Identity.Name, utility);

            foreach (var allowedRole in allowedRoles)
            {
                if (userRoles.Contains(allowedRole))
                {
                    return(true);
                }
                else
                {
                    status = false;
                }
            }

            return(status);
        }
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
            var dataContextFactory = new DataContextFactory();
            var _commonDbService   = new CommonDbService(dataContextFactory);

            var userRoles = new List <string>();

            string[] allowedRoles = AllowedRole.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);

            string utility = WebConfigurationManager.AppSettings["ProductName"];

            var _authorizationService = new Authorization(_commonDbService.GetCommonDataBaseContext());

            userRoles = _authorizationService.GetRoleForUtility(HttpContext.Current.User.Identity.Name, utility);

            foreach (var allowedRole in allowedRoles)
            {
                if (!userRoles.Contains(allowedRole))
                {
                    filterContext.Result = new ViewResult
                    {
                        ViewName = "~/Views/Shared/CustomErrorMessage.cshtml"
                    };
                }
            }
        }