Ejemplo n.º 1
0
        private void Select_Click(object sender, EventArgs e)
        {
            SeatSelect seatSelect = new SeatSelect();

            seatSelect.ShowDialog();
        }
Ejemplo n.º 2
0
        private void SelectSeat(object sender, DataGridViewCellEventArgs e)////************
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            MessageBox.Show("운행 기본 요금은 1인당 " + cost + "원 입니다");
            int count = 0;

            for (int i = 1; i <= 2; ++i)
            {
                for (int j = 1; j <= 4; ++j)
                {
                    seatArray[i, j] = 0;
                }
            }

            DataTable dtStatus;

            drow = dataGridView2.Rows[e.RowIndex];

            string t_ID         = drow.Cells[0].Value.ToString();
            string startStation = drow.Cells[1].Value.ToString();
            string startTime    = drow.Cells[3].Value.ToString();


            for (int i = 1; i <= 2; ++i)
            {
                for (int j = 1; j <= 4; ++j)
                {
                    try
                    {
                        seaT_STATUSTableAdapter1.FillByStatus(dataSet11.SEAT_STATUS, i, j, t_ID,
                                                              startStation, direc, startTime); // START_TIME 확인할 것 **
                        dtStatus = dataSet11.SEAT_STATUS;

                        foreach (DataRow drStatus in dtStatus.Rows)
                        {
                            if (drStatus["STATUS"].ToString().Equals("1"))
                            {
                                seatArray[i, j] = 1;
                                count++;
                            }
                        }
                    }
                    catch (SystemException ex)
                    {
                        // MessageBox.Show(ex.Message);
                    }
                }
            }

            while (true)
            {
                cmdSeatHelper.Parameters["T_ID"].Value  = t_ID;
                cmdSeatHelper.Parameters["ST"].Value    = startStation;
                cmdSeatHelper.Parameters["DIREC"].Value = direc;

                OracleDataReader rdr = cmdSeatHelper.ExecuteReader();
                rdr.Read();

                startStation = rdr["ST_NAME"].ToString();
                if (startStation.Equals("부산") || startStation.Equals("서울"))
                {
                    break;
                }
                else if (startStation.Equals(cb_end.Text))
                {
                    break;
                }

                startTime = rdr["START_TIME"].ToString();
                for (int i = 1; i <= 2; ++i)
                {
                    for (int j = 1; j <= 4; ++j)
                    {
                        try
                        {
                            // 열차번호, 현재 역, 방향, 출발 시간
                            seaT_STATUSTableAdapter1.FillByStatus(dataSet11.SEAT_STATUS, i, j, t_ID,
                                                                  startStation, direc, startTime); // START_TIME 확인할 것 **
                            dtStatus = dataSet11.SEAT_STATUS;

                            foreach (DataRow drStatus in dtStatus.Rows)
                            {
                                if (drStatus["STATUS"].ToString().Equals("1")) // 예약이 있을 때
                                {
                                    seatArray[i, j] = 1;
                                    count++;
                                }
                            }
                        }
                        catch (SystemException ex)
                        {
                            // MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            //////////////////////////////////////////////////////////////////////////////
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    arr[i, j] = 0;
                }
            }
            /////////////////////**********************************
            if (direc.Equals("서울행"))
            {
                startStation = "부산";
            }
            else
            {
                startStation = "서울";
            }
            for (int i = 1; i <= 2; ++i)
            {
                for (int j = 1; j <= 4; ++j)
                {
                    try
                    {
                        seaT_STATUSTableAdapter1.FillByTEST(dataSet11.SEAT_STATUS, i, j, t_ID, startStation, direc);
                        dtStatus = dataSet11.SEAT_STATUS;

                        foreach (DataRow drStatus in dtStatus.Rows)
                        {
                            if (drStatus["STATUS"].ToString().Equals("0"))
                            {
                                arr[i, j]++;
                            }
                        }
                    }
                    catch (SystemException)
                    {
                        // MessageBox.Show(ex.Message);
                    }
                }
            }

            while (true)
            {
                cmdSeatHelper.Parameters["T_ID"].Value  = t_ID;
                cmdSeatHelper.Parameters["ST"].Value    = startStation;
                cmdSeatHelper.Parameters["DIREC"].Value = direc;

                OracleDataReader rdr = cmdSeatHelper.ExecuteReader();
                rdr.Read();
                //   MessageBox.Show(rdr["ST_NAME"].ToString());
                startStation = rdr["ST_NAME"].ToString();
                if (startStation.Equals("부산") || startStation.Equals("서울"))
                {
                    break;
                }

                for (int i = 1; i <= 2; ++i)
                {
                    for (int j = 1; j <= 4; ++j)
                    {
                        try
                        {
                            seaT_STATUSTableAdapter1.FillByTEST(dataSet11.SEAT_STATUS, i, j, t_ID,
                                                                startStation, direc);
                            dtStatus = dataSet11.SEAT_STATUS;

                            foreach (DataRow drStatus in dtStatus.Rows)
                            {
                                if (drStatus["STATUS"].ToString().Equals("0"))
                                {
                                    arr[i, j]++;
                                }
                            }
                        }
                        catch (SystemException)
                        {
                            // MessageBox.Show(ex.Message);
                        }
                    }
                }
            }

/////////////////////////////////////////////////////////////////////////////////////////
            SeatSelect seatSelect = new SeatSelect();

            seatSelect.ShowDialog();
        }