/// <summary> /// 待核价确认阶段取消改签申请 /// </summary> /// <param name="request"></param> /// <returns></returns> public CancelFltModApplyResponseViewModel CancelFltModApplyByWaitAuditStep( CancelFltModApplyRequestViewModel request) { //根据Cid查询客户信息 CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid); CancelFltRetModApplyModel query = Mapper.Map <CancelFltModApplyRequestViewModel, CancelFltRetModApplyModel>(request); query.CorpId = customerModel.CorpID; query.Customer = customerModel; int code = 0; using (var transaction = this.Context.Database.BeginTransaction()) { try { code = _cancelRetModOrderServiceBll.CancelFltModApplyByWaitAuditStep(query); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw; } } return(new CancelFltModApplyResponseViewModel() { Code = code }); }
/// <summary> /// 核价确认阶段取消申请 /// </summary> /// <param name="query"></param> /// <returns></returns> public int CancelFltModApplyByWaitAuditStep(CancelFltRetModApplyModel query) { FltRetModApplyEntity fltRetModApplyEntity = _fltRetModApplyDal.Find <FltRetModApplyEntity>(query.Rmid); string orderType = fltRetModApplyEntity.OrderType == "M" ? "改签" : "退票"; if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() != "administrator" && query.Customer.Cid != fltRetModApplyEntity.Cid) { throw new Exception($"查无此{orderType}申请"); } if (!string.IsNullOrEmpty(query.Customer?.UserID) && query.Customer.UserID.ToLower() == "administrator") { throw new Exception($"管理员帐号不能取消{orderType}申请"); } string orderStatus = FltModApplyStatusEnum.C.ToString(); string wOrderStatus = FltModApplyStatusEnum.A.ToString(); if (fltRetModApplyEntity.OrderType == "R") { orderStatus = FltRetApplyStatusEnum.C.ToString(); wOrderStatus = FltRetApplyStatusEnum.A.ToString(); } if (fltRetModApplyEntity.OrderStatus == orderStatus) { throw new Exception($"当前{orderType}申请已经取消!"); } if (fltRetModApplyEntity.OrderStatus != wOrderStatus) { throw new Exception($"当前{orderType}申请无法取消!"); } fltRetModApplyEntity.OrderStatus = orderStatus; _fltRetModApplyDal.Update(fltRetModApplyEntity, new string[] { "OrderStatus" }); List <FltRetModFlightApplyEntity> fltRetModFlightApplyEntities = _fltRetModFlightApplyDal.Query <FltRetModFlightApplyEntity>(n => n.Rmid == query.Rmid, true).ToList(); foreach (var fltRetModFlightApplyEntity in fltRetModFlightApplyEntities) { fltRetModFlightApplyEntity.OrderStatus = orderStatus; _fltRetModFlightApplyDal.Update(fltRetModFlightApplyEntity, new string[] { "OrderStatus" }); } FltRetModApplyLogEntity log = new FltRetModApplyLogEntity(); log.LogTime = DateTime.Now; log.LogType = "取消申请"; log.Oid = "Sys"; log.Remark = "核价确认时取消了申请"; log.Rmid = query.Rmid; _fltRetModApplyLogDal.Insert(log); return(0); }