private void readBooks() { //Session["user"] = new User(1,"testUser","testPassword"); booksList = new List <Book>(); MySql.Data.MySqlClient.MySqlConnection conn; string myConnectionString; myConnectionString = "server=localhost;uid=root;pwd=;database=web_lab7_books;"; try { conn = new MySql.Data.MySqlClient.MySqlConnection(); conn.ConnectionString = myConnectionString; conn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT * FROM `books` WHERE `books`.`ID` NOT IN ( SELECT `books`.`ID` FROM `books` INNER JOIN `user_rentals` WHERE `user_rentals`.`book_id`=`books`.`ID` AND `user_rentals`.`date_due` > DATE(NOW()) )"; MySqlDataReader myreader = cmd.ExecuteReader(); int row = 0; while (myreader.Read()) { booksList.Add(new Book(myreader.GetInt32(0), myreader.GetString(1), myreader.GetString(2), myreader.GetString(3), myreader.GetInt32(4))); } myreader.Close(); } catch (MySql.Data.MySqlClient.MySqlException ex) { Response.Write(ex.Message); } RowRepeater.DataSource = booksList; RowRepeater.DataBind(); }
private void Edit() { //_hall = _hall.ListHalls(_hallID, null).FirstOrDefault(); _hall = _hall.GetHallWithRows(_hallID); if (_hall != null) { Master.PageTitle = Master.Page.Title = _hall.CaptionGeorgian; txtCaptionGeorgian.Text = _hall.CaptionGeorgian; txtCaptionEnglish.Text = _hall.CaptionEnglish; txtDescriptionGeorgian.Text = _hall.DescriptionGeorgian; txtDescriptionEnglish.Text = _hall.DescriptionEnglish; txtAdvTime.Text = _hall.AdvTime.ToString(); txtCleanupTime.Text = _hall.CleanupTime.ToString(); txtEconomDaysCountBeforeBuy.Value = _hall.EconomDaysBeforeBuy; var selectedTheater = ddlTheaters.Items.FindByValue(_hall.TheaterID.ToString()); if (selectedTheater != null) { selectedTheater.Selected = true; } if (_hall.RowList != null && _hall.RowList.Any()) { HallContainer.Visible = true; RowRepeater.DataSource = _hall.RowList; RowRepeater.DataBind(); } SeatTypesRepeater.DataSource = new Dictionary().ListDictionaries(1, 10, true); SeatTypesRepeater.DataBind(); } }