Ejemplo n.º 1
0
        public AddModApplyResponseViewModel AddModApply(AddModApplyRequestViewModel request)
        {
            int rmid = 0;

            AddRetModApplyModel modApplyModel = Mapper.Map <AddModApplyRequestViewModel, AddRetModApplyModel>(request);

            //1.获取改签乘客
            CustomerModel customerModel = _getCustomerServiceBll.GetCustomerByCid(request.Cid);

            modApplyModel.Customer       = customerModel;
            modApplyModel.IsOnlineRefund = request.IsOnline;
            modApplyModel.OrderType      = "M";
            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 = _addFltDomesticModApplyServiceBll.AddModApply(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 AddModApplyResponseViewModel()
            {
                Rmid = rmid
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 针对订单审批后发邮件提醒
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public BaseDealAduitResultDetailModel GetCorpAduitOrderDetailmail(DoAduitOrderRequestViewModel request)
        {
            List <BaseDealAduitResultDetailModel> dorder      = _corpAduitBll.GetCorpAduitOrderDetail(request.AduitOrderId);
            BaseDealAduitResultDetailModel        detailorder = new BaseDealAduitResultDetailModel();

            if (dorder.Count > 0)
            {
                string type     = dorder[0].OrderSourceType.ToString();
                bool   isFly    = false;
                string orderOid = "0";
                switch (type)
                {
                //飞机正单
                case "Flt":
                    detailorder.OrderId = dorder[0].OrderId;
                    FltOrderEntity orderentity = base.Context.Set <FltOrderEntity>().Find(detailorder.OrderId);
                    orderOid = orderentity.CreateOid;
                    isFly    = true;
                    break;

                //飞机改签
                case "FltModApply":
                    detailorder.OrderId = dorder[0].OrderId;
                    FltRetModApplyEntity FltRetentity = base.Context.Set <FltRetModApplyEntity>().Find(detailorder.OrderId);
                    detailorder.OrderId = FltRetentity.OrderId;
                    orderOid            = FltRetentity.CreateOid;
                    isFly = true;
                    break;

                //飞机退票
                case "FltRetApply":
                    detailorder.OrderId = dorder[0].OrderId;
                    FltRetModApplyEntity Retentity = base.Context.Set <FltRetModApplyEntity>().Find(detailorder.OrderId);
                    detailorder.OrderId = Retentity.OrderId;
                    orderOid            = Retentity.CreateOid;
                    isFly = true;
                    break;
                }
                OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(orderOid);
                string        mail          = operatorModel.Email;
                string        approve       = "";
                if (!request.IsAgree)
                {
                    approve = "审批未通过";
                }
                else
                {
                    approve = "审批已通过";
                }
                StringBuilder mailContent = new StringBuilder();
                mailContent.Append("<b>客户审批提醒:<b/>");
                mailContent.Append("<br/>");
                mailContent.Append("客户已经审批了订单,订单编号:" + detailorder.OrderId.ToString() + "," + approve + "。");
                mailContent.Append("<br/>");
                mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>");
                //发送邮件
                if (!string.IsNullOrEmpty(mail) && isFly)
                {
                    bool flag = EmailHelper.SendEmail("", "客户审批提醒", null, null, mailContent.ToString(), mail);
                }
            }
            return(detailorder);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 创建机票订单
        /// </summary>
        /// <param name="orderViewModel"></param>
        /// <returns></returns>
        public AddOrderResponseViewModel AddDomesticOrderApplicationService(AddOrderRequestViewModel orderViewModel)
        {
            string        oidTemp       = orderViewModel.CreateOid;
            int           orderid       = 0;
            AddOrderModel addOrderModel = Mapper.Map <AddOrderRequestViewModel, AddOrderModel>(orderViewModel);

            //0.获取客户信息服务
            addOrderModel.Customer = _getCustomerServiceBll.GetCustomerByCid(orderViewModel.Cid);
            if (!string.IsNullOrEmpty(addOrderModel.Customer.CorpID))
            {
                CorporationModel corporationModel = _getCorpServiceBll.GetCorp(addOrderModel.Customer.CorpID);
                if (!addOrderModel.IsPrint.HasValue)
                {
                    addOrderModel.IsPrint = corporationModel.IsPrint ?? 0;
                }
                if (!string.IsNullOrEmpty(corporationModel.ResponsibleOid) && orderViewModel.OrderSource != "O")
                {
                    addOrderModel.CreateOid = corporationModel.ResponsibleOid;
                }
            }


            //1.获取乘机人的联系人Id对应的乘客信息
            List <int> contactList = addOrderModel.PassengerList.Select(n => n.Contactid ?? 0).ToList();

            addOrderModel.PassengerCustomerList = _getCorpPassengerCustomerServiceBll.GetCorpPassengerCustomer(contactList);

            OperatorModel operatorModel = _getOperatorServiceBll.GetOperatorByOid(addOrderModel.CreateOid);


            //2.创建订单服务
            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    orderid = _addOrderServiceBll.AddDomesticOrder(addOrderModel);

                    #region 送审

                    if (orderid > 0)
                    {
                        SubmitCorpAduitOrderModel submitCorpAduitOrder = new SubmitCorpAduitOrderModel()
                        {
                            OrderInfoList = new List <SubmitCorpAduitOrderDetailModel>()
                            {
                                new SubmitCorpAduitOrderDetailModel()
                                {
                                    OrderId   = orderid,
                                    OrderType = OrderSourceTypeEnum.Flt
                                }
                            },
                            PolicyId        = addOrderModel.CorpPolicyId,
                            AduitConfigId   = addOrderModel.CorpAduitId,
                            Source          = orderViewModel.OrderSource,
                            SubmitCid       = orderViewModel.Cid,
                            SubmitOid       = oidTemp,
                            IsViolatePolicy =
                                (addOrderModel.FlightList.Find(n => !string.IsNullOrEmpty(n.CorpPolicy)) != null
                                    ? true
                                    : false),
                            OrderType = OrderSourceTypeEnum.Flt
                        };
                        _submitCorpAduitOrderServiceBll.Submit(submitCorpAduitOrder);
                    }

                    #endregion

                    transaction.Commit();
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw;
                }
            }
            string PNRstr  = "";                                                        //获取后邮件中使用
            string testCid = AppSettingsHelper.GetAppSettings(AppSettingsEnum.TestCid); //生产环境,测试帐号不许定位
            if (testCid != orderViewModel.Cid.ToString())
            {
                //3.调取pnr定位服务
                PNRstr = _getPnrNoServiceBll.GetPnrNo(orderid, operatorModel?.Email);
            }
            //4.发送提醒邮件
            new TaskFactory().StartNew(() =>
            {
                string mail               = operatorModel.Email;
                string corporationName    = addOrderModel.PassengerCustomerList[0].Corporation.CorpName;
                string operatorName       = addOrderModel.Cname;
                string dport              = addOrderModel.FlightList[0].Dport;
                string aport              = addOrderModel.FlightList[0].Aport;
                string aDate              = addOrderModel.FlightList[0].TackoffTime.ToString();
                string bDate              = addOrderModel.FlightList[0].ArrivalsTime.ToString();
                StringBuilder mailContent = new StringBuilder();
                mailContent.Append("<b>订单生成提醒:<b/>");
                mailContent.Append("<br/>");
                mailContent.Append("[" + corporationName + "] 已生成订单:" + orderid + ",请差旅顾问及时处理!");
                mailContent.Append("<br/>");
                mailContent.Append("联系人姓名:" + addOrderModel.Cname + "");
                mailContent.Append("<br/>");
                mailContent.Append("行程:" + dport + " - " + aport + "");
                mailContent.Append("<br/>");
                mailContent.Append("起飞时间:" + aDate + "");
                mailContent.Append("<br/>");
                mailContent.Append("抵达时间:" + bDate + "");
                mailContent.Append("<br/>");
                mailContent.Append("<b>下单时间:" + DateTime.Now + ",请及时关注~<b/>");
                if (!string.IsNullOrEmpty(mail))
                {
                    bool flag = EmailHelper.SendEmail("", "订单生成提醒", null, null, mailContent.ToString(), mail);
                }
            });

            return(new AddOrderResponseViewModel()
            {
                OrderId = orderid
            });
        }