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();
            }
        }
Пример #2
0
        public OrderData_Otn(QueryLeftNewDTO trainInfo, List <Nomal_Passengers> passengers, bool auto = false, string token = "", string code = "", string purpose = "ADULT")
        {
            train_date          = GetDateTime(trainInfo.Start_train_date);
            train_no            = trainInfo.Train_no;
            stationTrainCode    = trainInfo.Station_train_code;
            seatType            = trainInfo.Seat_types;
            fromStationTelecode = trainInfo.From_station_telecode;
            toStationTelecode   = trainInfo.To_station_telecode;
            leftTicket          = trainInfo.Yp_info;
            purpose_codes       = purpose;

            cancel_flag         = "2";
            bed_level_order_num = "000000000000000000000000000000";

            int i = 0;

            foreach (Nomal_Passengers passenger in passengers)
            {
                //如果是自动提交,需要把这里的Passenger_name进行url编码  System.Web.HttpUtility.UrlEncode
                //1,0,1,阿飞,1,152326196602010090,13522222222,N_1,0,1,啊啊,1,610104196212028315,,N
                passengerTicketStr += passenger.SeatCode + "," + passenger.Passenger_flag + "," + passenger.TicketCode + "," + passenger.Passenger_name
                                      + "," + passenger.Passenger_id_type_code + "," + passenger.Passenger_id_no + "," + passenger.Mobile_no + "," + "N" + ((i + 1) < passengers.Count ? "_" : "");
                //阿飞,1,152326198802010090,1_啊啊,1,610104196212028315,1_
                oldPassengerStr += passenger.Passenger_name + "," + passenger.Passenger_id_type_code + "," + passenger.Passenger_id_no
                                   + "," + passenger.TicketCode + "_";

                if (auto)
                {
                    passengerTicketStr = passengerTicketStr.Replace(passenger.Passenger_name, System.Web.HttpUtility.UrlEncode(passenger.Passenger_name));
                    oldPassengerStr    = oldPassengerStr.Replace(passenger.Passenger_name, System.Web.HttpUtility.UrlEncode(passenger.Passenger_name));
                }

                i++;
            }
            tour_flag            = "dc";
            _json_att            = "";
            randCode             = code;
            _REPEAT_SUBMIT_TOKEN = token;
        }
Пример #3
0
        public OrderData_Otn(QueryLeftNewDTO trainInfo,List<Nomal_Passengers> passengers,bool auto=false,string token="",string code="",string purpose="ADULT")
        {
            train_date = GetDateTime(trainInfo.Start_train_date);
            train_no = trainInfo.Train_no;
            stationTrainCode = trainInfo.Station_train_code;
            seatType = trainInfo.Seat_types;
            fromStationTelecode = trainInfo.From_station_telecode;
            toStationTelecode = trainInfo.To_station_telecode;
            leftTicket = trainInfo.Yp_info;
            purpose_codes = purpose;

            cancel_flag="2";
            bed_level_order_num = "000000000000000000000000000000";

            int i = 0;
            foreach(Nomal_Passengers passenger in passengers)
            {
                //如果是自动提交,需要把这里的Passenger_name进行url编码  System.Web.HttpUtility.UrlEncode
                //1,0,1,阿飞,1,152326196602010090,13522222222,N_1,0,1,啊啊,1,610104196212028315,,N
                passengerTicketStr += passenger.SeatCode + "," + passenger.Passenger_flag + "," + passenger.TicketCode + "," + passenger.Passenger_name
                    + "," + passenger.Passenger_id_type_code + "," + passenger.Passenger_id_no + "," + passenger.Mobile_no + "," + "N" + ((i + 1) < passengers.Count ? "_" : "");
                //阿飞,1,152326198802010090,1_啊啊,1,610104196212028315,1_
                oldPassengerStr += passenger.Passenger_name + "," + passenger.Passenger_id_type_code + "," + passenger.Passenger_id_no
                    + "," + passenger.TicketCode + "_";

                if (auto)
                {
                    passengerTicketStr = passengerTicketStr.Replace(passenger.Passenger_name, System.Web.HttpUtility.UrlEncode(passenger.Passenger_name));
                    oldPassengerStr = oldPassengerStr.Replace(passenger.Passenger_name, System.Web.HttpUtility.UrlEncode(passenger.Passenger_name));
                }

                i++;
            }
            tour_flag = "dc";
            _json_att = "";
            randCode = code;
            _REPEAT_SUBMIT_TOKEN = token;
        }
 public string GetSubmitOrderPostData(QueryLeftNewDTO train,System.Collections.Hashtable Token)
 {
     return System.Web.HttpUtility.UrlEncode(string.Format("train_date={0}&train_no={1}&stationTrainCode={2}&seatType={3}&fromStationTelecode={4}&toStationTelecode={5}&leftTicket={6}&purpose_codes={7}&_json_att={8}&REPEAT_SUBMIT_TOKEN={9}",
                        GetDateTime(train.Start_train_date), train.Train_no, train.Station_train_code, "1", train.From_station_telecode, train.To_station_telecode, Token["leftTicket"].ToString(), Token["purposeCodes"].ToString(), "", Token["Token"].ToString())).Replace("%3d", "=").Replace("%26", "&");
 }
Пример #5
0
 //绑定查询结果到datagridview
 public void DgvDataBind(List<JsonTrainData> data)
 {
     //if (chkCustomFilter.Checked)
     //{
     //    if (chkFilterNoSeat.Checked)
     //    {
     //        data = data.Where(x => x.QueryLeftNewDto.CanWebBuy=="Y").Select(x => x).ToList();
     //    }
         data=CustomFilter(data);
     //}
     lblTrainsCount.Text =string.Format("共有 {0} 趟车" ,data.Count);
     _BindingData = new BindingList<JsonTrainData>(data);
     var source = new BindingList<QueryLeftNewDTO>();
     foreach (var v in _BindingData)
     {
         var ql = new QueryLeftNewDTO();
         ql = v.QueryLeftNewDto;
         ql.ButtonTextInfo = v.ButtonTextInfo.Replace("<br/>", "");
         ql.SecretStr = v.SecretStr;
         source.Add(ql);
     }
     dgvTrainView.DataSource = source;
     dgvTrainView.Refresh();
     lblLastSelectTime.Text = DateTime.Now.ToLongTimeString();
     AutoTrainNoSource();
     plSetup.Enabled = true;
     btnSelectAll.Text = "查询";
 }
Пример #6
0
        private void chkCG_CheckedChanged(object sender, EventArgs e)
        {
            if (((CheckBox)sender).Name != "chkFilterNoSeat")
                chkCA.Checked = false;
            var list = new List<JsonTrainData>();
            CloneJsonTrainList(_trainData, list);
            //if (chkCustomFilter.Checked)
            //{
            if (chkFilterNoSeat.Checked)
            {
                list = list.Where(x => x.QueryLeftNewDto.CanWebBuy == "Y").Select(x => x).ToList();
            }
            list = CustomFilter(list);
            //}
            lblTrainsCount.Text = string.Format("共有 {0} 趟车", list.Count);
            _BindingData = new BindingList<JsonTrainData>(list);

            var source = new BindingList<QueryLeftNewDTO>();
            foreach (var v in _BindingData)
            {
                var ql = new QueryLeftNewDTO();
                ql = v.QueryLeftNewDto;
                ql.ButtonTextInfo = v.ButtonTextInfo.Replace("<br/>", "");
                ql.SecretStr = v.SecretStr;
                source.Add(ql);
            }
            dgvTrainView.DataSource = source;
            dgvTrainView.Refresh();
        }
Пример #7
0
        private void cboShijian_SelectedIndexChanged(object sender, EventArgs e)
        {
            var data = new List<JsonTrainData>();
            CloneJsonTrainList(_trainData, data);
            try
            {
                data = data.Where(
                    x => string.Compare(x.QueryLeftNewDto.Start_time, cboShijian.Text.Split('-')[0]) >= 0)
                    .Select(x => x)
                    .Where(x =>
                        string.Compare(cboShijian.Text.Split('-')[1], x.QueryLeftNewDto.Start_time) >= 0)
                    .Select(x => x).ToList<JsonTrainData>();
            }
            catch { }
            lblTrainsCount.Text = string.Format("共有 {0} 趟车", data.Count);
            _BindingData = new BindingList<JsonTrainData>(data);

            var source = new BindingList<QueryLeftNewDTO>();
            foreach (var v in _BindingData)
            {
                var ql = new QueryLeftNewDTO();
                ql = v.QueryLeftNewDto;
                ql.ButtonTextInfo = v.ButtonTextInfo.Replace("<br/>", "");
                ql.SecretStr = v.SecretStr;
                source.Add(ql);
            }
            dgvTrainView.DataSource = source;
            dgvTrainView.Refresh();
        }
Пример #8
0
 //排序
 private void dgvTrainView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         var datas = (BindingList<JsonTrainData>)SortClass.SortTrainDataSource(_BindingData, sortTable, e.ColumnIndex);
         var source = new BindingList<QueryLeftNewDTO>();
         foreach (var v in datas)
         {
             var ql = new QueryLeftNewDTO();
             ql = v.QueryLeftNewDto;
             ql.ButtonTextInfo = v.ButtonTextInfo.Replace("<br/>", "");
             ql.SecretStr = v.SecretStr;
             source.Add(ql);
         }
         this.dgvTrainView.DataSource = source;
     }
 }
Пример #9
0
 //生成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;
 }
Пример #10
0
 //生成PostData
 public string GetPostDataString(QueryLeftNewDTO data)
 {
     //data.Train_date = trainDate.ToString("yyyy-MM-dd");
     //string postData = string.Format("arrive_time={0}&from_station_name={1}&from_station_no={2}&from_station_telecode={3}&from_station_telecode_name={4}&include_student={5}&lishi={6}&locationCode={7}&mmStr={8}&round_start_time_str={9}&round_train_date={10}&seattype_num={11}&single_round_type={12}&start_time_str={13}&station_train_code={14}&to_station_name={15}&to_station_no={16}&to_station_telecode={17}&to_station_telecode_name={18}&train_class_arr={19}&train_date={20}&train_pass_type={21}&train_start_time={22}&trainno4={23}&ypInfoDetail={24}",
     //                                    data.Arrive_time.Replace(":", "%3A"), translation.UtfEncode(data.From_station_name), data.From_station_no, data.From_station_telecode, translation.UtfEncode(data.From_station_telecode_name), data.Include_student,
     //                                    data.Cost_time.Replace(":", "%3A"), data.LocationCode, data.mmStr, cboShijian.Text.Replace(":", "%3A"), data.Train_date, data.seattype_num,
     //                                    data.single_round_type, cboShijian.Text.Replace(":", "%3A"), data.Station_train_code, translation.UtfEncode(data.To_station_name), data.To_station_no, data.To_station_telecode,
     //                                    translation.UtfEncode(data.To_station_telecode_name), trainClassType, data.Train_date, rbtnQuanbu.Checked ? "QB" : rbtnShifa.Checked ? "SF" : "GL", data.Start_time.Replace(":", "%3A"), data.Trainno4, data.ypInfoDetail);   
     string postData = string.Format("secretStr={0}&train_date={1}&back_train_date={2}&tour_flag=dc&purpose_codes={3}&query_from_station_name={4}&query_to_station_name={5}&undefined",
         data.SecretStr, data.Start_train_date.Substring(0, 4) + "-" + data.Start_train_date.Substring(4, 2) + "-" + data.Start_train_date.Substring(6, 2), DateTime.Now.ToString("yyyy-MM-dd"), chkIncludeStudent.Checked ? "0x00" : "ADULT", System.Web.HttpUtility.UrlEncode(data.Start_station_name), System.Web.HttpUtility.UrlEncode(data.End_station_name));
     return postData;
 }
Пример #11
0
        //开始预定
        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);
                    }
                }
            });
        }
Пример #12
0
 /********************************************************自动提交***************************************************************/
 public string GetAsyncSubmitOrderPostData(QueryLeftNewDTO train, System.Collections.Hashtable Token)
 {
     return(System.Web.HttpUtility.UrlEncode(string.Format("train_date={0}&train_no={1}&stationTrainCode={2}&seatType={3}&fromStationTelecode={4}&toStationTelecode={5}&leftTicket={6}&purpose_codes={7}&_json_att=",
                                                           GetDateTime(train.Start_train_date), train.Train_no, train.Station_train_code, Token["leftTicket"].ToString().Substring(10, 1), train.From_station_telecode, train.To_station_telecode, Token["leftTicket"].ToString(), Token["purposeCodes"].ToString(), "")).Replace("%3d", "=").Replace("%26", "&"));
 }