public ActionResult Index(string Id) { var SysTypeId = Id == "ZJ" ? 1 : 2; var MemuList = systemProgromRepo.GetMenu(ViewHelp.GetUserId(), SysTypeId); for (int i = 0; i < MemuList.Count; i++) { MemuList[i].Items = GetMenuCount(MemuList[i].Items); } return(View(MemuList)); }
//权限判断业务逻辑 protected virtual bool AuthorizeCore(ActionExecutingContext filterContext) { string[] NormalAction = { "delete", "edit", "add" }; if (filterContext.HttpContext == null) { throw new ArgumentNullException("httpContext"); } var path = filterContext.HttpContext.Request.Path.ToLower(); if (path == "/" || path == "/Account/Login".ToLower() || path == "/Account/Logout".ToLower()) { return(true); } if (ViewHelp.GetUserId() == 0) { filterContext.RequestContext.HttpContext.Response.Redirect("/account/login?returnUrl=" + filterContext.HttpContext.Request.CurrentExecutionFilePath); } ControlName = filterContext.RouteData.Values["controller"].ToString().ToLower(); ActionName = filterContext.RouteData.Values["action"].ToString().ToLower(); ViewBag.ControlName = ControlName; ViewBag.ActionName = ActionName; if (Request.IsAjaxRequest() && !NormalAction.Contains(ActionName)) { return(true); } if (!ViewHelp.HasRight(ControlName, ActionName) && !path.Contains("home")) { if (Request.IsAjaxRequest()) { filterContext.RequestContext.HttpContext.Response.Write("{\"code\":0,\"message\":\"无当前作业权限,请联系系统管理员!\"}"); filterContext.RequestContext.HttpContext.Response.ContentType = "application/Json"; filterContext.RequestContext.HttpContext.Response.End(); filterContext.Result = Json(new { code = 0, message = "无当前作业权限,请联系系统管理员!" }, JsonRequestBehavior.AllowGet); } filterContext.RequestContext.HttpContext.Response.Redirect("/error/noright"); } var actionList = ViewHelp.GetActions(ControlName); var actionOb = "{"; foreach (var item in actionList) { actionOb += item + ":1,"; } actionOb += "}"; ViewBag.actionOb = actionOb; return(true); }
public ActionResult AddFeedBack(string message, string url) { var systemFeedback = new EM_System_Feedback() { Creater = ViewHelp.GetUserId(), Message = message, ModefyDate = DateTime.Now, CreateDate = DateTime.Now, Priority = (int)FeedBackPriority.L0, Url = url }; systemFeedbackRepo.Add(systemFeedback); systemFeedbackRepo.SaveChanges(); var Feedbacks = systemFeedbackRepo.GetFeedbacks(ViewHelp.GetUserId()); return(PartialView("_ListFeedbacks", Feedbacks)); }
public ActionResult UpdateFeedback(int id, string message) { var feedback = systemFeedbackRepo.GetById(id); feedback.ReplyDate = DateTime.Now; feedback.ReplyMessage = message; systemFeedbackRepo.SaveChanges(); var ReplyMessage = "管理员回复了你的反馈:{0}<br>{1}"; ReplyMessage = string.Format(ReplyMessage, feedback.Message.Omit(), message); var systemAlertMessage = new EM_System_AlertMessage() { Message = ReplyMessage, MessageType = (int)MessageType.Alert, Receiver = feedback.Creater, Sender = ViewHelp.GetUserId(), CreateTime = DateTime.Now, }; systemAlertMessageRepo.Add(systemAlertMessage); systemAlertMessageRepo.SaveChanges(); return(Json(new { code = 1 })); }
// // POST: /Account/LogOff public ActionResult LogOff() { userAccountRepo.LogOff(ViewHelp.GetUserId()); CookieHelper.DeleteCookie(StaticKey.CookieAccountKey); return(RedirectToAction("Login")); }
public async Task <JsonResult> ChangePassword(string OPassword, string NPassword) { var result = userAccountRepo.ChangePassword(ViewHelp.GetUserId(), OPassword, NPassword); return(Json(new { code = result == "" ? 1 : 0, message = result })); }
public ActionResult AlertMessage() { var alertMessage = systemAlertMessageRepo.GetAlertMessages(ViewHelp.GetUserId()); return(Json(new { messages = alertMessage }, JsonRequestBehavior.AllowGet)); }
public ActionResult GetFeedBack() { var Feedbacks = systemFeedbackRepo.GetFeedbacks(ViewHelp.GetUserId()); return(PartialView(Feedbacks)); }