async public void T_PublishTwoWayAsync(string id1) {// TODO: Add Testing logic here using (var mqProxy = new QuProxy <IHelloQuService>("localhost")) { var quRlt = mqProxy.Svc.TwoWayCall(id1); var obj = await mqProxy.AsyncWaitResult(quRlt); Debug.WriteLine(obj.Summary); } }
async public void IssueOrder(Order order) { var paymentDetail = new PaymentDetail() { Id = Guid.NewGuid().ToString() , TaxRate = 5 , Amount = order.Detail.Quantity * 1000 }; order.PaymentDetailRecord = paymentDetail; order.Status = Order.OrderStatus.Create; order.Comment = "訂單成立!"; OrderContext.Instance.Insert(order); //using (var mqProxy = new QuProxy<IPaymentService>("service.rabbitmq"))//host暫時 using (var mqProxy = new QuProxy <IPaymentService>(connSrc, loggerFactory)) { switch (order.Detail.PayMethod) { case OrderDetail.PayMethodMode.Bank: var quRlt = mqProxy.Svc.BankTransfers(order.Detail.PaymentAccout, storePaymentAccount, paymentDetail); var transferRecord = await mqProxy.AsyncWaitResult(quRlt); if (transferRecord.Succes) { order.Status = Order.OrderStatus.Paid; order.Comment = "已付款,進行備貨中!"; } else { order.Status = Order.OrderStatus.Trouble; order.Comment = transferRecord.Info; } break; case OrderDetail.PayMethodMode.Wire: mqProxy.Svc.WireTransfer(storePaymentAccount, paymentDetail); order.Status = Order.OrderStatus.Paying; order.Detail.PaymentAccout = storePaymentAccount; order.Comment = "等待付款!"; break; } } OrderContext.Instance.Update(order); }