Exemplo n.º 1
0
        public HttpResponseMessage PrintTicketCallBack()
        {
            factory = new PrintTicketFactory();
            domain  = factory.CreateDomainObj();

            IOrderDomainFactory orderDomainFactory = new OrderDomainFactory();
            IOrderDomain        orderDomain        = orderDomainFactory.CreateUpdateOrderDomainObj();

            IAccountDomainFactory accountDomainFactory = new AccountDomainFactory();
            IAccountDomain        accountDomain        = accountDomainFactory.CreateDomainObj();

            domain.OrderTicketEvent      += orderDomain.DoOrderTicketEvent;
            orderDomain.PaySupplierEvent += accountDomain.DoPaySupplierEvent;
            var str = domain.DoPrintTicket();

            domain.OrderTicketEvent      -= orderDomain.DoOrderTicketEvent;
            orderDomain.PaySupplierEvent -= accountDomain.DoPaySupplierEvent;

            LogHelper.WriteLog("确认出票回调:" + str, "CallBack");

            var response = Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent("SUCCESS", Encoding.UTF8);
            return(response);
        }
Exemplo n.º 2
0
        public HttpResponseMessage RefundCallBack()
        {
            try
            {
                factory = new RefundTicketFactory();
                domain  = factory.CreateDomainObj();
                IOrderDomainFactory orderDomainFactory = new OrderDomainFactory();
                IOrderDomain        traOrderDomain     = orderDomainFactory.CreateUpdateOrderDomainObj();

                IAccountDomainFactory accountDomainFactory = new AccountDomainFactory();
                IAccountDomain        accountDomain        = accountDomainFactory.CreateDomainObj();

                domain.RefundCallBackEvent          += traOrderDomain.RefundTicketCallBackEvent;
                traOrderDomain.CollectSupplierEvent += accountDomain.DoCollectSupplierEvent;
                domain.DoRefundTicket();
                domain.RefundCallBackEvent          -= traOrderDomain.RefundTicketCallBackEvent;
                traOrderDomain.CollectSupplierEvent -= accountDomain.DoCollectSupplierEvent;
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("Api异常信息:" + ex.Message + "||||||报错路径:" + ex.StackTrace, "MojoryException");
            }
            //不用管异常处理,强制返回一个success,这样就能收到退款
            var response = Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent("SUCCESS", Encoding.UTF8);
            return(response);
        }
Exemplo n.º 3
0
        public void GetGrabTicketNotice(string responseData)
        {
            bool flag = _responseAsyncGrabTicketBll.ResponseGrabTicketResult(responseData); //获取异步抢票通知

            using (var transaction = this.Context.Database.BeginTransaction())
            {
                try
                {
                    if (flag)
                    {
                        IAccountDomainFactory accountDomainFactory = new AccountDomainFactory();
                        IAccountDomain        accountDomain        = accountDomainFactory.CreateDomainObj();

                        _getGrabTicketNoticeServiceBll.PaySupplierEvent += accountDomain.DoPaySupplierEvent;

                        _getGrabTicketNoticeServiceBll.GetGrabTicketSuccessNotice(
                            _responseAsyncGrabTicketBll.SuccessedResult);

                        _getGrabTicketNoticeServiceBll.PaySupplierEvent -= accountDomain.DoPaySupplierEvent;
                    }
                    else
                    {
                        _getGrabTicketNoticeServiceBll.GetGrabTicketFailedNotice(
                            _responseAsyncGrabTicketBll.FailedResult);
                    }

                    transaction.Commit();
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }


            //发送邮件通知
            //if (flag)
            //{
            //    string context = string.Format("");
            //    EmailHelper.SendEmail("", "火车抢票成功通知", null, null, context, _email);
            //}
            //else
            //{
            //}
        }