public AddRetApplyResponseViewModel AddRetApply(AddRetApplyRequestViewModel request) { int rmid = 0; AddRetModApplyModel modApplyModel = Mapper.Map <AddRetApplyRequestViewModel, AddRetModApplyModel>(request); //1.获取退票乘客对应 CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid); modApplyModel.Customer = customerModel; modApplyModel.IsOnlineRefund = request.IsOnline; modApplyModel.OrderType = "R"; modApplyModel.CorpId = customerModel.CorpID; CorporationModel corporationModel = _getCorpServiceBll.GetCorp(customerModel.CorpID); if (corporationModel.IsAmplitudeCorp == "T") { modApplyModel.OrderStatus = "T"; } using (var transaction = this.Context.Database.BeginTransaction()) { try { rmid = _addFltDomesticRetApplyServiceBll.AddRetApply(modApplyModel); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw; } } new TaskFactory().StartNew(() => { //2.发送提醒邮件 OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(corporationModel.ResponsibleOid); string mail = operatorModel.Email; string corporationName = corporationModel.CorpName; StringBuilder mailContent = new StringBuilder(); mailContent.Append("<b>客户退单提醒:<b/>"); mailContent.Append("<br/>"); mailContent.Append("[" + corporationName + "] 已经申请了退单,订单编号:" + request.OrderId.ToString() + ",请差旅顾问及时处理!"); mailContent.Append("<br/>"); mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>"); if (!string.IsNullOrEmpty(mail)) { bool flag = EmailHelper.SendEmail("", "客户退单提醒", null, null, mailContent.ToString(), mail); } }); return(new AddRetApplyResponseViewModel() { Rmid = rmid }); }
public ResponseBaseViewModel <AddRetApplyResponseViewModel> AddRetApply( [FromBody] AddRetApplyRequestViewModel request) { request.Cid = this.GetCid(); request.OrderSource = this.GetOrderSource(); if (!string.IsNullOrEmpty(request.UploadUrl)) { request.UploadUrl = request.UploadUrl.Replace("\"", ""); } AddRetApplyResponseViewModel responseViewModel = _addFltDomesticRetApplyApplication.AddRetApply(request); ResponseBaseViewModel <AddRetApplyResponseViewModel> v = new ResponseBaseViewModel <AddRetApplyResponseViewModel> { Flag = new ResponseCodeViewModel() { Code = 0, MojoryToken = this.GetToken() }, Data = responseViewModel }; return(v); }