Exemplo n.º 1
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);
                    }
                }
            });
        }
Exemplo n.º 2
0
 //过滤余票
 //public bool CheckLeftTicketEnough(TrainData data, string seat = "")
 //{
 //    if (seat != "" && Convert.ToInt16(data.SeatOwener[seat]) > selectPassengerCount)
 //    {
 //        return true;
 //    }
 //    else if (seat == "")
 //    {
 //        foreach (string v in data.SeatOwener.Keys)
 //        {
 //            if (Convert.ToInt16(data.SeatOwener[v]) > selectPassengerCount)
 //            {
 //                return true;
 //            }
 //        }
 //        return false;
 //    }
 //    else
 //        return false;
 //}
 //开始预定
 public void RunBook(TrainData data,string seat="")
 {
     DeterMineCall(() =>
     {
         if (data.Bookable)
         {
             string postData = GetPostDataString(data, dtpRiqi.Value.Date);
             if (seat != "")
             {
                 StopListenning();
                 var form = new formSubmitOrder(postData, data, _passengersData, dtpRiqi.Value.Date.ToString("yyyy-MM-dd"), cookieContainer, seat);
                 this.Visible = true;
                 form.ShowDialog();
                 notice.ShowBalloonTip(5 * 1000, "提示", "抢到票啦!赶紧预定吧.", ToolTipIcon.Info);
             }
             else
             {
                 StopListenning();
                 var form1 = new formSubmitOrder(postData, data, _passengersData, dtpRiqi.Value.Date.ToString("yyyy-MM-dd"), cookieContainer);
                 this.Visible = true;
                 form1.ShowDialog();
                 notice.ShowBalloonTip(5 * 1000, "提示", "抢到票啦!赶紧预定吧.", ToolTipIcon.Info);
             }
         }
         else
         {
             MessageBox.Show(this, "该车次无票可定", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     });
 }