public ActionResult SaveApply(Apply apply, string role, string applyType) { #region 保存申请 if (apply.ID == new Guid()) { apply.ID = Guid.NewGuid(); } apply.ApplyType = ApplyTypeManager.Get(new Guid(applyType)); apply.SendUser = UserInfoManager.GetUserSession(); apply.CreateTime = DateTime.Now; apply.CheckState = 0; apply.CheckStateName = "待审核"; ApplyManager.SaveOrUpdate(apply); #endregion #region 保存待审核用户的信息 // 读取需要进行审核角色的用户 IList <RoleUser> roleUser = RoleUserManager.LoadAll().Where(f => f.Role.ID == new Guid(role)).ToList(); Guid roleId = new Guid(role); Role checkRole = RoleManager.Get(roleId); if (roleUser.Count == 0) { return(Content("-1")); } for (int i = 0; i < roleUser.Count; i++) { CheckLog checkLog = new CheckLog(); checkLog.ID = Guid.NewGuid(); checkLog.Apply = apply; checkLog.CheckState = 0; checkLog.CheckTime = DateTime.Now; checkLog.CreateTime = DateTime.Now; checkLog.Remark = ""; checkLog.Role = checkRole; checkLog.UserInfo = roleUser[i].User; CheckLogManager.Save(checkLog); } #endregion return(Content("1")); }
// // GET: /SystemModel/ public ActionResult NewApply() { ViewData["ApplyType"] = ApplyTypeManager.LoadAll(); ViewData["Role"] = RoleManager.LoadAll(); return(View("NewApply")); }