public formAutoSubmitOrder(OrderData_Otn order, string user, string postData, QueryLeftNewDTO trainInfo, List<Nomal_Passengers> passengers, string trainDate, CookieContainer cookie, string title, string defaultseat = "", bool fl = false) { InitializeComponent(); orderData = order; _user = user; this.Text += " " + title; this._postData = postData; this._trainData = trainInfo; this._cookieContainer = cookie; this._passengers = passengers; this._trainDate = trainDate; this._defaultSeat = defaultseat; string path = System.IO.Directory.GetCurrentDirectory() + "\\Sound_GetTicket.wav"; if (System.IO.File.Exists(path)) { sp = new System.Media.SoundPlayer(path); sp.Play(); } }
public string GetSingleForQueuePostData(OrderData_Otn orderData,System.Collections.Hashtable token) { return System.Web.HttpUtility.UrlEncode(string.Format("passengerTicketStr={0}&oldPassengerStr={1}&randCode={2}&purpose_codes={3}&key_check_isChange={4}&leftTicketStr={5}&train_location={6}&_json_att={7}&REPEAT_SUBMIT_TOKEN={8}", orderData.PassengerTicketStr, orderData.OldPassengerStr, orderData.RandCode, token["purposeCodes"].ToString(), token["keyCheck"].ToString(), token["leftTicket"].ToString(), token["trainLocation"].ToString(), "", token["Token"].ToString())).Replace("%3d", "=").Replace("%26", "&"); }
public string GetSingleForQueueAsyncPostData(OrderData_Otn orderData, System.Collections.Hashtable token) { return string.Format("passengerTicketStr={0}&oldPassengerStr={1}&randCode={2}&purpose_codes={3}&key_check_isChange={4}&leftTicketStr={5}&train_location={6}&_json_att=", orderData.PassengerTicketStr, orderData.OldPassengerStr, orderData.RandCode, orderData.Purpose_codes, token["keyCheck"].ToString(), token["leftTicket"].ToString(), token["trainLocation"].ToString()).Replace(",","%2c"); }
/*******************************************************更新********************************************************/ //验证订单的postdata public string GetCheckOrderPostData(OrderData_Otn orderInfo) { return System.Web.HttpUtility.UrlEncode(string.Format("cancel_flag={0}&bed_level_order_num={1}&passengerTicketStr={2}&oldPassengerStr={3}&tour_flag={4}&randCode={5}&_json_att={6}&REPEAT_SUBMIT_TOKEN={7}", orderInfo.Cancel_flag, orderInfo.Bed_level_order_num, orderInfo.PassengerTicketStr, orderInfo.OldPassengerStr, orderInfo.Tour_flag, orderInfo.RandCode, orderInfo.Json_att, orderInfo.REPEAT_SUBMIT_TOKEN)).Replace("%3d", "=").Replace("%26", "&"); }
//生成autoSubmit PostData public string GetAutoSubmitPostDataString(QueryLeftNewDTO data, List<Nomal_Passengers> passengers, OrderData_Otn orderData) { string postData = string.Format("secretStr={0}&train_date={1}&tour_flag={2}&purpose_codes={3}&query_from_station_name={4}&query_to_station_name={5}&&cancel_flag={6}&bed_level_order_num={7}&passengerTicketStr={8}&oldPassengerStr={9}", data.SecretStr, data.Start_train_date.Substring(0, 4) + "-" + data.Start_train_date.Substring(4, 2) + "-" + data.Start_train_date.Substring(6, 2), "dc", chkIncludeStudent.Checked ? "0x00" : "ADULT", System.Web.HttpUtility.UrlEncode(data.Start_station_name), System.Web.HttpUtility.UrlEncode(data.End_station_name), orderData.Cancel_flag, orderData.Bed_level_order_num, orderData.PassengerTicketStr, orderData.OldPassengerStr); return postData; }
//开始预定 public void RunBook(QueryLeftNewDTO data, string seat = "", bool boo = false) { DeterMineCall(() => { if (!chkAutoSubmit.Checked) { if (data.CanWebBuy == "Y") { string postData = ""; postData += GetPostDataString(data); if (seat != "") { AutoWorkFinished(); var form = new formSubmitOrder(this,_userName, postData, data, _passengersData, dtpRiqi.Value.Date.ToString("yyyy-MM-dd"), cookieContainer, String.Format("{0:MM.dd} [{1}->{2}]", dtpRiqi.Value, cboFrom.Text, cboTo.Text), seat, boo); //this.Visible = true; //this.WindowState = FormWindowState.Normal; form.ShowDialog(); } else { AutoWorkFinished(); var form1 = new formSubmitOrder(this,_userName, postData, data, _passengersData, dtpRiqi.Value.Date.ToString("yyyy-MM-dd"), cookieContainer, String.Format("{0:MM.dd} [{1}->{2}]", dtpRiqi.Value, cboFrom.Text, cboTo.Text)); //this.Visible = true; //this.WindowState = FormWindowState.Normal; form1.ShowDialog(); } } else { MessageBox.Show(this, "该车次无票可定", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else //自动提交 { if (data.CanWebBuy == "Y") { var passengers = new List<Nomal_Passengers>(); passengers.AddRange(_passengersData.Where(x => x.IsCheck).Select(x => x).ToList<Nomal_Passengers>()); var orderData = new OrderData_Otn(data, passengers, true, "", "", chkIncludeStudent.Checked ? "0x00" : "ADULT"); string postData = ""; postData += GetAutoSubmitPostDataString(data, passengers, orderData); AutoWorkFinished(); var form1 = new formAutoSubmitOrder(orderData, _userName, postData, data, _passengersData, dtpRiqi.Value.Date.ToString("yyyy-MM-dd"), cookieContainer, String.Format("{0:MM.dd} [{1}->{2}]", dtpRiqi.Value, cboFrom.Text, cboTo.Text)); //this.Visible = true; //this.WindowState = FormWindowState.Normal; form1.ShowDialog(); } else { MessageBox.Show(this, "该车次无票可定", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }); }
private void btnSubmit_Click(object sender, EventArgs e) { //queueFlag = 0; if (_tokenAndLeftTicket["Token"].ToString() == "") { MessageBox.Show("获取Token失败,该票已停售或已卖完.", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); //new MessageBoxEx("获取Token失败,该票已停售或已卖完!", MessageboxExIcon.ERROR) { NewPrivateInterval = 1000 }.Show(); return; } int itemCount = dgvPassenger.Rows.Count; if (itemCount <= 0) { lblState1.Text = "请选择联系人!"; } else { if (txtRandCode1.Text.Length != 4) { lblState1.Text = "请输入正确的验证码!"; return; } btnSubmit.Enabled = false; var passengers = new List<Nomal_Passengers>(); for (int i = 0; i < dgvPassenger.Rows.Count; i++) { var pas = ((Nomal_Passengers)(dgvPassenger.Rows[i].Cells["xingming"].Tag)); pas.SeatCode = DatasList.SeatType[dgvPassenger.Rows[i].Cells[1].Value].ToString(); pas.TicketCode = DatasList.TicketType[dgvPassenger.Rows[i].Cells[2].Value].ToString(); pas.IsCheck = true; passengers.Add(pas); } orderData = new OrderData_Otn(_trainData, passengers); orderData.RandCode = txtRandCode1.Text; orderData.REPEAT_SUBMIT_TOKEN = _tokenAndLeftTicket["Token"].ToString(); getPostData.OData = orderData; DetermineCall(() => { lblState1.Text = "开始确认订单..."; Application.DoEvents(); }); ConfirmOrder(); } }
public string GetSingleForQueueAsyncPostData(OrderData_Otn orderData, System.Collections.Hashtable token) { return(string.Format("passengerTicketStr={0}&oldPassengerStr={1}&randCode={2}&purpose_codes={3}&key_check_isChange={4}&leftTicketStr={5}&train_location={6}&_json_att=", orderData.PassengerTicketStr, orderData.OldPassengerStr, orderData.RandCode, orderData.Purpose_codes, token["keyCheck"].ToString(), token["leftTicket"].ToString(), token["trainLocation"].ToString()).Replace(",", "%2c")); }
public string GetSingleForQueuePostData(OrderData_Otn orderData, System.Collections.Hashtable token) { return(System.Web.HttpUtility.UrlEncode(string.Format("passengerTicketStr={0}&oldPassengerStr={1}&randCode={2}&purpose_codes={3}&key_check_isChange={4}&leftTicketStr={5}&train_location={6}&_json_att={7}&REPEAT_SUBMIT_TOKEN={8}", orderData.PassengerTicketStr, orderData.OldPassengerStr, orderData.RandCode, token["purposeCodes"].ToString(), token["keyCheck"].ToString(), token["leftTicket"].ToString(), token["trainLocation"].ToString(), "", token["Token"].ToString())).Replace("%3d", "=").Replace("%26", "&")); }
/*******************************************************更新********************************************************/ //验证订单的postdata public string GetCheckOrderPostData(OrderData_Otn orderInfo) { return(System.Web.HttpUtility.UrlEncode(string.Format("cancel_flag={0}&bed_level_order_num={1}&passengerTicketStr={2}&oldPassengerStr={3}&tour_flag={4}&randCode={5}&_json_att={6}&REPEAT_SUBMIT_TOKEN={7}", orderInfo.Cancel_flag, orderInfo.Bed_level_order_num, orderInfo.PassengerTicketStr, orderInfo.OldPassengerStr, orderInfo.Tour_flag, orderInfo.RandCode, orderInfo.Json_att, orderInfo.REPEAT_SUBMIT_TOKEN)).Replace("%3d", "=").Replace("%26", "&")); }