private void setRaptxt() { var dtPhim = dbPhim.LayPhim().ToList(); var dtsuatchieu = dbSuatChieu.LaySuatChieu().ToList(); for (int i = 0; i < dtPhim.Count; i++) { if (comboBox2.Text == dtPhim[i].TenPhim) { for (int j = 0; j < dtsuatchieu.Count; j++) { if (dtPhim[i].MaPhim == dtsuatchieu[j].MaPhim && dtsuatchieu[j].SuatChieu == SuatChieucb.Text) { globalRap = dtsuatchieu[j].MaRap.ToString(); raptxt.Enabled = true; raptxt.Text = globalRap; raptxt.Enabled = false; } } } } }
private void setRaptxt(DataTable dt) { dtSuatChieu = new DataTable(); dtSuatChieu.Clear(); DataSet dsSuatChieu = dbSuatChieu.LaySuatChieu(); dtSuatChieu = dsSuatChieu.Tables[0]; for (int i = 0; i < dtPhim.Rows.Count; i++) { if (Phimcb.Text == dt.Rows[i].ItemArray[0].ToString()) { for (int j = 0; j < dtSuatChieu.Rows.Count; j++) { if (dt.Rows[i].ItemArray[1].ToString() == dtSuatChieu.Rows[j].ItemArray[0].ToString() && dtSuatChieu.Rows[j].ItemArray[1].ToString() == SuatChieucb.Text) { globalRap = dtSuatChieu.Rows[j].ItemArray[2].ToString(); raptxt.Enabled = true; raptxt.Text = globalRap; raptxt.Enabled = false; } } } } }