public void GetTicketInfo() { allTicketList.Clear(); Ticket cur_ticket; try { using (OracleConnection connection = new OracleConnection(OracleDatabaseConnection.connection_meneger)) { connection.Open(); OracleParameter us_cur = new OracleParameter { ParameterName = "us_cur", Direction = ParameterDirection.Output, OracleDbType = OracleDbType.RefCursor }; using (OracleCommand command = new OracleCommand("admin.getTicketInfo")) { command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(new OracleParameter[] { us_cur }); var reader = command.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(reader); foreach (DataRow row in dt.Rows) { int id = Convert.ToInt32(row["ID"]); int number = Convert.ToInt32(row["ticketNumber"]); int cost = Convert.ToInt32(row["Cost"]); string dateSeance = Convert.ToDateTime(row["DateSeance"]).ToString("D"); string timeSeance = row["TimeSeance"].ToString(); string hallPlace = row["Hall"].ToString(); int rowPlace = Convert.ToInt32(row["RawNumber"]); int placeNumber = Convert.ToInt32(row["Place"]); string typePlace = (row["typePlace"]).ToString(); string filmName = (row["FilmName"]).ToString(); string filmDuration = (row["FilmDuration"]).ToString(); string filmLimit = (row["FilmLimit"]).ToString(); Hall hall = new Hall(hallPlace); Film film = new Film(filmName, filmDuration, filmLimit); Place place = new Place(rowPlace, placeNumber, hall, typePlace, cost); Seance seance = new Seance(dateSeance, timeSeance, film); cur_ticket = new Ticket(id, number, seance, place, fio.Content.ToString()); allTicketList.Add(cur_ticket); ; } } } } catch (OracleException ex) { MessageBox.Show(ex.Message); } }
public Ticket(int ID, int number, Seance seance, Place place, string employeeFio) { this.ID = ID; this.seance = seance; this.place = place; Cost = place.Cost; this.employeeFio = employeeFio; Number = number; }
public void GetSeance() { allSeanceList.Clear(); Seance cur_seance; try { using (OracleConnection connection = new OracleConnection(OracleDatabaseConnection.connection_meneger)) { connection.Open(); OracleParameter us_cur = new OracleParameter { ParameterName = "us_cur", Direction = ParameterDirection.Output, OracleDbType = OracleDbType.RefCursor }; using (OracleCommand command = new OracleCommand("admin.getSeanceList")) { command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.Parameters.AddRange(new OracleParameter[] { us_cur }); var reader = command.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(reader); foreach (DataRow row in dt.Rows) { string date = Convert.ToDateTime(row["DateSeance"]).ToString("D"); DateTime date2 = Convert.ToDateTime(row["DateSeance"]); string time = row["TimeSeance"].ToString(); string hall = row["hallName"].ToString(); string filmName = row["FilmName"].ToString(); int seanceID = Convert.ToInt32(row["ID"]); Film film = new Film(filmName); string capacity = row["HallCapacity"].ToString(); cur_seance = new Seance(seanceID, date, date2, time, hall, film, capacity); allSeanceList.Add(cur_seance); if (SeanceTimeList.Contains(time)) { } else { SeanceTimeList.Add(time); } } } } } catch (OracleException ex) { MessageBox.Show(ex.Message); } }
public ChangeSeance(Seance seance, BindingList <string> nameHallList, BindingList <string> nameFilmList, BindingList <string> seanceTimeList) { InitializeComponent(); this.seance = seance; HallNameList = nameHallList; seanceHall.ItemsSource = HallNameList; FilmNameList = nameFilmList; seanceFilm.ItemsSource = FilmNameList; SeanceTimeList = seanceTimeList; seanceTime.ItemsSource = SeanceTimeList; seanceDate.Text = seance.seanceDate; seanceTime.SelectedItem = seance.seanceTime; seanceHall.SelectedItem = seance.seanceHall; seanceFilm.SelectedItem = seance.seanceFilm.Name; }