コード例 #1
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                HttpHelper helper = new HttpHelper();
                string     url    = ConfigFile.ReadConfig("Car", "UnLockTicket");

                _carEntity._UnLockTicketRequest           = new UnLockTicketRequest();
                _carEntity._UnLockTicketRequest.TicketIds = _carEntity.TicketId;

                string postData = PubFun.GetJsonString(_carEntity._UnLockTicketRequest);
                Log.Info("PostData:" + postData);
                postData = PubFun.Encrypt(postData);

                url += "&data=" + postData.Replace("+", "%2b");

                HttpItem   item   = GetHttpItem(url, "", "utf-8");
                HttpResult result = helper.GetHtml(item);

                AppLog.Write("httpResult2:" + result.Html, AppLog.LogMessageType.Info);

                if (result.StatusCode == HttpStatusCode.OK)
                {
                    string json = PubFun.Decrypt(result.Html); //, ConfigFile.ReadConfig("AppData", "DesKey"));
                    AppLog.Write("json:" + json, AppLog.LogMessageType.Info);
                    _carEntity._UnLockTicketResponse = PubFun.GetJsonObject <UnLockTicketResponse>(json);
                    if (_carEntity._UnLockTicketResponse != null)
                    {
                        if (string.IsNullOrEmpty(_carEntity._UnLockTicketResponse.ErrorCode))
                        {
                            e.Cancel = false;
                        }
                        else
                        {
                            e.Cancel = false;
                            ShowMessageAndGoBack(_carEntity._UnLockTicketResponse.ErrorCode + ":" + _carEntity._UnLockTicketResponse.Msg);
                            e.Result = new object();
                            return;
                        }
                    }
                    else
                    {
                        e.Cancel = true;
                    }
                }
                else
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                AppLog.Write("UnLockTicketProcessDeal http Err:" + ex.Message, AppLog.LogMessageType.Error);
                e.Cancel = true;
            }
        }
コード例 #2
0
ファイル: CarQueryInputDeal.cs プロジェクト: radtek/RLPayment
        /// <summary>
        /// 没取到值返回true
        /// </summary>
        /// <returns></returns>
        private bool ProcessEndCity()
        {
            try
            {
                // Thread.Sleep(6000);
                HttpHelper helper = new HttpHelper();
                string     url    = ConfigFile.ReadConfig("Car", "ToCity");

                QueryTerminusByCityRequest request = new QueryTerminusByCityRequest();
                request.CityName = _carEntity.SelectStartCity.CityName;
                request.CityId   = _carEntity.SelectStartCity.CityId;
                request.StopName = "";
                string postData = PubFun.GetJsonString(request);
                Log.Info("PostData:" + postData);
                postData = PubFun.Encrypt(postData);

                url += "&data=" + postData.Replace("+", "%2b");

                HttpItem   item   = GetHttpItem(url, "", "utf-8");
                HttpResult result = helper.GetHtml(item);
                Log.Info("httpResult2:" + result.Html);

                if (result.StatusCode == HttpStatusCode.OK)
                {
                    string json = PubFun.Decrypt(result.Html);
                    Log.Info("json:" + json);
                    _carEntity._QueryTerminusByCityResponse = PubFun.GetJsonObject <QueryTerminusByCityResponse>(json);
                    if (_carEntity._QueryTerminusByCityResponse != null)
                    {
                        if (string.IsNullOrEmpty(_carEntity._QueryTerminusByCityResponse.ErrorCode))
                        {
                            return(false);
                        }
                        else
                        {
                            ShowMessageAndGoBack(_carEntity._QueryTerminusByCityResponse.ErrorCode + ":" + _carEntity._QueryTerminusByCityResponse.Msg);
                            return(true);
                        }
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                AppLog.Write("[ProcessEndCity Err]" + ex.Message, AppLog.LogMessageType.Error);
                return(true);
            }
        }