Exemple #1
0
        protected override void OnException(ExceptionContext exceptionContext)
        {
            promotalkEntities db = new promotalkEntities();

            if (!exceptionContext.ExceptionHandled)
            {
                AppErrorLog oAppErrorLogs = new AppErrorLog();
                oAppErrorLogs.ErrorMsg = exceptionContext.Exception.Message;
                ViewBag.msg            = exceptionContext.Exception.Message;
                oAppErrorLogs.datelog  = BaseUtil.GetCurrentDateTime();
                db.AppErrorLogs.Add(oAppErrorLogs);
                db.SaveChanges();
                exceptionContext.ExceptionHandled = true;
                Response.Redirect("~/Views/Shared/Error.cshtml");
            }
        }
Exemple #2
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            String ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToUpper();
            String ActionName     = filterContext.ActionDescriptor.ActionName.ToUpper();
            String Action         = string.Format("{0}Controller{1}", ControllerName, ActionName).ToUpper();

            if (BaseUtil.ListControllerTocheckLogin().Contains(ControllerName))
            {
                if (BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()) == "")
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Account/login");
                    return;
                }
                return;
            }
        }
Exemple #3
0
 public static string GetLoginID()
 {
     return(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()));
 }
Exemple #4
0
 public static int GetUserID()
 {
     return(Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString())));
 }