Ejemplo n.º 1
0
        /// <summary>
        ///     赎回通知交易
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btn_RedemptionTrisfer_Click(object sender, EventArgs e)
        {
            //
            try
            {
                this.btn_RedemptionTrisfer.Enabled = false;
                BrokeredMessage brokeredMessage;
                this.lbl_showmsg5.Text        = "正在消耗,请稍等......";
                this.txb_RedemptionFnums.Text = "0";
                this.txb_RedemptionSnums.Text = "0";
                do
                {
                    brokeredMessage = this.messageReceiverRedemption.Receive();
                    if (brokeredMessage != null)
                    {
                        string batchBookCreditInfos = brokeredMessage.GetBody <string>();
                        //转json
                        JObject jObject = JObject.Parse(batchBookCreditInfos);
                        if (jObject == null)
                        {
                            continue; //MessageData
                        }
                        TirisfalUserRedemptionInfoModel tirisfalUserRedemptionInfoModel = jObject["MessageData"].ToString().FromJson <TirisfalUserRedemptionInfoModel>();
                        //重试5次执行数据
                        for (int i = 0; i < 5; i++)
                        {
                            Tuple <bool, string> result = await YemApiService.RedemptionSendToTrader(this.loadAppSettings.AssetApiUrl, tirisfalUserRedemptionInfoModel, "RedemptionSendToTraderLogs");

                            if (result.Item1)
                            {
                                this.UpdateTxtInfos(this.txb_RedemptionSnums);
                                break;
                            }
                            else
                            {
                                if (i == 4)
                                {
                                    this.UpdateTxtInfos(this.txb_RedemptionFnums);
                                    //记录下来数据
                                    Logger.LoadData(@"RedemptionSendToTraderInfos\ErrorDeadLineInfos.txt", tirisfalUserRedemptionInfoModel.ToJson());
                                    Logger.LoadData(@"RedemptionSendToTraderInfos\ErrorDeadLineInfos.txt", "\r\n");
                                }
                            }
                        }
                    }
                } while (brokeredMessage != null);
                this.btn_RedemptionTrisfer.Enabled = true;
                MessageBox.Show("本轮次执行完毕");
            }
            catch (Exception exception)
            {
                this.lbl_showmsg5.Text             = "发生一个错误" + exception.Message;
                this.btn_RedemptionTrisfer.Enabled = true;
                Logger.LoadData(@"RedemptionSendToTraderInfos\Errors.txt", exception.Message);
            }
        }
Ejemplo n.º 2
0
        //赎回通知交易系统/MessageToTifisfal/RedemptionSendToTrader
        private async Task <Tuple <bool, string> > RedemptionSendToTrader(TirisfalUserRedemptionInfoModel request)
        {
            HttpResponseMessage httpResponseMesage = new HttpResponseMessage();

            try
            {
                //DebtForBank/SendAdvanceDebt
                httpResponseMesage = await this.httpClient.PostAsJsonAsync($"{this.loadAppSettings.AssetApiUrl}MessageToTifisfal/RedemptionSendToTrader", request);

                CommonResult <bool> response = await httpResponseMesage.Content.ReadAsAsync <CommonResult <bool> >();

                if (response.Result)
                {
                    return(new Tuple <bool, string>(true, "成功"));
                }
                return(new Tuple <bool, string>(false, response.Message));
            }
            catch (Exception ex)
            {
                //log记录日志
                Logger.LoadData(@"GetJson\Error.txt", ex.Message + "---------" + await httpResponseMesage.Content.ReadAsStringAsync());
                return(new Tuple <bool, string>(false, ex.Message));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     通知赎回购买
 /// </summary>
 /// <returns></returns>
 public async Task SetRedistirisfalUserRedemptionInfoModelAsync(TirisfalUserRedemptionInfoModel model, string deptId)
 {
     await this.database.HashSetToCacheAsync("TirisfalUserRedemptionInfoModels", "List", deptId, model, TimeSpan.MaxValue);
 }
Ejemplo n.º 4
0
        //赎回通知交易系统/MessageToTifisfal/RedemptionSendToTrader
        public static async Task <Tuple <bool, string> > RedemptionSendToTrader(string url, TirisfalUserRedemptionInfoModel request, string logFolderName)
        {
            HttpResponseMessage httpResponseMesage = new HttpResponseMessage();

            try
            {
                //DebtForBank/SendAdvanceDebt
                httpResponseMesage = await InitialHttpClient().PostAsJsonAsync($"{url}MessageToTifisfal/RedemptionSendToTrader", request);

                CommonResult <bool> response = await httpResponseMesage.Content.ReadAsAsync <CommonResult <bool> >();

                if (response.Result)
                {
                    return(new Tuple <bool, string>(true, "成功"));
                }
                return(new Tuple <bool, string>(false, response.Message));
            }
            catch (Exception ex)
            {
                //log记录日志
                Logger.LoadData(Path.Combine(logFolderName, "Error.txt"), ex.Message + "---------" + await httpResponseMesage.Content.ReadAsStringAsync() + "----" + request.ToJson());
                return(new Tuple <bool, string>(false, ex.Message));
            }
        }