예제 #1
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     Passenger passenger = new Passenger();
     PassengerForm passengerForm=new PassengerForm();
     passengerForm.Value = passenger;
     if(passengerForm.ShowDialog(this)==DialogResult.OK)
     {
         ListViewItem listViewItem = new ListViewItem();
         listViewItem.Tag = passenger;
         listViewItem.Checked = passenger.Checked;
         listViewItem.SubItems.AddRange(new string[] { passenger.Name, passenger.CardType.ToString(), passenger.CardNo, passenger.MobileNo.ToString(),passenger.SeatDetailType.ToString() });
         listView1.Items.Add(listViewItem);
         Save();
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: jsgydjq/train
        static void Main(string[] args)
        {
            System.Net.ServicePointManager.ServerCertificateValidationCallback =(sender, certificate, chain, errors) => true;

            //IPAddress[] ipAddresses = System.Net.Dns.GetHostAddresses("dynamic.12306.cn");

            OrderRequest orderRequest = new OrderRequest()
                                            {
                                                FromStationTelecode = "BJP",
                                                //FromStationTelecodeName="北京",
                                                ToStationTelecode = "NCG",
                                                //ToStationTelecodeName = "南昌",
                                                IncludeStudent = "00",
                                                StartTimeStr = "00:00--24:00",
                                                TrainClass = "QB#D#Z#T#K#QT#",
                                                TrainDate = DateTime.Parse("2012-10-11"),
                                                TrainPassType = "QB"
                                            };
            BuyTicketConfig.Instance.OrderRequest = orderRequest;
            var Passengers=new Passenger[]
                                       {
                                           new Passenger(){Name="林利",CardNo = "362201198409101614",Checked=true,MobileNo="15910675179"},
                                           new Passenger(){Name="林艳",CardNo = "362201198305131667",Checked=true,MobileNo="18610037900"},
                                       };
            Account account = new Account("mydobit", "03265791", null);
            bool auto = false;
            account.Login(ref auto);
            Console.WriteLine(account.IsLogin);
            var list = account.QueryTrainInfos(new List<TrainItemInfo>());
            //string ret = account.OrderTicket(list[0], Passengers);
            //if(string.IsNullOrEmpty(ret))
            //{
            //  Console.WriteLine("OrderId="+account.GetOderId());
            //}
            //else
            //{
            //    Console.WriteLine(ret);
            //}
            Console.ReadLine();
        }
        /// <summary>
        /// �¶������������ض������
        /// </summary>
        /// <returns>�޴���ʱ���ؿգ��������ش���</returns>
        public string OrderTicket(TrainItemInfo trainItemInfo,Passenger[] passengers,SeatType seatType)
        {
            /*POST https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest HTTP/1.1
             * Referer: https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init
             *
             * station_train_code=Z133&train_date=2012-10-12&seattype_num=&from_station_telecode=BXP&to_station_telecode=NCG&include_student=00
             * &from_station_telecode_name=%E5%8C%97%E4%BA%AC&to_station_telecode_name=%E5%8D%97%E6%98%8C
             * &round_train_date=2012-10-11&round_start_time_str=00%3A00--24%3A00&single_round_type=1&train_pass_type=QB&train_class_arr=QB%23D%23Z%23T%23K%23QT%23
             * &start_time_str=00%3A00--24%3A00&lishi=11%3A29&train_start_time=19%3A45&trainno4=240000Z13305
             * &arrive_time=07%3A14&from_station_name=%E5%8C%97%E4%BA%AC%E8%A5%BF&to_station_name=%E5%8D%97%E6%98%8C&ypInfoDetail=1*****31254*****00241*****00006*****00113*****0111&mmStr=7D1B712CD355990896422EECCC4C11205C7DFD31C26962626B630FEE
             */
            NameValueCollection forms=new NameValueCollection();
            forms["station_train_code"] = trainItemInfo.TrainNo;
            forms["train_date"] = BuyTicketConfig.Instance.OrderRequest.TrainDate.ToString("yyyy-MM-dd");
            forms["seattype_num"] = "";
            forms["from_station_telecode"] = trainItemInfo.FromStationTelecode;
            forms["to_station_telecode"] = trainItemInfo.ToStationTelecode;
            forms["include_student"] = "00";
            forms["from_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.FromStationTelecodeName;
            forms["to_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.ToStationTelecodeName;
            forms["round_train_date"] = System.DateTime.Today.ToString("yyyy-MM-dd");
            forms["round_start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
            forms["single_round_type"] = "1";
            forms["train_pass_type"] = BuyTicketConfig.Instance.OrderRequest.TrainPassType;
            forms["train_class_arr"] = BuyTicketConfig.Instance.OrderRequest.TrainClass;
            forms["start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
            forms["lishi"] = trainItemInfo.lishi;
            forms["train_start_time"] =trainItemInfo.TrainStartTime;
            forms["trainno4"] = trainItemInfo.TrainNo4;
            forms["arrive_time"] = trainItemInfo.ArriveTime;
            forms["from_station_name"] = trainItemInfo.FromStationName;
            forms["to_station_name"] = trainItemInfo.ToStationName;
            forms["from_station_no"] = trainItemInfo.FromStationNo;
            forms["to_station_no"] = trainItemInfo.ToStationNo;
            forms["ypInfoDetail"] = trainItemInfo.YpInfoDetail;
            forms["mmStr"] = trainItemInfo.MmStr;
            forms["locationCode"] = trainItemInfo.LocationCode;
            string content = HttpRequest.Create("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest", "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init", Cookie, forms).GetString();
            NameValueCollection htmlForm = Utils.GetForms(content);
            trainItemInfo.YpInfoDetailReal = htmlForm["leftTicketStr"]; //����ʵʱ��ѯ��Ʊ��Ϣ
            if (string.IsNullOrEmpty(trainItemInfo.YpInfoDetailReal))
            {
                Common.LogUtil.Log(content);
                return "�µ�ʧ��:δ�ܻ�ȡ��ʵ����Ʊ����Ϣ";
            }

            ConfirmRequest:

            forms = new NameValueCollection();
            forms["org.apache.struts.taglib.html.TOKEN"] = htmlForm["org.apache.struts.taglib.html.TOKEN"];
            forms["leftTicketStr"] = htmlForm["leftTicketStr"];
            foreach (string key in htmlForm.Keys)
            {
                if(key.StartsWith("orderRequest"))
                {
                    forms[key] = htmlForm[key];
                }
            }
            //&randCode=5xpy&orderRequest.reserve_flag=A

            string vcode = "";
            do
            {
                Stream stream =
                    HttpRequest.Create("https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=randp",
                                       "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie,
                                       HttpMethod.GET, "").GetStream();
                Image image = Image.FromStream(stream);
                vcode = GetVCodeByForm(image);
            } while (vcode == "");
            forms["randCode"] = vcode;
            forms["orderRequest.reserve_flag"] = BuyTicketConfig.Instance.SystemSetting.PayType == PayType.Online ? "A" : "B";//A=����֧��,B=ȡƱ�ֳ�֧��
            string postStr = forms.ToQueryString();
            foreach (Passenger passenger in passengers)
            {
                /*
                 * passengerTickets=3,0,1,����,1,362201198...,15910675179,Y
                 * &oldPassengers=����,1,362201198...&passenger_1_seat=3&passenger_1_seat_detail_select=0&passenger_1_seat_detail=0&passenger_1_ticket=1&passenger_1_name=����&passenger_1_cardtype=1&passenger_1_cardno=362201198&passenger_1_mobileno=15910675179&checkbox9=Y
                 * */
                if (passenger.Checked)
                {
                    postStr += "&passengerTickets=" +
                               Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2},{3},{4},{5},{6},Y",
                                                                       //passenger.SeatType.ToSeatTypeValue(),
                                                                       seatType.ToSeatTypeValue(),
                                                                       (int) passenger.SeatDetailType,
                                                                       (int) passenger.TicketType, passenger.Name,
                                                                       passenger.CardType.ToCardTypeValue(),
                                                                       passenger.CardNo, passenger.MobileNo));
                    postStr += "&oldPassengers=" +
                               Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2}", passenger.Name,
                                                                       passenger.CardType.ToCardTypeValue(),
                                                                       passenger.CardNo));
                }
            }
            string confirmSingleForQueueOrderUrl = "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=confirmSingleForQueueOrder ";
               string resStateContent=  HttpRequest.Create(confirmSingleForQueueOrderUrl, "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie, HttpMethod.POST, postStr).GetString();

            if(resStateContent.Contains("��֤��"))
            {
                goto ConfirmRequest;
            }
            ResState resState = resStateContent.ToJsonObject<ResState>();

            if(resState==null)
            {
                Common.LogUtil.Log(resStateContent);
                return "�µ�ʧ��:ȷ�϶���ʱ��ϵͳ���ص����ݲ���ȷ," + resStateContent;
            }
            else
            {
                if (resState.ErrMsg.Equals("Y"))
                {
                    return "";
                }
                else
                {
                    Common.LogUtil.Log(resStateContent);
                   return "�����쳣,��Ӧ״̬Ϊ��" + resState.ErrMsg;
                }
            }
        }
예제 #4
0
 /// <summary>
 /// �����µ���Ҫpost�Ĵ�
 /// </summary>
 /// <param name="seatType"></param>
 /// <param name="htmlForm"></param>
 /// <param name="vcode"></param>
 /// <param name="passengers"></param>
 /// <param name="postStr"></param>
 /// <returns></returns>
 private NameValueCollection BuildOrderPostStr(SeatType seatType, NameValueCollection htmlForm, string vcode,
                                               Passenger[] passengers, out string postStr)
 {
     NameValueCollection forms = new NameValueCollection();
     forms["org.apache.struts.taglib.html.TOKEN"] = htmlForm["org.apache.struts.taglib.html.TOKEN"];
     forms["leftTicketStr"] = htmlForm["leftTicketStr"];
     foreach (string key in htmlForm.Keys)
     {
         if (key.StartsWith("orderRequest"))
         {
             forms[key] = htmlForm[key];
         }
     }
     forms["randCode"] = vcode;
     forms["orderRequest.reserve_flag"] = TicketSetting.PayType == PayType.Online ? "A" : "B"; //A=����֧��,B=ȡƱ�ֳ�֧��
     //if (force && trainItemInfo.GetRealSeatNumber(seatType) < passengers.Length)
     //{
     //    int p = trainItemInfo.YpInfoDetail.IndexOf(((char)seatType) + "*");
     //    if (p > -1)
     //    {
     //        string newLeftTickets = forms["leftTicketStr"].Remove(p + 6, 1);
     //        newLeftTickets = newLeftTickets.Insert(p + 6, "1");
     //        forms["leftTicketStr"] = newLeftTickets;
     //    }
     //}
     postStr = forms.ToQueryString();
     foreach (Passenger passenger in passengers)
     {
         /*
          * passengerTickets=3,0,1,����,1,362201198...,15910675179,Y
          * &oldPassengers=����,1,362201198...&passenger_1_seat=3&passenger_1_seat_detail_select=0&passenger_1_seat_detail=0&passenger_1_ticket=1&passenger_1_name=����&passenger_1_cardtype=1&passenger_1_cardno=362201198&passenger_1_mobileno=15910675179&checkbox9=Y
          * */
         if (passenger.Checked)
         {
             postStr += "&passengerTickets=" +
                        Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2},{3},{4},{5},{6},Y",
                                                                //passenger.SeatType.ToSeatTypeValue(),
                                                                seatType.ToSeatTypeValue(),
                                                                (int) passenger.SeatDetailType,
                                                                (int) passenger.TicketType, passenger.Name,
                                                                passenger.CardType.ToCardTypeValue(),
                                                                passenger.CardNo, passenger.MobileNo));
             postStr += "&oldPassengers=" +
                        Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2}", passenger.Name,
                                                                passenger.CardType.ToCardTypeValue(),
                                                                passenger.CardNo));
         }
     }
     return forms;
 }
예제 #5
0
파일: Account.cs 프로젝트: jsgydjq/train
 /// <summary>
 /// https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest
 /// </summary>
 /// <param name="trainItemInfo"></param>
 /// <param name="passengers"></param>
 /// <param name="seatType"></param>
 /// <returns>�õ�ҳ��ı����Ϣ</returns>
 public NameValueCollection SubmitOrderRequest(TrainItemInfo trainItemInfo, Passenger[] passengers, SeatType seatType)
 {
     /*POST https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest HTTP/1.1
     * Referer: https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init
     *
     * station_train_code=Z133&train_date=2012-10-12&seattype_num=&from_station_telecode=BXP&to_station_telecode=NCG&include_student=00
     * &from_station_telecode_name=%E5%8C%97%E4%BA%AC&to_station_telecode_name=%E5%8D%97%E6%98%8C
     * &round_train_date=2012-10-11&round_start_time_str=00%3A00--24%3A00&single_round_type=1&train_pass_type=QB&train_class_arr=QB%23D%23Z%23T%23K%23QT%23
     * &start_time_str=00%3A00--24%3A00&lishi=11%3A29&train_start_time=19%3A45&trainno4=240000Z13305
     * &arrive_time=07%3A14&from_station_name=%E5%8C%97%E4%BA%AC%E8%A5%BF&to_station_name=%E5%8D%97%E6%98%8C&ypInfoDetail=1*****31254*****00241*****00006*****00113*****0111&mmStr=7D1B712CD355990896422EECCC4C11205C7DFD31C26962626B630FEE
     */
     NameValueCollection forms = new NameValueCollection();
     forms["station_train_code"] = trainItemInfo.TrainNo;
     forms["train_date"] = BuyTicketConfig.Instance.OrderRequest.TrainDate.ToString("yyyy-MM-dd");
     forms["seattype_num"] = "";
     forms["from_station_telecode"] = trainItemInfo.FromStationTelecode;
     forms["to_station_telecode"] = trainItemInfo.ToStationTelecode;
     forms["include_student"] = "00";
     forms["from_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.FromStationTelecodeName;
     forms["to_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.ToStationTelecodeName;
     forms["round_train_date"] = System.DateTime.Today.ToString("yyyy-MM-dd");
     forms["round_start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
     forms["single_round_type"] = "1";
     forms["train_pass_type"] = BuyTicketConfig.Instance.OrderRequest.TrainPassType;
     forms["train_class_arr"] = BuyTicketConfig.Instance.OrderRequest.TrainClass;
     forms["start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
     forms["lishi"] = trainItemInfo.lishi;
     forms["train_start_time"] = trainItemInfo.TrainStartTime;
     forms["trainno4"] = trainItemInfo.TrainNo4;
     forms["arrive_time"] = trainItemInfo.ArriveTime;
     forms["from_station_name"] = trainItemInfo.FromStationName;
     forms["to_station_name"] = trainItemInfo.ToStationName;
     forms["from_station_no"] = trainItemInfo.FromStationNo;
     forms["to_station_no"] = trainItemInfo.ToStationNo;
     forms["ypInfoDetail"] = trainItemInfo.YpInfoDetail;
     forms["mmStr"] = trainItemInfo.MmStr;
     forms["locationCode"] = trainItemInfo.LocationCode;
     string content = HttpRequest.Create("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest", "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init", Cookie, forms).GetString();
     NameValueCollection htmlForm = Utils.GetForms(content);
     //trainItemInfo.YpInfoDetailReal = htmlForm["leftTicketStr"]; //����ʵʱ��ѯ��Ʊ��Ϣ
     //if (string.IsNullOrEmpty(trainItemInfo.YpInfoDetailReal))
     //{
     //    Common.LogUtil.Log(content);
     //    return "�µ�ʧ��:δ�ܻ�ȡ��ʵ����Ʊ����Ϣ";
     //}
     return htmlForm;
 }
예제 #6
0
파일: Account.cs 프로젝트: jsgydjq/train
        /// <summary>
        /// �¶������������ض������
        /// </summary>
        /// <returns>�޴���ʱ���ؿգ��������ش���</returns>
        public string OrderTicket(TrainItemInfo trainItemInfo,Passenger[] passengers,SeatType seatType,ref bool stop, bool force=false,RichTextBox rtbLog=null)
        {
            /*POST https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest HTTP/1.1
             * Referer: https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init
             *
             * station_train_code=Z133&train_date=2012-10-12&seattype_num=&from_station_telecode=BXP&to_station_telecode=NCG&include_student=00
             * &from_station_telecode_name=%E5%8C%97%E4%BA%AC&to_station_telecode_name=%E5%8D%97%E6%98%8C
             * &round_train_date=2012-10-11&round_start_time_str=00%3A00--24%3A00&single_round_type=1&train_pass_type=QB&train_class_arr=QB%23D%23Z%23T%23K%23QT%23
             * &start_time_str=00%3A00--24%3A00&lishi=11%3A29&train_start_time=19%3A45&trainno4=240000Z13305
             * &arrive_time=07%3A14&from_station_name=%E5%8C%97%E4%BA%AC%E8%A5%BF&to_station_name=%E5%8D%97%E6%98%8C&ypInfoDetail=1*****31254*****00241*****00006*****00113*****0111&mmStr=7D1B712CD355990896422EECCC4C11205C7DFD31C26962626B630FEE
             */
            NameValueCollection forms=new NameValueCollection();
            forms["station_train_code"] = trainItemInfo.TrainNo;
            forms["train_date"] = BuyTicketConfig.Instance.OrderRequest.TrainDate.ToString("yyyy-MM-dd");
            forms["seattype_num"] = "";
            forms["from_station_telecode"] = trainItemInfo.FromStationTelecode;
            forms["to_station_telecode"] = trainItemInfo.ToStationTelecode;
            forms["include_student"] = "00";
            forms["from_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.FromStationTelecodeName;
            forms["to_station_telecode_name"] = BuyTicketConfig.Instance.OrderRequest.ToStationTelecodeName;
            forms["round_train_date"] = System.DateTime.Today.ToString("yyyy-MM-dd");
            forms["round_start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
            forms["single_round_type"] = "1";
            forms["train_pass_type"] = BuyTicketConfig.Instance.OrderRequest.TrainPassType;
            forms["train_class_arr"] = BuyTicketConfig.Instance.OrderRequest.TrainClass;
            forms["start_time_str"] = BuyTicketConfig.Instance.OrderRequest.StartTimeStr;
            forms["lishi"] = trainItemInfo.lishi;
            forms["train_start_time"] =trainItemInfo.TrainStartTime;
            forms["trainno4"] = trainItemInfo.TrainNo4;
            forms["arrive_time"] = trainItemInfo.ArriveTime;
            forms["from_station_name"] = trainItemInfo.FromStationName;
            forms["to_station_name"] = trainItemInfo.ToStationName;
            forms["from_station_no"] = trainItemInfo.FromStationNo;
            forms["to_station_no"] = trainItemInfo.ToStationNo;
            forms["ypInfoDetail"] = trainItemInfo.YpInfoDetail;
            forms["mmStr"] = trainItemInfo.MmStr;
            forms["locationCode"] = trainItemInfo.LocationCode;
            string content = HttpRequest.Create("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest", "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init", Cookie, forms).GetString();
            NameValueCollection htmlForm = Utils.GetForms(content);
            trainItemInfo.YpInfoDetailReal = htmlForm["leftTicketStr"]; //����ʵʱ��ѯ��Ʊ��Ϣ
            if (string.IsNullOrEmpty(trainItemInfo.YpInfoDetailReal))
            {
                Common.LogUtil.Log(content);
                return "�µ�ʧ��:δ�ܻ�ȡ��ʵ����Ʊ����Ϣ";
            }

            ConfirmRequest:

            forms = new NameValueCollection();
            forms["org.apache.struts.taglib.html.TOKEN"] = htmlForm["org.apache.struts.taglib.html.TOKEN"];
            forms["leftTicketStr"] = htmlForm["leftTicketStr"];
            foreach (string key in htmlForm.Keys)
            {
                if(key.StartsWith("orderRequest"))
                {
                    forms[key] = htmlForm[key];
                }
            }
            //&randCode=5xpy&orderRequest.reserve_flag=A

            string vcode = "";
            do
            {
                Stream stream =
                    HttpRequest.Create("https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=randp",
                                       "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie,
                                       HttpMethod.GET, "").GetStream();
                Image image = Image.FromStream(stream);
                vcode = GetVCodeByForm(image);
                if (vcode == "BREAK")
                    return "�û���ֹ";
            } while (vcode == "");
            forms["randCode"] = vcode;
            forms["orderRequest.reserve_flag"] = BuyTicketConfig.Instance.SystemSetting.PayType == PayType.Online ? "A" : "B";//A=����֧��,B=ȡƱ�ֳ�֧��
            //if (force && trainItemInfo.GetRealSeatNumber(seatType) < passengers.Length)
            //{
            //    int p = trainItemInfo.YpInfoDetail.IndexOf(((char)seatType) + "*");
            //    if (p > -1)
            //    {
            //        string newLeftTickets = forms["leftTicketStr"].Remove(p + 6, 1);
            //        newLeftTickets = newLeftTickets.Insert(p + 6, "1");
            //        forms["leftTicketStr"] = newLeftTickets;
            //    }
            //}
            string postStr = forms.ToQueryString();
            foreach (Passenger passenger in passengers)
            {
                /*
                 * passengerTickets=3,0,1,����,1,362201198...,15910675179,Y
                 * &oldPassengers=����,1,362201198...&passenger_1_seat=3&passenger_1_seat_detail_select=0&passenger_1_seat_detail=0&passenger_1_ticket=1&passenger_1_name=����&passenger_1_cardtype=1&passenger_1_cardno=362201198&passenger_1_mobileno=15910675179&checkbox9=Y
                 * */
                if (passenger.Checked)
                {
                    postStr += "&passengerTickets=" +
                               Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2},{3},{4},{5},{6},Y",
                                                                       //passenger.SeatType.ToSeatTypeValue(),
                                                                       seatType.ToSeatTypeValue(),
                                                                       (int) passenger.SeatDetailType,
                                                                       (int) passenger.TicketType, passenger.Name,
                                                                       passenger.CardType.ToCardTypeValue(),
                                                                       passenger.CardNo, passenger.MobileNo));
                    postStr += "&oldPassengers=" +
                               Common.HtmlUtil.UrlEncode(string.Format("{0},{1},{2}", passenger.Name,
                                                                       passenger.CardType.ToCardTypeValue(),
                                                                       passenger.CardNo));
                }
            }

            string checkOrderInfoUrl = "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=checkOrderInfo&rand=" + vcode;

            CheckOrderInfo:
            if(stop)
            {
                return "�û���ִֹ��";
            }
            string resCheckContent = HttpRequest.Create(checkOrderInfoUrl, "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie, HttpMethod.POST, postStr + "&tFlag=dc").GetString();

            if (resCheckContent.Contains("��֤��"))
            {
                goto ConfirmRequest;
            }
            //https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getQueueCount&train_date=2013-02-04&train_no=24000000T50E&station=T5&seat=1&from=BXP&to=NNZ&ticket=1027353027407675000010273500003048050000
            string  getQueueCountUrl=@"https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getQueueCount&train_date="
            +forms["orderRequest.train_date"]
            +"&train_no="+forms["orderRequest.train_no"]
            +"&station="+forms["orderRequest.station_train_code"]+
            "&seat="+seatType.ToSeatTypeValue()+
            "&from="+forms["orderRequest.from_station_telecode"]+
            "&to=" + forms["orderRequest.to_station_telecode"] +
            "&ticket="+ forms["leftTicketStr"];
              ResYpInfo resYpInfo =  HttpRequest.Create(getQueueCountUrl, "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie, HttpMethod.GET, "").GetJsonObject<ResYpInfo>();;
               // {"countT":0,"count":355,"ticket":"1*****30504*****00001*****00003*****0000","op_1":true,"op_2":false}

            int seatNum = Utils.GetRealSeatNumber(resYpInfo.Ticket, seatType);
            int  wuzuo =0;
            if(seatType==SeatType.Ӳ��)
             wuzuo=Utils.GetRealSeatNumber(resYpInfo.Ticket, SeatType.����);
             if (rtbLog!=null)
              {
                  if (rtbLog.InvokeRequired)
                  {
                      rtbLog.Invoke(new Action(()=>
                          {
                              rtbLog.Text += string.Format("===>{0},{1}���Ŷ�,��Ʊ {2} �� {3}\r\n", seatType, resYpInfo.CountT, seatNum, wuzuo == 0 ? "" : ",���� " + wuzuo + " ��");
                              rtbLog.SelectionStart = rtbLog.TextLength;
                              rtbLog.ScrollToCaret();
                          }));

                  }
                  else
                  {
                      rtbLog.Text += string.Format("===>{0},{1}���Ŷ�,��Ʊ {2} �� {3}\r\n", seatType, resYpInfo.CountT, seatNum, wuzuo == 0 ? "" : ",���� " + wuzuo + " ��");
                      rtbLog.SelectionStart = rtbLog.TextLength;
                      rtbLog.ScrollToCaret();
                  }
              }
              if (force &&  seatNum< passengers.Length)
              {
              if(wuzuo==0)
              {
                  System.Threading.Thread.Sleep(1000);
                  goto CheckOrderInfo;
              }else
              {
                  if(wuzuo <passengers.Length)
                  {
                      System.Threading.Thread.Sleep(1000);
                      goto CheckOrderInfo;
                  }
              }

              }
            string confirmSingleForQueueOrderUrl = "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=confirmSingleForQueueOrder ";
               string resStateContent=  HttpRequest.Create(confirmSingleForQueueOrderUrl, "https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init", Cookie, HttpMethod.POST, postStr).GetString();

            if(resStateContent.Contains("��֤��"))
            {
                goto ConfirmRequest;
            }
            ResState resState = resStateContent.ToJsonObject<ResState>();

            if(resState==null)
            {
                Common.LogUtil.Log(resStateContent);
                return "�µ�ʧ��:ȷ�϶���ʱ��ϵͳ���ص����ݲ���ȷ," + resStateContent;
            }
            else
            {
                if (resState.ErrMsg.Equals("Y"))
                {
                    return "";
                }
                else
                {
                    Common.LogUtil.Log(resStateContent);
                   return "�����쳣,��Ӧ״̬Ϊ��" + resState.ErrMsg;
                }
            }
        }