public SelectTrainClassForm(MainForm mf, QueryEntity qe)
        {
            InitializeComponent();
            this.mf = mf;
            DataTable dtResult = new DataTable();
            dtResult.Columns.Add("trainClass");
            dtResult.Columns.Add("timeSpan");
            dtResult.Columns.Add("runTime");
            dtResult.Columns.Add("select");
            TicketService service = new TicketService(StaticValues.MyCookies);
            QueryTicketResponseInfo rspInfo = service.QueryLeftTicketDTO(qe.train_date, qe.from_station_telecode, qe.to_station_telecode);
            if (rspInfo != null && rspInfo.status)
            {
                if (rspInfo.data != null && rspInfo.data.Count > 0)
                {
                    foreach (QueryLeftNewDTOData q in rspInfo.data)
                    {
                        bool flag = CheckTrainClass(q, qe);
                        if (flag)
                        {
                            DataRow row = dtResult.NewRow();
                            row["trainClass"] = q.queryLeftNewDTO.station_train_code;
                            if (mf.trainNoList.Contains(q.queryLeftNewDTO.station_train_code))
                            {
                                row["select"] = 1;
                            }
                            else
                                row["select"] = 0;
                            row["timeSpan"] = q.queryLeftNewDTO.start_time + " - " + q.queryLeftNewDTO.arrive_time;
                            row["runTime"] = q.queryLeftNewDTO.lishi;

                            dtResult.Rows.Add(row);
                        }
                    }
                    dataGridView1.DataSource = dtResult;
                }
            }
           
        }
Beispiel #2
0
 public static DataTable GetLeftTicket(ref QueryEntity qe)
 {
     DataTable dtTicket = CreateTicketDt();
     if (qe.optionDates.Contains(qe.train_date))
     {
         qe.optionDates.Remove(qe.train_date);
     }
     qe.optionDates.Insert(0, qe.train_date);
     TicketService service = new TicketService(StaticValues.MyCookies);
     for (int i = 0; i < qe.optionDates.Count; i++)
     {
         string date=qe.optionDates[i];
         qe.train_date = date;
         QueryTicketResponseInfo rspInfo = service.QueryLeftTicketDTO(qe.train_date, qe.from_station_telecode, qe.to_station_telecode);
         if (rspInfo!=null&&rspInfo.status)
         {
             if (rspInfo.data != null && rspInfo.data.Count > 0)
             {
                 string[] timeArray = qe.start_time_str.Split("--".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                 int beginTime = Convert.ToInt32(timeArray[0].Replace(":", ""));
                 int endTime = Convert.ToInt32(timeArray[1].Replace(":", ""));
                 foreach (QueryLeftNewDTOData q in rspInfo.data)
                 {
                     bool flag = CheckTrainClass(q, qe);
                     if (flag)
                     {
                         int startTime = Convert.ToInt32(q.queryLeftNewDTO.start_time.Replace(":", ""));
                         if (startTime >= beginTime && endTime >= startTime)
                         {
                             if ((qe.trainNoList!=null&&qe.trainNoList.Count>0&&qe.trainNoList.Contains(q.queryLeftNewDTO.station_train_code))||qe.trainNoList==null||qe.trainNoList.Count==0)
                             {
                                 DataRow row = dtTicket.NewRow();
                                 row["TrainCode"] = q.queryLeftNewDTO.station_train_code;
                                 row["TrainCodeKey"] = q.queryLeftNewDTO.train_no + "#" + q.queryLeftNewDTO.start_station_telecode + "#" + q.queryLeftNewDTO.to_station_telecode;
                                 row["StartStation"] = q.queryLeftNewDTO.from_station_name + "(" + q.queryLeftNewDTO.start_time + ")";
                                 row["AimStation"] = q.queryLeftNewDTO.to_station_name + "(" + q.queryLeftNewDTO.arrive_time + ")";
                                 row["TakeTime"] = q.queryLeftNewDTO.lishi;
                                 row["ShangWu"] = q.queryLeftNewDTO.swz_num;
                                 row["TeDeng"] = q.queryLeftNewDTO.tz_num;
                                 row["YiDeng"] = q.queryLeftNewDTO.zy_num;
                                 row["ErDeng"] = q.queryLeftNewDTO.ze_num;
                                 row["GaoJiRuanWo"] = q.queryLeftNewDTO.gr_num;
                                 row["RuanWo"] = q.queryLeftNewDTO.rw_num;
                                 row["YingWo"] = q.queryLeftNewDTO.yw_num;
                                 row["RuanZuo"] = q.queryLeftNewDTO.rz_num;
                                 row["YingZuo"] = q.queryLeftNewDTO.yz_num;
                                 row["WuZuo"] = q.queryLeftNewDTO.wz_num;
                                 row["QiTa"] = q.queryLeftNewDTO.qt_num;
                                 row["OrderKey"] = q.secretStr;
                                 bool last = q.queryLeftNewDTO.to_station_name == q.queryLeftNewDTO.end_station_name;
                                 row["Last"] = last;
                                 bool first = q.queryLeftNewDTO.from_station_name == q.queryLeftNewDTO.start_station_name;
                                 row["First"] = first;
                                 row["Order"] = Images.Order;
                                 dtTicket.Rows.Add(row);
                             }
                         }
                     }
                 }
                 dtTicket = FilterResultBySeat(dtTicket, qe);
             }
         }
         if (dtTicket.Rows.Count > 0)
         {
             break;
         }
     }
     return dtTicket;
 }
Beispiel #3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (DateTime.Now.Hour == 23 || DateTime.Now.Hour < 7)
     {
         this.toolStripMsg.Text = "系统维护中,维护时间为23:00-07:00";
         return;
     }
     string userName = cbUserName.Text.Trim();
     string pwd = txtPwd.Text.Trim();
     string vc = txtVc.Text.Trim();
     if (userName != "" && pwd != "" && vc != "")
     {
         toolStripMsg.Text = "系统正在登陆中...";
         this.btnLogin.Enabled = false;
         string msg = string.Empty;
         Thread t = new Thread(() =>
         {
             bool flag = LoginHelper.Login(userName, pwd, vc, ref msg, ref StaticValues.MyCookies);
             if (flag)
             {
                 TicketService service = new TicketService(StaticValues.MyCookies);
                 StaticValues.UserName = service.GetUserName();
                 StaticValues.PassengerList = service.GetMyPassengers().data.normal_passengers;
                 if (ckRememerUser.Checked)
                 {
                     UserManager.SaveUserInfo(userName, pwd);
                 
                 }
                 this.DialogResult = DialogResult.OK;
             }
             else
             {
                 this.BeginInvoke(new MethodInvoker(delegate()
                 {
                     btnLogin.Enabled = true;
                     toolStripMsg.Text = msg;
                 }));
             }
         });
         t.IsBackground = true;
         t.Start();
     }
     else
     {
         if (userName == "")
         {
             toolStripMsg.Text = "请输入登录名~";
             cbUserName.Focus();
             return;
         }
         if (pwd == "")
         {
             toolStripMsg.Text = "请输入密码~";
             txtPwd.Focus();
             return;
         }
         if (vc == "")
         {
             toolStripMsg.Text = "请输入验证码~";
             txtVc.Focus();
             return;
         }
     }
 }
Beispiel #4
0
 public static QueryWaitTimeResult QueryOrderWaitTime(string token)
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     return service.QueryOrderWaitTime(token);
 }
Beispiel #5
0
 public static List<TrainDetails> GetTrainDetails(string train_no, string start_station, string aim_station, string date)
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     return service.GetTrainDetails(train_no, start_station, aim_station, date);
 }
Beispiel #6
0
 public static bool ConfirmSingleForQueue(TicketInfo ti, string vc, List<PassengerInfo> list, ref string msg)
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     return service.ConfirmSingleForQueue(ti, vc,list,ref msg);
 }
Beispiel #7
0
 public static CountInfo GetQueueCount(TicketInfo ti, string seatType)
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     return service.GetQueueCount(ti, seatType);
 }
Beispiel #8
0
 public static bool CheckOrderInfo(string token, string vc, List<PassengerInfo> list,ref string msg)
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     return service.CheckOrderInfo(token,vc,list,ref msg);
 }
Beispiel #9
0
 public static void GetPassengers()
 {
     TicketService service = new TicketService(StaticValues.MyCookies);
     GetPassengerDTOsResponseInfo ri = service.GetMyPassengers();
     StaticValues.PassengerList= ri.data.normal_passengers;
 }
Beispiel #10
0
 public static TicketInfo GetTicketInfo(string secretStr, QueryEntity qe,ref string msg)
 {
     TicketInfo ti = null;
     TicketService service = new TicketService(StaticValues.MyCookies);
     bool flag = service.SubmitOrderRequest(secretStr, qe, ref msg);
     if (flag)
     {
         ti = service.GetTicketInfo();
     }
     return ti;
 }