コード例 #1
0
 public SelectDateForm(MainForm mf)
 {
     InitializeComponent();
     this.mf = mf;
     LoadDates();
     chkListDates.ItemCheck -= new ItemCheckEventHandler(chkListDates_ItemCheck);
     myDateList = mf.myDateList;
     for (int j = 0; j < chkListDates.Items.Count; j++)
     {
         string date = chkListDates.Items[j].ToString();
         if (myDateList.Contains(date))
         {
             chkListDates.SetItemCheckState(j, CheckState.Checked);
         }
         else
         {
             chkListDates.SetItemCheckState(j, CheckState.Unchecked);
         }
     }
     chkListDates.ItemCheck += new ItemCheckEventHandler(chkListDates_ItemCheck);
 }
コード例 #2
0
        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;
                }
            }
           
        }
コード例 #3
0
 public SelectPassengerForm(MainForm mf)
 {
     InitializeComponent();
     this.mf = mf;
     LoadPassenger(StaticValues.PassengerList);
     chkListPassenger.ItemCheck -= new ItemCheckEventHandler(chkListPassenger_ItemCheck);
     myList = mf.myList;
     for (int j = 0; j < chkListPassenger.Items.Count; j++)
     {
         PassengerDTOs p = (PassengerDTOs)chkListPassenger.Items[j];
         if (myList.Exists(p1 => p1.passenger_name == p.passenger_name))
         {
             chkListPassenger.SetItemCheckState(j, CheckState.Checked);
         }
         else
         {
             chkListPassenger.SetItemCheckState(j, CheckState.Unchecked);
         }
     }
     chkListPassenger.ItemCheck += new ItemCheckEventHandler(chkListPassenger_ItemCheck);
     
 }