public ActionResult EditAppMenu(AppMenuDTO appMenu, Guid?parent) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (parent.HasValue) { appMenu.Parent = _appMenuService.FindBy(parent.Value); } if (appMenu.Id == Guid.Empty) { _appMenuService.Add(appMenu); this.JsMessage = MessagesResources.Add_Success; } else { _appMenuService.Update(appMenu); this.JsMessage = MessagesResources.Update_Success; } return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }); })); }
public ActionResult EditUser(UserDTO user) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (user.LastLogin == DateTime.MinValue) //最后登录时间字段为空时,数据为datetime默认的{0001/1/1 0:00:00},新增或修改用户时报错 { user.LastLogin = Convert.ToDateTime("1900-01-01T00:00:00.000"); } if (user.Id == Guid.Empty) { _userService.Add(user); this.JsMessage = MessagesResources.Add_Success; } else { _userService.Update(user); this.JsMessage = MessagesResources.Update_Success; } AuthorizeManager.ClearUserCache(user.Id); return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }); })); }
public ActionResult EditUserPermission(Guid userId, List <string> permissions) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var pList = new List <Guid>(); foreach (var s in permissions.OpSafe()) { Guid id; if (Guid.TryParse(s, out id)) { pList.Add(id); } } _userService.UpdateUserPermission(userId, pList); AuthorizeManager.ClearUserCache(userId); this.JsMessage = MessagesResources.Update_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("EditUserPermission", new { userId }) }); })); }
public ActionResult EditDepartmentList(Guid memberId, List <string> departments) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var pList = new List <Guid>(); foreach (var s in departments.OpSafe()) { Guid id; if (Guid.TryParse(s, out id)) { pList.Add(id); } } _memberService.UpdateMemberDepartments(memberId, pList); this.JsMessage = MessagesResources.Update_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("EditDepartmentList", new { memberId }) }); })); }
public ActionResult EditMenuPermission(Guid menuId, PermissionDTO permission, Guid?id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var menu = _menuService.FindBy(menuId) ?? new MenuDTO(); if (!id.HasValue) { menu.Permissions.Add(permission); } else { permission.Id = id.Value; var oldPermission = menu.Permissions.FirstOrDefault(x => x.Id == permission.Id); if (oldPermission != null) { permission.Created = oldPermission.Created; menu.Permissions.Remove(oldPermission); } menu.Permissions.Add(permission); } _menuService.UpdatePermission(menu); this.JsMessage = MessagesResources.Update_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("MenuPermissionList", new { menuId = menuId }) }); })); }
public ActionResult GetMembersFromWeixin() { return(HttpHandleExtensions.AjaxCallGetResult(() => { var accessToken = _commonService.GetContactsAccessToken(); var members = _contactsService.GetMembers(accessToken); var departments = _contactsService.GetDepartments(accessToken); return Json(new AjaxResponse { Succeeded = true, Data = new { members = members.Select(x => { var deps = x.Department.Select(id => departments.FirstOrDefault(d => d.Id == id)); return new { member = x, departments = deps.Where(d => d != null) }; }) } }, JsonRequestBehavior.AllowGet); })); }
public ActionResult EditMenu(MenuDTO menu, Guid?module, Guid?parent) { return(HttpHandleExtensions.AjaxCallGetResult(() => { menu.Permissions = new Collection <PermissionDTO>(); if (module.HasValue) { menu.Module = _moduleService.FindBy(module.Value); } if (parent.HasValue) { menu.Parent = _menuService.FindBy(parent.Value); } if (menu.Id == Guid.Empty) { _menuService.Add(menu); this.JsMessage = MessagesResources.Add_Success; } else { _menuService.Update(menu); this.JsMessage = MessagesResources.Update_Success; } base.ClearCacheMenus(); // 更新所有登陆用户缓存,以更新菜单信息 AuthorizeManager.ClearAllCache(); return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }); })); }
public ActionResult EditChildCategory(CategoryDTO category, Guid parentId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (category.Id == Guid.Empty) { category.CreatorId = GetCurrentUser().UserId; category.Parent = new CategoryDTO() { Id = parentId }; _categoryService.Add(category); this.JsMessage = MessagesResources.Add_Success; } else { _categoryService.Update(category); this.JsMessage = MessagesResources.Update_Success; } return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("ChildList", new { parentId = parentId }) }); })); }
public ActionResult EditCargo(CargoDTO cargo, Guid?categoryId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (categoryId.HasValue) { cargo.Category = new CategoryDTO() { Id = categoryId.Value }; } if (cargo.Id == Guid.Empty) { cargo.CreatorId = GetCurrentUser().UserId; _cargoService.Add(cargo); this.JsMessage = MessagesResources.Add_Success; } else { _cargoService.Update(cargo); this.JsMessage = MessagesResources.Update_Success; } return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }); })); }
public ActionResult SearchXiuJia(DateTime?dateStart, DateTime?dateEnd, KaoQinStatusDTO?status, string userId, bool export) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (dateStart.HasValue && dateEnd.HasValue && dateStart.Value > dateEnd.Value) { throw new DataNotFoundException(MessagesResources.StartTime_Greater_Than_EndTime); } return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action(export ? "Export" : "Index", new { dateStart, dateEnd, status, userId, t = DateTime.Now.Ticks }) }); })); }
public ActionResult UploadMembersToWeixin() { return(HttpHandleExtensions.AjaxCallGetResult(() => { _memberService.UploadMembers(); this.JsMessage = MessagesResources.Upload_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult SearchSerialNumberRule(string name) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index", new { name = name, }) }); })); }
public ActionResult RemoveChildCategory(Guid id, Guid parentId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _categoryService.Remove(id); this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("ChildList", new { parentId = parentId }) }, JsonRequestBehavior.AllowGet); })); }
public ActionResult RemoveNotExistDepartmentInWeixin() { return(HttpHandleExtensions.AjaxCallGetResult(() => { _departmentService.RemoveNotExistDepartmentInWeixin(); this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult DownloadMenusFromWeixin(int appId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _appMenuService.DownloadMenus(appId); this.JsMessage = MessagesResources.Download_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult Cancel(Guid id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _xiuJiaService.Cancel(id, GetCurrentOperator()); this.JsMessage = MessagesResources.Cancel_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult RemoveCargo(Guid id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _cargoService.Remove(id); this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult SearchGroup(string groupName) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index", new { groupName, }) }); })); }
public ActionResult RemoveRole(Guid groupId, Guid id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _roleService.Remove(id); this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("RoleList", new { groupId = groupId }) }, JsonRequestBehavior.AllowGet); })); }
public ActionResult SearchDepartment(string name, int?parentId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index", new { name = name, parentId = parentId, }) }); })); }
public ActionResult SearchChildCategory(string name, Guid parentId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("ChildList", new { name = name, parentId = parentId, }) }); })); }
public ActionResult SearchCargo(string name, Guid?categoryId) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index", new { name = name, categoryId = categoryId, }) }); })); }
public ActionResult SearchRoleList(Guid groupId, string name) { return(HttpHandleExtensions.AjaxCallGetResult(() => { return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("RoleList", new { groupId, name }) }); })); }
public ActionResult InviteMember(List <string> userIds) { return(HttpHandleExtensions.AjaxCallGetResult(() => { // 过滤一些值为false的hidden项 userIds = userIds.Where(x => !string.IsNullOrWhiteSpace(x) && x != "false").ToList(); _memberService.InviteMember(userIds); this.JsMessage = MessagesResources.Invite_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("InviteMember") }); })); }
public ActionResult RemoveMenu(Guid id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { _menuService.Remove(id); base.ClearCacheMenus(); // 更新所有登陆用户缓存,以更新菜单信息 AuthorizeManager.ClearAllCache(); this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult GetDepartmentsFromWeixin() { return(HttpHandleExtensions.AjaxCallGetResult(() => { var accessToken = _commonService.GetContactsAccessToken(); var departments = _contactsService.GetDepartments(accessToken); var list = new List <Domain.Weixin.Model.Department>(); departments.GetSortedList(ref list, 1, 1); return Json(new AjaxResponse { Succeeded = true, Data = new { departments = list } }, JsonRequestBehavior.AllowGet); })); }
public ActionResult Apply(XiuJiaDTO item) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var department = GetCurrentMemberDepartment(); item.UserId = CurrentMember.Userid; item.Name = CurrentMember.Name; item.Position = CurrentMember.Position; item.DepartmentId = department.DepartmentId; item.Department = department.Name; _xiuJiaService.Add(item, GetCurrentOperator()); this.JsMessage = MessagesResources.Add_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Index") }); })); }
public ActionResult Approve(WeiDaKaDTO item) { return(HttpHandleExtensions.AjaxCallGetResult(() => { if (!IsWeiXinManager()) { throw new DefinedException(NotWeiXinManagerMessage); } item.DepartmentOrCompanyOpinionApproverId = CurrentMember.Userid; _weiDaKaService.Approve(item, GetCurrentOperator()); this.JsMessage = MessagesResources.Approve_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("Approved") }, JsonRequestBehavior.AllowGet); })); }
public ActionResult RemoveMenuPermission(Guid menuId, Guid id) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var menu = _menuService.FindBy(menuId) ?? new MenuDTO(); var permission = menu.Permissions.FirstOrDefault(x => x.Id == id); if (permission != null) { menu.Permissions.Remove(permission); _menuService.UpdatePermission(menu); } this.JsMessage = MessagesResources.Remove_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("MenuPermissionList", new { menuId = menuId }) }, JsonRequestBehavior.AllowGet); })); }
public ActionResult EditUserList(Guid groupId, List <string> users) { return(HttpHandleExtensions.AjaxCallGetResult(() => { var pList = new List <Guid>(); foreach (var s in users.OpSafe()) { Guid id; if (Guid.TryParse(s, out id)) { pList.Add(id); } } // 清除用户缓存 var oldUsers = _roleGroupService.GetUsersIdName(groupId); _roleGroupService.UpdateGroupUsers(groupId, pList); // 清除用户缓存 foreach (var u in oldUsers) { AuthorizeManager.ClearUserCache(u.Id); } foreach (var id in pList) { AuthorizeManager.ClearUserCache(id); } this.JsMessage = MessagesResources.Update_Success; return Json(new AjaxResponse { Succeeded = true, RedirectUrl = Url.Action("EditUserList", new { groupId }) }); })); }