Beispiel #1
0
 public FrmConfirmOrder(QueryTrainData data)
 {
     this.InitializeComponent();
     this.LoadEvents();
     Data = data;
 }
Beispiel #2
0
 /// <summary>
 /// 请求提交订单
 /// </summary>
 /// <returns></returns>
 private bool RequestSubmitOrder(QueryTrainData data)
 {
     bool result = false;
     RequestPackage request = new RequestPackage();
     request.Encoding = Encoding.UTF8;
     request.RequestURL = "/otn/leftTicket/submitOrderRequest";
     request.RefererURL = "/otn/leftTicket/init";
     request.Params.Add("secretStr", data.secretStr);
     request.Params.Add("train_date", this.dtpTrainDate.Value.ToString("yyyy-MM-dd"));
     request.Params.Add("back_train_date", DateTime.Now.ToString("yyyy-MM-dd"));
     request.Params.Add("tour_flag", "dc");
     request.Params.Add("purpose_codes", "ADULT");
     request.Params.Add("query_from_station_name", data.QueryLeftNewDTO.from_station_name);
     request.Params.Add("query_to_station_name", data.QueryLeftNewDTO.to_station_name);
     ArrayList list = HttpContext.Send(request);
     if (list.Count == 2)
     {
         string jsonResult = Encoding.UTF8.GetString(list[1] as byte[]);
         try
         {
             ResponseBase response = JsonConvert.DeserializeObject<ResponseBase>(jsonResult);
             if (response.status)
             {
                 result = true;
             }
             else if (response.messages != null && response.messages.Length > 0)
             {
                 throw new Exception(response.messages[0]);
             }
         }
         catch
         {
             throw new Exception("网络可能存在问题,请重试!");
         }
     }
     else
     {
         Log.Log.Write(list);
     }
     return result;
 }
Beispiel #3
0
        /// <summary>
        /// 预定
        /// </summary>
        private void Reservation(QueryTrainData data)
        {
            if (data != null)
            {
                try
                {
                    //PWLoading.Show(this, "正在请求提交,请稍后...",
                    //    new Func<object>(() =>
                    //    {
                    //        return this.RequestSubmitOrder(data);
                    //    }),
                    //    new Action<object>((result) =>
                    //    {
                    //        bool res = false;
                    //        if (result != null)
                    //        {
                    //            bool.TryParse(result.ToString(), out res);
                    //        }
                    //        if (res)
                    //        {
                    //            FrmConfirmOrder frmConfirm = new FrmConfirmOrder();
                    //            //if (frmConfirm.ShowDialog() == DialogResult.OK)
                    //            //{
                    //            //}
                    //            frmConfirm.Show(this);
                    //        }
                    //    })
                    //);
                    using (FrmConfirmOrder frmConfirm = new FrmConfirmOrder(data))
                    {
                        if (frmConfirm.ShowDialog() == DialogResult.OK)
                        {

                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "提示");
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// 加载查询数据
 /// </summary>
 /// <param name="dataArray"></param>
 private void LoadQueryData(QueryTrainData[] dataArray)
 {
     this.dgvQuery.Rows.Clear();
     if(dataArray != null && dataArray.Length > 0)
     {
         foreach (QueryTrainData item in dataArray)
         {
             if (item.QueryLeftNewDTO != null)
             {
                 int index = this.dgvQuery.Rows.Add(
                     item.QueryLeftNewDTO.station_train_code,
                     item.QueryLeftNewDTO.from_station_name + "-" + item.QueryLeftNewDTO.to_station_name,
                     item.QueryLeftNewDTO.start_time + "-" + item.QueryLeftNewDTO.arrive_time,
                     item.QueryLeftNewDTO.lishi,
                     item.QueryLeftNewDTO.swz_num,
                     item.QueryLeftNewDTO.tz_num,
                     item.QueryLeftNewDTO.zy_num,
                     item.QueryLeftNewDTO.ze_num,
                     item.QueryLeftNewDTO.gr_num,
                     item.QueryLeftNewDTO.rw_num,
                     item.QueryLeftNewDTO.yw_num,
                     item.QueryLeftNewDTO.rz_num,
                     item.QueryLeftNewDTO.yz_num,
                     item.QueryLeftNewDTO.wz_num,
                     item.QueryLeftNewDTO.qt_num,
                     item.buttonTextInfo);
                 DataGridViewRow row = this.dgvQuery.Rows[index];
                 for (int i = 4; i < row.Cells.Count; i++)
                 {
                     DataGridViewCell cell = row.Cells[i];
                     if (cell.Value.ToString() != "*" && cell.Value.ToString() != "--" && cell.Value.ToString() != "无")
                     {
                         cell.Style.ForeColor = Color.Green;
                     }
                 }
                 if (item.QueryLeftNewDTO.canWebBuy == "Y")
                 {
                     DataGridViewDisableButtonCell cell = row.Cells[15] as DataGridViewDisableButtonCell;
                     cell.Enabled = true;
                 }
                 else
                 {
                     DataGridViewDisableButtonCell cell = row.Cells[15] as DataGridViewDisableButtonCell;
                     cell.Enabled = false;
                 }
                 row.Tag = item;
             }
         }
     }
 }