void LoadDtgvVe() { if (btnVTimKiem.Text == "Tìm kiếm") { sourceVe.DataSource = ve.LayDanhSachThongTinVe(); } else { if (cbVLoaiTimKiem.SelectedItem.ToString() == "Vé chưa bán") { sourceVe.DataSource = ve.LayDanhSachThongTinVeChuaBan(); } else { VeDAO ttve = new VeDAO() { TenRap = cbVRap.SelectedIndex < 0 ? "" : cbVRap.SelectedItem.ToString(), TenPhim = cbVPhim.SelectedIndex < 0 ? "" : cbVPhim.SelectedItem.ToString(), PhongChieu = cbVPhongChieu.SelectedIndex < 0 ? "" : cbVPhongChieu.SelectedItem.ToString(), GioChieu = cbVGioChieu.SelectedIndex < 0 ? "" : (cbVGioChieu.SelectedItem as GioChieuDAO).MaGioChieu, NgayChieu = dtpVNgayChieu.Value }; sourceVe.DataSource = ve.LayDanhSachThongTinVe(ttve); } } ChonVe(); }
void LuuVe() { if (txbVMaVe.Text == "") { return; } VeDAO ttve = new VeDAO() { TenRap = cbVRap.SelectedItem.ToString(), TenPhim = cbVPhim.SelectedItem.ToString(), PhongChieu = cbVPhongChieu.SelectedItem.ToString(), GioChieu = (cbVGioChieu.SelectedItem as GioChieuDAO).MaGioChieu, NgayChieu = dtpVNgayChieu.Value, MaVe = txbVMaVe.Text, HangGhe = txbVHangGhe.Text, SoGhe = Int32.Parse(txbVSoGhe.Text) }; if (ve.KiemTraVe(ttve.MaVe)) { if (ve.SuaVe(ttve.MaVe, ttve.HangGhe, ttve.SoGhe)) { MessageBox.Show("Lưu vé thành công!"); LoadDtgvVe(); } } else if (ve.ThemVe(ttve)) { MessageBox.Show("Lưu vé thành công!"); LoadDtgvVe(); } }
public DataTable LayDanhSachThongTinVe(VeDAO ve) { string ngaychieu = ve.NgayChieu.ToString("MM-dd-yyyy"); string query = string.Format("SELECT r.tenrap [Tên rạp],p.tenphim [Tên phim],pc.tenphong [Phòng chiếu],bc.ngaychieu [Ngày chiếu],bc.magiochieu [Giờ chiếu],gc.dongia [Giá vé],v.mave [Mã vé], v.soghe [Số ghế], v.hangghe [Hàng ghế],v.trangthai [Tình trạng] FROM dbo.Ve v JOIN dbo.BuoiChieu bc ON bc.mashow = v.mashow JOIN dbo.Phim p ON p.maphim = bc.maphim JOIN dbo.Rap r ON r.marap = bc.marap JOIN dbo.PhongChieu pc ON pc.maphong = bc.maphong JOIN dbo.GioChieu gc ON gc.magiochieu = bc.magiochieu WHERE r.tenrap = N'{0}' AND p.tenphim = N'{1}' AND bc.magiochieu = '{2}' AND bc.ngaychieu = '{3}' AND pc.tenphong = N'{4}'", ve.TenRap, ve.TenPhim, ve.GioChieu, ngaychieu, ve.PhongChieu); return(DataProvider.Instance.ExcuteQuery(query)); }
public bool ThemVe(VeDAO ve) { string mashow = buoichieu.LayMaShowTuThongTinVe(ve); string query = string.Format("INSERT INTO dbo.Ve VALUES ( '{0}' , '{1}' , '{2}' ,{3} , N'Chưa bán')", mashow, ve.MaVe, ve.HangGhe, ve.SoGhe); return(DataProvider.Instance.ExcuteNonQuery(query) > 0); }
public string LayMaShowTuThongTinVe(VeDAO ve) { string ngaychieu = ve.NgayChieu.ToString("MM-dd-yyyy"); string query = string.Format("SELECT mashow FROM dbo.BuoiChieu bc JOIN dbo.Rap r ON r.marap = bc.marap JOIN dbo.PhongChieu pc ON pc.maphong = bc.maphong JOIN dbo.GioChieu gc ON gc.magiochieu = bc.magiochieu JOIN phim p ON p.maphim = bc.maphim WHERE r.tenrap = N'{0}' AND p.tenphim = N'{1}' AND bc.magiochieu = '{2}' AND bc.ngaychieu = '{3}' AND pc.tenphong = N'{4}'", ve.TenRap, ve.TenPhim, ve.GioChieu, ngaychieu, ve.PhongChieu); DataTable table = DataProvider.Instance.ExcuteQuery(query); foreach (DataRow item in table.Rows) { return(item["mashow"].ToString()); } return(""); }
public static void Sua(VeDTO p) { VeDAO.Sua(p); }
public static void Them(VeDTO p) { VeDAO.Them(p); }
public static DataTable LoadDSVe() { return(VeDAO.LoadDSVe()); }
public VeBUS() { veDAO = new VeDAO(); }
public static DataTable TimTheoGio(DateTime tugio, DateTime dengio) { return(VeDAO.TimTheoGio(tugio, dengio)); }
public List <VeDTO> TimVe(int MaFilter, string strQuery) { VeDAO ve = new VeDAO(); return(ve.TimVe(MaFilter, strQuery)); }
public static DataTable TimTheoGiaMin(string gia_min) { return(VeDAO.TimTheoGiaMin(gia_min)); }
public static DataTable TimTheoTenPC(string tenpc) { return(VeDAO.TimTheoTenPC(tenpc)); }
public List <VeDTO> getDanhSachVe(int iPage, int numberItem) { VeDAO dao = new VeDAO(); return(dao.getDanhSachVe(iPage, numberItem)); }
public int getTongSoRecord() { VeDAO dao = new VeDAO(); return(dao.getTongSoRecord()); }
/*public List<VeDTO> getVeMayBay(int MaKS) * { * VeDAO veMBDAO = new VeDAO(); * return veMBDAO.getDanhSachVe_CB(MaKS); * }*/ public List <VeDTO> getVeMayBay(int iPage, int numberItem) { VeDAO veMBDAO = new VeDAO(); return(veMBDAO.getDanhSachVe_CB(iPage, numberItem)); }
public static DataTable TimTheoMaKH(string makh) { return(VeDAO.TimTheoMaKH(makh)); }
public static DataTable TimTheoGiaMax(string gia_max) { return(VeDAO.TimTheoGiaMax(gia_max)); }
public static void Xoa(string maphim, string mapc, string malv) { VeDAO.Xoa(maphim, mapc, malv); }
public static DataTable TimTheoSoLuong(string soluong) { return(VeDAO.TimTheoSoLuong(soluong)); }
public static DataTable TimTheoTenPhim(string tenphim) { return(VeDAO.TimTheoTenPhim(tenphim)); }
public static DataTable TimTheoGia(string gia_min, string gia_max) { return(VeDAO.TimTheoGia(gia_min, gia_max)); }
public static DataTable TimTheoTenLV(string tenlv) { return(VeDAO.TimTheoTenLV(tenlv)); }
public bool ThemVe(List <VeDTO> lsVe) { VeDAO ve = new VeDAO(); return(ve.ThemVe(lsVe)); }
public List <VeDTO> LoadVe() { VeDAO ve = new VeDAO(); return(ve.LoadVe()); }
public static DataTable TimTheoSoHD(string mahd) { return(VeDAO.TimTheoSoHD(mahd)); }
public bool ThemVe(VeDTO venew) { VeDAO ve = new VeDAO(); return(ve.ThemVe(venew)); }
public static DataTable TimTheoNgay(DateTime tungay, DateTime denngay) { return(VeDAO.TimTheoNgay(tungay, denngay)); }
public bool XoaVe(int MaVe) { VeDAO ve = new VeDAO(); return(ve.XoaVe(MaVe)); }
public static void Xoa(string mahd) { VeDAO.Xoa(mahd); }