protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Request.Params["id"]); list = SlotsShowDAO.getAllSlotShowByIdFilmsInFuture(id); } }
public void loadData(int idRap, int idRoom, int idFilms, int idSlot) { ss = SlotsShowDAO.getAllSlotShowById(idRap, idRoom, idFilms, idSlot); string[] note = ss.Theart_Roomx.Note.Split('|'); DataTable viewGhe = new DataTable(); int numbermaxRow = 0; foreach (SeatType st in ss.Theart_Roomx.SeatTypes) { numbermaxRow += st.NumberSeat; } numbermaxRow = numbermaxRow / ss.Theart_Roomx.NumberMaxSeat; for (int col = 0; col <= ss.Theart_Roomx.NumberMaxSeat - 1; col++) { DataColumn colx = new DataColumn(col + ""); viewGhe.Columns.Add(colx); DataColumn colCss = new DataColumn("css" + col); viewGhe.Columns.Add(colCss); } int count = 0; int nextSeatType = 0; if (note.Length != 0) { nextSeatType = 1; } for (int row = 0; row < numbermaxRow; row++) { DataRow dtRow = viewGhe.NewRow(); viewGhe.Rows.Add(dtRow); for (int col = 0; col < viewGhe.Columns.Count - 1; col++) { int colIndex = col / 2; bool check = true; for (int i = 1; i < note.Length - 1; i++) { int rowXXX = Convert.ToInt32(note[i].Split('-')[0]); int colXXX = Convert.ToInt32(note[i].Split('-')[1]); if (rowXXX == row + 1 && colXXX == colIndex + 1) { viewGhe.Rows[row][col] = "X"; viewGhe.Rows[row][col + 1] = ss.Theart_Roomx.SeatTypes[0].ID; col += 1; check = false; } } if (check) { if (nextSeatType < ss.Theart_Roomx.SeatTypes.Count) { if (count < ss.Theart_Roomx.SeatTypes[nextSeatType].NumberSeat) { if (ss.Booked.Substring(row * 14 + colIndex, 1).Equals("1")) { viewGhe.Rows[row][col] = abc[row] + (colIndex + 1); viewGhe.Rows[row][col + 1] = 2; col += 1; } else if (ss.Booked.Substring(row * 14 + colIndex, 1).Equals("2")) { viewGhe.Rows[row][col] = abc[row] + (colIndex + 1); viewGhe.Rows[row][col + 1] = 12; col += 1; } else { viewGhe.Rows[row][col] = abc[row] + (colIndex + 1); viewGhe.Rows[row][col + 1] = ss.Theart_Roomx.SeatTypes[nextSeatType].ID; col += 1; } count++; } else { nextSeatType++; count = 0; col -= 1; } } } } } this.rptView.DataSource = viewGhe; this.rptView.DataBind(); //this.Label1.Text = (float)Session["Money"] + ""; }