private void Button2_Click(object sender, EventArgs e) { if (checkBox1.Enabled == true && checkBox1.Checked == true) { Showtimes showtimes = new Showtimes(); showtimes.HallId = Convert.ToInt32(comboBox1.SelectedValue); showtimes.Clock = 1; showtimes.Date = dateTimePicker1.Value; var a = HelperShowtimes.ShowtimesCUD(showtimes, System.Data.Entity.EntityState.Added); CreateChairs(a); checkBox1.Enabled = false; } if (checkBox2.Enabled == true && checkBox2.Checked == true) { Showtimes showtimes = new Showtimes(); showtimes.HallId = Convert.ToInt32(comboBox1.SelectedValue); showtimes.Clock = 2; showtimes.Date = dateTimePicker1.Value; var a = HelperShowtimes.ShowtimesCUD(showtimes, System.Data.Entity.EntityState.Added); CreateChairs(a); checkBox2.Enabled = false; } if (checkBox3.Enabled == true && checkBox3.Checked == true) { Showtimes showtimes = new Showtimes(); showtimes.HallId = Convert.ToInt32(comboBox1.SelectedValue); showtimes.Clock = 3; showtimes.Date = dateTimePicker1.Value; var a = HelperShowtimes.ShowtimesCUD(showtimes, System.Data.Entity.EntityState.Added); CreateChairs(a); checkBox3.Enabled = false; } if (checkBox4.Enabled == true && checkBox4.Checked == true) { Showtimes showtimes = new Showtimes(); showtimes.HallId = Convert.ToInt32(comboBox1.SelectedValue); showtimes.Clock = 4; showtimes.Date = dateTimePicker1.Value; var a = HelperShowtimes.ShowtimesCUD(showtimes, System.Data.Entity.EntityState.Added); CreateChairs(a); checkBox4.Enabled = false; } if (checkBox5.Enabled == true && checkBox5.Checked == true) { Showtimes showtimes = new Showtimes(); showtimes.HallId = Convert.ToInt32(comboBox1.SelectedValue); showtimes.Clock = 5; showtimes.Date = dateTimePicker1.Value; var a = HelperShowtimes.ShowtimesCUD(showtimes, System.Data.Entity.EntityState.Added); CreateChairs(a); checkBox5.Enabled = false; } MessageBox.Show("Seans veya seanslar başarıyla eklendi.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); if (checkBox1.Checked && checkBox2.Checked && checkBox3.Checked && checkBox4.Checked && checkBox5.Checked) { button2.Enabled = false; } }
public void PrintShowtimes() { Showtimes.ForEach(showtime => { System.Console.WriteLine($@" ----------------------------------------------------- | {showtime.Movie.Title} | {showtime.Time} | ------------------------------------------------------ "); }); }
public List <Showtimes> getIDRoom(string maShow) { List <Showtimes> fimlsList = new List <Showtimes>(); DataTable dataTable = DataProvider.Instance.ExecuteQuery("SELECT * FROM LICHCHIEU WHERE MaShow=N'" + maShow + "'"); foreach (DataRow item in dataTable.Rows) { Showtimes fimls = new Showtimes(item); fimlsList.Add(fimls); } return(fimlsList); }
public List <Showtimes> loadListShowtimes() { List <Showtimes> fimlsList = new List <Showtimes>(); DataTable dataTable = DataProvider.Instance.ExecuteQuery("SELECT * FROM LICHCHIEU"); foreach (DataRow item in dataTable.Rows) { Showtimes fimls = new Showtimes(item); fimlsList.Add(fimls); } return(fimlsList); }
private void RetrieveData() { if (Showtimes == null) { Showtimes = new ObservableCollection <Showtime>(); } var showtimes = repository.GetPendingShowtimes(Movie.Id).ToList(); Showtimes.Clear(); showtimes.ForEach(showtime => Showtimes.Add(showtime)); }
public List <Showtimes> getListShowTimesByIdFimlsOrIdCinema(string id) { List <Showtimes> fimls = new List <Showtimes>(); string query = string.Format("SELECT * FROM LICHCHIEU WHERE MaPhim = N'{0}' or MaRap = N'{0}'", id); DataTable data = DataProvider.Instance.ExecuteQuery(query); foreach (DataRow item in data.Rows) { Showtimes fiml = new Showtimes(item); fimls.Add(fiml); } return(fimls); }
public void CreateShowtime(Theater theater, Movie movie, string time) { var newShowtime = new Showtime() { Cinema = this, Theater = theater, Movie = movie, Time = time }; Showtimes.Add(newShowtime); MakeTickets(newShowtime); }
public static (Showtimes, bool) ShowtimesCUD(Showtimes showtimes, EntityState entityState) { using (CinemaDbEntities c = new CinemaDbEntities()) { c.Entry(showtimes).State = entityState; if (c.SaveChanges() > 0) { return(showtimes, true); } else { return(showtimes, false); } } }
private void button2_Click(object sender, EventArgs e) { groupBox4.Visible = true; groupBox2.Visible = true; panel2.Visible = true; Hall hall = HelperHall.GetHallById(Convert.ToInt32(comboBox1.SelectedValue)); movie = HelperMovie.GetMovieById(hall.MovieId); byte[] imageBytes = Convert.FromBase64String(movie.Banner.ToString()); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); ms.Write(imageBytes, 0, imageBytes.Length); pictureBox8.Image = Image.FromStream(ms, true); showtimes = HelperShowtimes.GetShowtimesByHallIdAndDateAndClock(Convert.ToInt32(comboBox1.SelectedValue), dateTimePicker1.Value, checkedRadioButton); RefreshTheSeats(); }
public List <Ticket> BuyTickets(string showtime, int tickets) //[showtime] is pointing to dictionary { // this is referring to Showtimes in the dictionary. if (Showtimes.ContainsKey(showtime) && Showtimes[showtime] >= tickets) { List <Ticket> purchased = new List <Ticket>(); for (int i = 0; i < tickets; i++) { purchased.Add(new Ticket(showtime, Movie, 15)); } Showtimes[showtime] -= tickets; // returns list created "purchased" return(purchased); } return(null); }
// because we made the defition private we are using this method to add the showtimes.. this is a setter public void AddShowtime(string time) { Showtimes.Add(time, MaxSeats); }