public ResultMessage Reject(RejectDto rejectModel, IUserDto user) { try { var product = _unitOfWork.ProductsRepository.GetById(rejectModel.Id); if (product == null) { return(new ResultMessage { Status = HttpStatusCode.BadRequest, }); } product.UpdatedAt = DateTime.Now; product.IsActive = false; product.RejectReason = rejectModel.RejectReason; product.UpdatedBy = user.Id; _unitOfWork.ProductsRepository.Update(product); _unitOfWork.Commit(); return(new ResultMessage { Status = HttpStatusCode.OK }); } catch (Exception ex) { _logger.LogError(ex, string.Empty); return(new ResultMessage { Status = HttpStatusCode.InternalServerError }); } }
public void Reject(RejectDto rejectDto) { var work = Db.Works.Where(x => x.Id == rejectDto.Id).SingleOrDefault(); work.workStatus = WorkStatus.Rejected; work.RecjectionNote = rejectDto.RecjectionNote; Db.SaveChanges(); }
public ResultMessage Reject(RejectDto rejectDto, IUserDto user) { _logger.LogInformation($"START: Article.Reject: Id:{rejectDto.Id}"); var validationResult = _rejectValidator.Validate(rejectDto); if (!validationResult.IsValid) { return(new ResultMessage { Status = HttpStatusCode.BadRequest, ValidationMessages = validationResult.GetErrorsList() }); } try { var articleData = _unitOfWork.ArticlesRepository.GetById(rejectDto.Id); if (articleData == null) { _logger.LogInformation($"END: Article.Reject: Id:{rejectDto.Id} --NotFound"); return(new ResultMessage { Status = HttpStatusCode.NotFound, }); } articleData.UpdatedAt = DateTime.Now; articleData.UpdatedBy = user.Id; articleData.RejectReason = rejectDto.RejectReason; articleData.IsActive = false; _unitOfWork.ArticlesRepository.Update(articleData); _unitOfWork.Commit(); _logger.LogInformation($"END: Article.Reject: Id:{rejectDto.Id} --SUCCESS"); return(new ResultMessage { Status = HttpStatusCode.OK, Data = true }); } catch (Exception ex) { _logger.LogError(ex, string.Empty); return(new ResultMessage { Status = HttpStatusCode.InternalServerError }); } }
public async Task <IActionResult> RejectAsync([FromBody] RejectDto dto) { string openId = GetOpenId(); try { var data = await _expenseServices.RejectAsync(dto, openId); return(SuccessMsg("驳回成功")); } catch (Exception err) { _logger.Error(typeof(ExpenseController), "驳回失败!", new Exception(err.Message)); return(FailedMsg("驳回失败!" + err.Message)); } }
public void RejectCarService(RejectDto dto, string currentUserId) { UserManager.IsUserInAdministrationRole(currentUserId); var service = GetCarService(dto.CarServiceId); if (string.IsNullOrEmpty(dto.Reason)) { throw new BusinessFaultException("Необходимо указать причину отказа"); //TODO } if (service.State != CarServiceState.UnderСonsideration) { throw new BusinessFaultException(BusinessLogicExceptionResources.CarServiceIncorrectState); } service.State = CarServiceState.Rejected; service.DeclineReason = dto.Reason; service.Updated = DateTime.UtcNow; UnitOfWork.SaveChanges(); }
/// <summary> /// 驳回 /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> RejectAsync(RejectDto dto, string openId) { var Status = db.Queryable <ExpenseInfo>().Where(a => a.ID == dto.Id).First()?.AuditStatus; if (Status != AppConsts.AuditStatus.UnAudited) { throw new Exception("报销单未审核的情况下才可以驳回!"); } return(await Task.Run(() => { var userId = db.Queryable <Wx_UserInfo>().Where(a => a.OpenId == openId).First()?.ID; var result = db.Updateable <ExpenseInfo>() .SetColumns(a => new ExpenseInfo() { AuditStatus = AppConsts.AuditStatus.Reject, RejectUserId = userId, RejectReason = dto.RejectReason, RejectTime = DateTime.Now }) .Where(a => a.ID == dto.Id).ExecuteCommand(); return result > 0; })); }
public ActionResult Reject([FromBody] RejectDto model) { return(GetStatusCodeResult(_articlesService.Reject(model, GetCurrentUser()))); }
public IHttpActionResult RejectCarService(RejectDto dto) { return(CallBusinessLogicAction(() => _manager.RejectCarService(dto, User.Identity.GetUserId()))); }
public void WrokPage(RejectDto rejectDto) { teamLeaderRepository.Reject(rejectDto); }
public ActionResult Reject([FromBody] RejectDto model) { return(GetStatusCodeResult(_productsManager.Reject(model, GetCurrentUser()))); }
/// <summary> /// 驳回 /// </summary> /// <param name="dto"></param> /// <returns></returns> public async Task <bool> RejectAsync(RejectDto dto, string openId) { return(await _expenseDal.RejectAsync(dto, openId)); }