public void T_PublishTwoWay(string id1) {// TODO: Add Testing logic here using (var mqProxy = new QuProxy <IHelloQuService>("localhost")) { var quRlt = mqProxy.Svc.TwoWayCall(id1); var obj = mqProxy.WaitResult(quRlt); print(obj.Summary); } }
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); } }
public void T_Publish(string id1) { using (var mqProxy = new QuProxy <IHelloWorldService>("localhost")) { var id4 = new HelloInput() { UserName = "******", Date = DateTime.Today }; DateTime id3 = DateTime.Today; mqProxy.Svc.OneWayCall(id1, id4); } }
public void T_Publish2(string id1) { using (var mqProxy = new QuProxy <IHelloWorldService>("localhost")) { var id4 = new HelloInput() { UserName = "******", Date = DateTime.Today }; long id2 = 99; DateTime id3 = DateTime.Today; var rltStr = mqProxy.Svc.HelloGet(id1, "HI"); print(rltStr); var rlt = mqProxy.Svc.Hello(id1, id2, id3, id4); print($"API={nameof(IHelloWorldService.Hello)} User={rlt.UserName}\nDate={rlt.Date}\n{rlt.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); }
public bool WireDepositForPayment(string account, PaymentDetail detail) { BankAccount toAccount; if (!AccountContext.Instance.TryGetValue(account, out toAccount)) { return(false); } toAccount.AccountBalance += detail.Amount; lock (waitingWirePayments) { PaymentDetail toPaymentDetail; if (!waitingWirePayments.TryGetValue(detail.Id, out toPaymentDetail)) { return(false); } if (detail.Amount != toPaymentDetail.Amount) { return(false); } var rd = new TransferRecord() { At = DateTime.Now, Detail = toPaymentDetail, Succes = true }; //using (var mqProxy = new QuProxy<IPaymentCallbackService>("service.rabbitmq"))//host暫時 using (var mqProxy = new QuProxy <IPaymentCallbackService>(connSrc, loggerFactory))//host暫時 { mqProxy.Svc.WireTransferCommit(rd); } waitingWirePayments.Remove(detail.Id); } return(true); }