private void FilGVDanhSachPhim() { PhimBUS phimBUS = new PhimBUS(); gvDanhSachPhim.DataSource = phimBUS.LayDanhSach(); gvDanhSachPhim.DataBind(); }
protected void btnAddPhim_Click(object sender, EventArgs e) { PhimBUS pBUS = new PhimBUS(); //int count = pBUS.SoLuongPhim(); //string map = ""; //if (count / 10 == 0) // map = "P00" + count.ToString(); //else if (count / 100 == 0) // map = "P0" + count.ToString(); //else // map = "P" + count.ToString(); PhimDTO ph = new PhimDTO(); ph.Ten = tbTenPhim.Text; ph.TheLoai = tbTheLoai.SelectedValue; ph.DaoDien = tbDaoDien.Text; ph.DienVien = tbDienVien.Text; ph.GioiHanDoTuoi = Convert.ToInt32(tbGHDT.Text); ph.NoiDung = tbNoiDung.Text; ph.NamSanXuat = Convert.ToInt32(tbNamSX.Text); ph.Poster = tbPoster.Text; ph.Trailer = tbTrailer.Text; pBUS.ThemPhim(ph); string strBuilder = "<script language='javascript'>alert('" + "Thêm thành công" + "')</script>"; Response.Write(strBuilder); ResetTextBoxes(); FilGVDanhSachPhim(); }
void Load_Data(DataTable dataTable) { object[] a = new object[9]; a = dataTable.Rows[0].ItemArray; string maphim = a[1].ToString(); lblTenPhim.Content = a[2].ToString(); txtDaoDien.Text = a[3].ToString(); txtDienVien.Text = a[4].ToString(); txtND.Text = a[5].ToString(); txtNamSX.Text = a[6].ToString(); txtNuocSX.Text = a[7].ToString(); txtThoiLuong.Text = a[8].ToString(); DataTable dataTable_theloai = PhimBUS.LoadTheLoaiPhim(maphim); object[] b = new object[2]; b = dataTable_theloai.Rows[0].ItemArray; txtTheLoai.Text += b[1].ToString(); for (int j = 0; j <= dataTable_theloai.Rows.Count - 1; j++) { b = new object[2]; b = dataTable_theloai.Rows[j].ItemArray; txtTheLoai.Text += ", " + b[1].ToString(); } }
private void TxtTimKiem_TextChanged(object sender, TextChangedEventArgs e) { DataTable dataTable = new DataTable(); if (txtTimKiem.Text.Length >= 1 && txtTimKiem.Text != "Tìm Kiếm...") { switch (type_timkiem) { case 0: { dataTable = PhimBUS.TimTheoMaP(txtTimKiem.Text.ToString()); } break; case 1: { dataTable = PhimBUS.TimTheoTenPhim(txtTimKiem.Text.ToString()); } break; } } else if (txtTimKiem.Text.Length == 0) { dataTable = PhimBUS.LoadDSPhim(); } Load_Data(dataTable); }
private void TxtTimKiem_LostFocus(object sender, RoutedEventArgs e) { if (txtTimKiem.Text == "") { txtTimKiem.Text = "Tìm Kiếm..."; DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); } }
private void GridPhim_Loaded(object sender, RoutedEventArgs e) { KhongChoNhap(); DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); panelTimKiem.Visibility = btnHuy_Sua.Visibility = Visibility.Hidden; }
protected void gvDanhSachPhim_RowDeleting(object sender, GridViewDeleteEventArgs e) { PhimBUS pBUS = new PhimBUS(); TableCell cell = gvDanhSachPhim.Rows[e.RowIndex].Cells[0]; pBUS.XoaPhim(Convert.ToInt32(cell.Text)); cell = gvDanhSachPhim.Rows[e.RowIndex].Cells[8]; string strBuilder = "<script language='javascript'>alert('" + "Xóa thành công" + "')</script>"; Response.Write(strBuilder); FilGVDanhSachPhim(); }
private void BtnXoa_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Bạn có chắc chắn muốn xóa phim này không?", "Thông Báo", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { PhimBUS.Xoa(txtMaPhim.Text); MessageBox.Show("Xóa phim thành công", "Thông Báo"); } DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); }
private void BtnThem_Click(object sender, RoutedEventArgs e) { frmAddPhim addPhim = new frmAddPhim(); addPhim.ShowDialog(); DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); KhongChoNhap(); btnThem.Visibility = Visibility.Visible; btnSua.IsEnabled = btnXoa.IsEnabled = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { maPhim = Convert.ToInt32(Request.QueryString["id"]); PhimBUS phimBUS = new PhimBUS(); PhimDTO phimDTO = phimBUS.LayThongTin(maPhim); lbl_name.Text = phimDTO.Ten; SuatChieuBUS suatChieuBUS = new SuatChieuBUS(); rdl_ngaychieu.DataSource = suatChieuBUS.LayDSNgayChieuCuaPhim(maPhim); rdl_ngaychieu.DataBind(); } }
private void Grid_DanhSachPhim_Loaded(object sender, RoutedEventArgs e) { // lấy số lượng phòng chiếu của rạp, từ đó datagrid sẽ thêm số lượng cột là số lượng phòng chiếu DataTable DT_DSPhim = new DataTable(); DT_DSPhim = PhimBUS.LoadDSPhim(); soluong_phim = DT_DSPhim.Rows.Count; for (int i = 0; i < soluong_phim; i++) { object[] a = new object[10]; a = DT_DSPhim.Rows[i].ItemArray; StackPanel stackpanel = new StackPanel(); stackpanel.Width = stackpanel.MaxWidth = 280; stackpanel.Height = stackpanel.MaxHeight = 400; stackpanel.Margin = new Thickness(5, 5, 10, 5); WrapPanel_DanhSachPhim.Children.Add(stackpanel); Image image = new Image(); image.Width = image.MaxWidth = stackpanel.Width; image.Height = image.MaxHeight = (stackpanel.Height * 2 / 3) + 10; image.Stretch = Stretch.Uniform; string linkPoster = "pack://application:,,,/Resources/"; image.Source = new BitmapImage(new Uri(linkPoster + a[9].ToString(), UriKind.Absolute)); image.Margin = new Thickness(0, 5, 0, 5); stackpanel.Children.Add(image); TextBlock textblock = new TextBlock(); textblock.Width = stackpanel.Width - 10; textblock.Height = stackpanel.Height / 8; textblock.Text = a[2].ToString(); textblock.Foreground = Brushes.White; textblock.Margin = new Thickness(5, 5, 10, 5); textblock.TextWrapping = TextWrapping.Wrap; stackpanel.Children.Add(textblock); Button button = new Button(); button.Name = a[1].ToString(); button.Content = "Đặt vé"; button.Tag = linkPoster + a[9].ToString(); button.Width = button.MaxWidth = textblock.Width; button.Height = button.MaxHeight = stackpanel.Height / 10; button.Click += MuaVe_Click; button.Margin = new Thickness(5, 0, 10, 10); stackpanel.Children.Add(button); } }
private void FilGVDanhSachLichChieu() { SuatChieuBUS SuatChieuBUS = new SuatChieuBUS(); gvDanhSachLichChieu.DataSource = SuatChieuBUS.LayDanhSach(); gvDanhSachLichChieu.DataBind(); PhimBUS phimBUS = new PhimBUS(); ddl_maphim.DataSource = phimBUS.LayDanhSachIDPhim(); ddl_maphim.DataBind(); PhongChieuBUS phongChieuBUS = new PhongChieuBUS(); ddl_maphongchieu.DataSource = phongChieuBUS.LayDanhSachMaPhongChieu(); ddl_maphongchieu.DataBind(); }
private void BtnLamMoi_Click(object sender, RoutedEventArgs e) { KhongChoNhap(); DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); panelTimKiem.Visibility = btnHuy_Sua.Visibility = btnLuu_Sua.Visibility = Visibility.Hidden; if (btnSua.Visibility == Visibility.Hidden) { btnSua.Visibility = Visibility.Visible; } if (btnThem.IsEnabled == btnXoa.IsEnabled == false) { btnThem.IsEnabled = btnXoa.IsEnabled = true; } }
private void Grid_DanhSachPhim_Loaded(object sender, RoutedEventArgs e) { // lấy số lượng phòng chiếu của rạp, từ đó datagrid sẽ thêm số lượng cột là số lượng phòng chiếu DataTable DT_DSPhim = new DataTable(); DT_DSPhim = PhimBUS.LoadDSPhim(); soluong_phim = DT_DSPhim.Rows.Count; for (int i = 0; i < soluong_phim; i++) { object[] a = new object[10]; a = DT_DSPhim.Rows[i].ItemArray; StackPanel stackpanel = new StackPanel(); stackpanel.Width = stackpanel.MaxWidth = 280; stackpanel.Height = stackpanel.MaxHeight = 350; //stackpanel.Background = Brushes.Red; stackpanel.Margin = new Thickness(5, 5, 10, 5); WrapPanel_DanhSachPhim.Children.Add(stackpanel); Image image = new Image(); image.Name = a[1].ToString(); image.Width = image.MaxWidth = stackpanel.Width; image.Height = image.MaxHeight = stackpanel.Height - 50; image.Stretch = Stretch.Uniform; image.MouseDown += Image_MouseDown; string linkPoster = "pack://application:,,,/Resources/"; image.Source = new BitmapImage(new Uri(linkPoster + a[9].ToString(), UriKind.Absolute)); image.Margin = new Thickness(5, 5, 10, 5); stackpanel.Children.Add(image); TextBlock textblock = new TextBlock(); textblock.Width = stackpanel.Width - 10; textblock.Height = stackpanel.Height - 320; textblock.Text = a[2].ToString(); //textblock.Background = Brushes.Blue; textblock.Foreground = Brushes.White; textblock.Margin = new Thickness(5, 5, 10, 5); textblock.TextWrapping = TextWrapping.Wrap; stackpanel.Children.Add(textblock); } }
private void Load_DataCombobox() { DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); for (int i = 0; i < dataTable.Rows.Count; i++) { object[] a = new object[9]; a = dataTable.Rows[i].ItemArray; string tenphim = a[2].ToString(); cbbTenPhim.Items.Add(tenphim); string maphim = a[1].ToString(); listMaPhim.Add(maphim); } dataTable = PhongChieuBUS.LoadDSPC(); for (int i = 0; i < dataTable.Rows.Count; i++) { object[] a = new object[9]; a = dataTable.Rows[i].ItemArray; string tenpc = a[2].ToString(); cbbTenPC.Items.Add(tenpc); string mapc = a[1].ToString(); listMaPC.Add(mapc); } dataTable = CaChieuBUS.LoadDSCaChieu(); for (int i = 0; i < dataTable.Rows.Count; i++) { object[] a = new object[5]; a = dataTable.Rows[i].ItemArray; string tencc = a[2].ToString(); cbbTenCC.Items.Add(tencc); string macc = a[1].ToString(); listMaCC.Add(macc); } }
protected void Page_Load(object sender, EventArgs e) { PhimBUS phimBUS = new PhimBUS(); List <PhimDTO> top3 = phimBUS.LayTop3(); HyperLink link = new HyperLink(); link.Style.Add("text-align", "center"); link.Style.Add("color", "orange"); link.Style.Add("Font-Size", "Large"); link.Text = top3[0].Ten; link.NavigateUrl = "ThongTinPhim.aspx?search=false&id=" + top3[0].MaPhim.ToString(); Image img = new Image(); img.ImageUrl = top3[0].Poster; MyPanel1.Controls.Add(link); MyPanel1.Controls.Add(img); link = new HyperLink(); link.Style.Add("text-align", "center"); link.Style.Add("color", "orange"); link.Style.Add("Font-Size", "Large"); link.Text = top3[1].Ten; link.NavigateUrl = "ThongTinPhim.aspx?search=false&id=" + top3[1].MaPhim.ToString(); img = new Image(); img.ImageUrl = top3[1].Poster; MyPanel2.Controls.Add(link); MyPanel2.Controls.Add(img); link = new HyperLink(); link.Style.Add("text-align", "center"); link.Style.Add("color", "orange"); link.Style.Add("Font-Size", "Large"); link.Text = top3[2].Ten; link.NavigateUrl = "ThongTinPhim.aspx?search=false&id=" + top3[2].MaPhim.ToString(); img = new Image(); img.ImageUrl = top3[2].Poster; MyPanel3.Controls.Add(link); MyPanel3.Controls.Add(img); }
protected void Page_Load(object sender, EventArgs e) { String MaVe = Request.QueryString["id"]; VeBUS veBUS = new VeBUS(); SuatChieuBUS suatChieuBUS = new SuatChieuBUS(); PhimBUS phimBUS = new PhimBUS(); PhongChieuBUS phongChieuBUS = new PhongChieuBUS(); VeDTO veDTO = veBUS.LayThongTin(Convert.ToInt32(MaVe)); SuatChieuDTO suatChieuDTO = suatChieuBUS.LayThongTin(veDTO.MaSuatChieu); PhimDTO phimDTO = phimBUS.LayThongTin(suatChieuDTO.MaPhim); PhongChieuDTO phongChieuDTO = phongChieuBUS.LayThongTin(suatChieuDTO.MaPhongChieu); VeID.Text += veDTO.MaVe.ToString(); Phim.Text += phimDTO.Ten; PhongChieu.Text += phongChieuDTO.TenPhongChieu; NgayChieu.Text += suatChieuDTO.NgayChieu; SuatCHieu.Text += suatChieuDTO.GioChieu; SoGhe.Text += veDTO.Ghe; LoaiVe.Text += (veDTO.LoaiVe) ? "VIP" : "Thường"; GiaVe.Text += veDTO.GiaVe.ToString() + " VNĐ"; }
protected void Page_Load(object sender, EventArgs e) { PhimBUS phimBUS = new PhimBUS(); List <PhimDTO> listPhim = phimBUS.LayDanhSach(); Image image; LinkButton linkButton; for (int i = 0; i < listPhim.Count; i++) { image = new Image(); image.ImageUrl = listPhim[i].Poster; linkButton = new LinkButton(); linkButton.Text = listPhim[i].Ten; int maphim = listPhim[i].MaPhim; linkButton.Click += (s, ev) => { Response.Redirect("ThongTinPhim.aspx?search=false&id=" + maphim.ToString()); }; if (i % 2 == 0) { Panel3.Controls.Add(image); Panel3.Controls.Add(new LiteralControl("<br />")); Panel3.Controls.Add(linkButton); Panel3.Controls.Add(new LiteralControl("<br /><br />")); } else { Panel2.Controls.Add(image); Panel2.Controls.Add(new LiteralControl("<br />")); Panel2.Controls.Add(linkButton); Panel2.Controls.Add(new LiteralControl("<br /><br />")); } } }
void Load_Data(DataTable dataTable) { dtgDSPhim.Items.Clear(); dtgDSPhim.ItemsSource = null; listPhim = new List <PhimDTO>(); for (int i = 0; i <= dataTable.Rows.Count - 1; i++) { object[] a = new object[9]; a = dataTable.Rows[i].ItemArray; string stt = (i + 1).ToString(); string maphim = a[1].ToString(); string tenphim = a[2].ToString(); string daodien = a[3].ToString(); string dienvien = a[4].ToString(); string theloai = null; DataTable dataTable_theloai = PhimBUS.LoadTheLoaiPhim(maphim); object[] b = new object[2]; b = dataTable_theloai.Rows[0].ItemArray; theloai += b[1].ToString(); for (int j = 0; j <= dataTable_theloai.Rows.Count - 1; j++) { b = new object[2]; b = dataTable_theloai.Rows[j].ItemArray; theloai += ", " + b[1].ToString(); } string noidung = a[5].ToString(); string namsx = a[6].ToString(); string nuocsx = a[7].ToString(); string thoiluong = a[8].ToString(); listPhim.Add(new PhimDTO(stt, maphim, tenphim, daodien, dienvien, theloai, noidung, namsx, nuocsx, thoiluong)); dtgDSPhim.Items.Add(listPhim[i]); } }
private void GridfrmThongTinPhim_Loaded(object sender, RoutedEventArgs e) { Image carImg = new Image(); BitmapImage carBitmap = new BitmapImage(new Uri(DiaChi, UriKind.Absolute)); carImg.Width = 165; carImg.Height = 260; carImg.Source = carBitmap; carImg.Stretch = Stretch.Fill; canvas1.Children.Add(carImg); ImageBrush myBrush = new ImageBrush(); Image image = new Image(); image.Source = new BitmapImage(new Uri(DiaChi)); myBrush.ImageSource = image.Source; myBrush.Opacity = 0.4; GridfrmThongTinPhim.Background = myBrush; DataTable dataTable = new DataTable(); dataTable = PhimBUS.TimTheoMaP(MaPhim); Load_Data(dataTable); }
private void GridfrmThongTinPhim_Loaded(object sender, RoutedEventArgs e) { // carBitmap = new BitmapImage(new Uri("pack://application:,,,/Resources/cuong-phong.jpg", UriKind.Absolute)); carBitmap = new BitmapImage(new Uri(DiaChi, UriKind.Absolute)); DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += timer_Tick; timer.Start(); if (txtND.Text == "") { carImg.Width = 165; carImg.Height = 230; carImg.Source = carBitmap; canvas1.Children.Add(carImg); } DataTable dataTable = new DataTable(); dataTable = PhimBUS.TimTheoMaP(MaPhim); Load_Data(dataTable); }
protected void Page_Load(object sender, EventArgs e) { PhimBUS phimBUS = new PhimBUS(); String search = Request.QueryString["search"].ToString(); if (search == "false") { int id = Convert.ToInt32(Request.QueryString["id"]); listResults.Clear(); listResults.Add(phimBUS.LayThongTin(id)); } else { String str; if (search == "name") { string name = Request.QueryString["name"]; List <PhimDTO> result = phimBUS.TimKiemTheoTen(name); if (result == null || result.Count == 0) { isError = true; } else { listResults = result; } lbl_error.Text = "Không tìm thấy kết quả cho : " + name; byName = true; } else { int type = Convert.ToInt32(Request.QueryString["type"]); switch (type) { case 0: str = "Hành động"; break; case 1: str = "Viễn tưởng"; break; case 2: str = "Lãng mạn"; break; case 3: str = "Tâm lý"; break; case 4: str = "Kinh dị"; break; default: str = "Hoạt hình"; break; } List <PhimDTO> result = phimBUS.TimKiemTheoTheLoai(str); if (result == null || result.Count == 0) { isError = true; } else { listResults = result; } lbl_error.Text = "Không tìm thấy phim nào thuộc thể loại " + str; byName = false; } } if (isError) { //Lỗi không tìm thấy phim yêu cầu //Session["TenPhim"] = null; lbl_error.Visible = true; img_Phim.Visible = btn_DatVe.Visible = btn_Trailer.Visible = lbl_NoiDung.Visible = false; lbl_Tenphim.Visible = lbl_Theloai.Visible = lbl_NamSX.Visible = lbl_Daodien.Visible = false; lbl_Dienvien.Visible = lbl_Dotuoi.Visible = lbl_TheloaiTD.Visible = lbl_NamSXTD.Visible = false; lbl_DaodienTD.Visible = lbl_DienvienTD.Visible = lbl_DotuoiTD.Visible = false; lnk_back.Visible = lnk_forward.Visible = false; } else { lbl_error.Visible = false; img_Phim.Visible = true; btn_DatVe.Visible = true; btn_Trailer.Visible = true; lbl_NoiDung.Visible = true; lbl_Theloai.Visible = true; lbl_NamSX.Visible = true; lbl_Daodien.Visible = true; lbl_Dienvien.Visible = true; lbl_Dotuoi.Visible = true; lbl_TheloaiTD.Visible = true; lbl_NamSXTD.Visible = true; lbl_DaodienTD.Visible = true; lbl_DienvienTD.Visible = true; lbl_DotuoiTD.Visible = true; countResults = listResults.Count; if (curResult == countResults - 1 || countResults == 1) { lnk_back.Visible = true; lnk_forward.Visible = false; } else { lnk_back.Visible = true; lnk_forward.Visible = true; } img_Phim.ImageUrl = listResults[curResult].Poster; img_Phim.DataBind(); lbl_NoiDung.Text = listResults[curResult].NoiDung; lbl_Tenphim.Text = listResults[curResult].Ten; lbl_Theloai.Text = listResults[curResult].TheLoai; lbl_NamSX.Text = listResults[curResult].NamSanXuat.ToString(); lbl_Daodien.Text = listResults[curResult].DaoDien; lbl_Dienvien.Text = listResults[curResult].DienVien; lbl_Dotuoi.Text = listResults[curResult].GioiHanDoTuoi.ToString(); } }
private void LoadDSPhim() { PhimBUS phim = new PhimBUS(); lsPhim = phim.LoadPhim(); }
private void BtnLuu_Click(object sender, RoutedEventArgs e) { bool TrungMaP = false; SuaLai: string maphim = null; if (txtMaP.Text.Length != 0) { maphim = txtMaP.Text; } string tenphim = null; if (txtTenphim.Text.Length != 0) { tenphim = txtTenphim.Text; } string daodien = null; if (txtDaodien.Text.Length != 0) { daodien = txtDaodien.Text; } string dienvien = null; if (txtDienvien.Text.Length != 0) { dienvien = txtDienvien.Text; } string malp = null; if (txtMalp.Text.Length != 0) { malp = txtMalp.Text; } string noidung = null; if (txtNoidung.Text.Length != 0) { noidung = txtNoidung.Text; } string namsx = null; if (txtNamsx.Text.Length != 0) { namsx = txtNamsx.Text; } string nuocsx = null; if (txtNuocsx.Text.Length != 0) { nuocsx = txtNuocsx.Text; } string thoiluong = null; if (txtThoiluong.Text.Length != 0) { thoiluong = txtThoiluong.Text; } PhimDTO phim = new PhimDTO(maphim, tenphim, daodien, dienvien, malp, noidung, namsx, nuocsx, thoiluong); if (maphim == null) { if (TrungMaP == false) { MessageBox.Show("Mã phim không được để trống"); } else { MessageBox.Show("Mã phim bị trùng"); } txtMaP.Focus(); } else if (tenphim == null) { MessageBox.Show("Tên phim không được để trống"); } else if (daodien == null) { MessageBox.Show("Đạo diễn không được để trống"); txtDaodien.Focus(); } else if (dienvien == null) { MessageBox.Show("Diễn viên không được để trống"); txtDienvien.Focus(); } else if (noidung == null) { MessageBox.Show("Nội dung không được để trống"); txtNoidung.Focus(); } else if (namsx == null) { MessageBox.Show("Địa chỉ không được để trống"); txtNamsx.Focus(); } else if (nuocsx == null) { MessageBox.Show("Lương không được để trống"); txtNuocsx.Focus(); } else if (malp == null) { MessageBox.Show("Mã loại phim không được để trống"); txtMalp.Focus(); } else if (thoiluong == null) { MessageBox.Show("Thời lượng phim không được để trống"); txtThoiluong.Focus(); } else { try { PhimBUS.Them(phim); } catch { txtMaP.Clear(); TrungMaP = true; goto SuaLai; } MessageBox.Show("Thêm thông tin phim thành công", "Thông báo"); this.Close(); } }
private void BtnLuu_Sua_Click(object sender, RoutedEventArgs e) { bool TrungMaP = false; SuaLai: string maphim = null; if (txtMaPhim.Text.Length != 0) { maphim = txtMaPhim.Text; } string tenphim = null; if (txtTenPhim.Text.Length != 0) { tenphim = txtTenPhim.Text; } string daodien = null; if (txtDaoDien.Text.Length != 0) { daodien = txtDaoDien.Text; } string dienvien = null; if (txtDienVien.Text.Length != 0) { dienvien = txtDienVien.Text; } string noidung = null; if (txtNoiDung.Text.Length != 0) { noidung = txtNoiDung.Text; } string namsx = null; if (txtNamSX.Text.Length != 0) { namsx = txtNamSX.Text; } string nuocsx = null; if (txtNuocSX.Text.Length != 0) { nuocsx = txtNuocSX.Text; } string thoiluong = null; if (txtThoiLuong.Text.Length != 0) { thoiluong = txtThoiLuong.Text; } PhimDTO phim = new PhimDTO(maphim, tenphim, daodien, dienvien, noidung, namsx, nuocsx, thoiluong); if (maphim == null) { if (TrungMaP == false) { MessageBox.Show("Mã phim không được để trống"); } else { MessageBox.Show("Mã phim bị trùng"); } txtMaPhim.Focus(); } else if (tenphim == null) { MessageBox.Show("Tên phim không được để trống"); } else if (daodien == null) { MessageBox.Show("Đạo diễn không được để trống"); txtDaoDien.Focus(); } else if (dienvien == null) { MessageBox.Show("Diễn viên không được để trống"); txtDienVien.Focus(); } else if (noidung == null) { MessageBox.Show("Nội dung không được để trống"); txtNoiDung.Focus(); } else if (namsx == null) { MessageBox.Show("Địa chỉ không được để trống"); txtNamSX.Focus(); } else if (nuocsx == null) { MessageBox.Show("Lương không được để trống"); txtNuocSX.Focus(); } else if (thoiluong == null) { MessageBox.Show("Thời lượng phim không được để trống"); txtThoiLuong.Focus(); } else { try { PhimBUS.Sua(phim); } catch { txtMaPhim.Clear(); TrungMaP = true; goto SuaLai; } MessageBox.Show("Sửa thông tin phim thành công", "Thông báo"); DataTable dataTable = new DataTable(); dataTable = PhimBUS.LoadDSPhim(); Load_Data(dataTable); KhongChoNhap(); btnHuy_Sua.Visibility = btnLuu_Sua.Visibility = Visibility.Hidden; btnSua.Visibility = Visibility.Visible; btnThem.IsEnabled = btnXoa.IsEnabled = true; dtgDSPhim.IsEnabled = true; Selected = false; } }