/// <summary> /// <summary> /// 修改部门 /// </summary> /// <param name="r"></param> /// <returns></returns> public bool UpdateDepartment(WXQ.Enties.Department model) { DepartmentManager DepartmentManager = new DepartmentManager(); model.UpdateUser = this.OpUserId.ToString(); return(DepartmentManager.Db.Updateable(model).Where(m => m.DepartmentId == model.DepartmentId).ExecuteCommand() > 0); }
/// <summary> /// 添加部门 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool InsertDepartment(WXQ.Enties.Department model) { model.AddUser = this.OpUserId.ToString(); DepartmentManager DepartmentManager = new DepartmentManager(); return(DepartmentManager.Insert(model)); }
public JsonResult UpdateDepartment([FromForm] WXQ.InOutPutEntites.Input.SystemManage.Department.UpdateDepartmentInput model) { ResponseResult result = new ResponseResult(); UpdateDepartmentInputValidation validator = new UpdateDepartmentInputValidation(); ValidationResult vr = validator.Validate(model); if (!vr.IsValid) { result.Code = ResponseResultMessageDefine.ParaError; result.Errors = vr.Errors.Select(e => e.ErrorMessage).ToList(); } else { int userId = WebApi.Common.HelpOp.UserOp.GetUserId(this.User); WXQ.BusinessCore.systemmanage.DepartmentOp op = new WXQ.BusinessCore.systemmanage.DepartmentOp(userId); WXQ.Enties.Department r = new WXQ.Enties.Department { DepartmentId = model.DepartmentId, UpdateDateTime = DateTime.Now, UpdateUser = this.User.Identity.Name, Description = model.Description, ParentId = model.ParentId, DepartmentName = model.DepartmentName }; bool rv = op.UpdateDepartment(r); if (!rv) { result.Code = ResponseResultMessageDefine.OpLost; result.Errors.Add(ResponseResultMessageDefine.OpLostMessage); } } return(Json(result)); }