Exemple #1
0
        private void FilGVDanhSachPhongChieu()
        {
            PhongChieuBUS phongChieuBUS = new PhongChieuBUS();

            gvDanhSachPhongChieu.DataSource = phongChieuBUS.LayDanhSach();
            gvDanhSachPhongChieu.DataBind();
        }
Exemple #2
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            //bool flag_pc = false;
            PhongChieuBUS pcBUS = new PhongChieuBUS();
            PhongChieuDTO pc    = new PhongChieuDTO();

            pc.TenPhongChieu = tbTenPC.Text;
            pc.SoLuongGhe    = Convert.ToInt32(tbSoLuongCho.Text);
            pc.TinhTrang     = (tbTinhTrang.SelectedValue == "Hoạt động");

            pcBUS.ThemPhongChieu(pc);

            //if (flag_pc == false)
            //{
            //    string strBuilder = "<script language='javascript'>alert('" + "Ma Phong Chieu da ton tai" + "')</script>";
            //    Response.Write(strBuilder);
            //    tbMaPC.Text = "";
            //    tbSoLuongCho.Text = "";
            //    tbLoaiMC.Text = "";
            //    tbLoaiAT.Text = "";
            //    tbTinhTrang.Text = "";
            //    return;
            //}
            tbTenPC.Text      = "";
            tbSoLuongCho.Text = "";
            tbTinhTrang.Text  = "";
            string strBuilder = "<script language='javascript'>alert('" + "Thêm thành công" + "')</script>";

            Response.Write(strBuilder);
            FilGVDanhSachPhongChieu();
        }
        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 = PhongChieuBUS.TimTheoMaPC(txtTimKiem.Text.ToString());
                }
                break;

                case 1:
                {
                    dataTable = PhongChieuBUS.TimTheoTenPhongChieu(txtTimKiem.Text.ToString());
                }
                break;
                }
            }
            else if (txtTimKiem.Text.Length == 0)
            {
                dataTable = PhongChieuBUS.LoadDSPC();
            }
            Load_Data(dataTable);
        }
        private void GridPhongChieu_Loaded(object sender, RoutedEventArgs e)
        {
            KhongChoNhap();
            DataTable dataTable = new DataTable();

            dataTable = PhongChieuBUS.LoadDSPC();
            Load_Data(dataTable);

            panelTimKiem.Visibility = btnHuy_Sua.Visibility = Visibility.Hidden;
        }
 private void txtTimKiem_LostFocus(object sender, RoutedEventArgs e)
 {
     if (txtTimKiem.Text == "")
     {
         txtTimKiem.Text = "Tìm Kiếm...";
         DataTable dataTable = new DataTable();
         dataTable = PhongChieuBUS.LoadDSPC();
         Load_Data(dataTable);
     }
 }
Exemple #6
0
        protected void rdl_suatchieu_SelectedIndexChanged(object sender, EventArgs e)
        {
            gioChieu = rdl_suatchieu.SelectedItem.Text;
            SuatChieuBUS  suatChieuBUS  = new SuatChieuBUS();
            PhongChieuBUS phongChieuBUS = new PhongChieuBUS();
            int           mapc          = suatChieuBUS.LayMaPhongChieu(maPhim, ngayChieu, gioChieu);

            ddl_day.DataSource = phongChieuBUS.LayDanhSachDayGhe(mapc);
            ddl_day.DataBind();
        }
Exemple #7
0
        protected void gvDanhSachPhongChieu_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            PhongChieuBUS pcBUS = new PhongChieuBUS();
            TableCell     cell  = gvDanhSachPhongChieu.Rows[e.RowIndex].Cells[0];

            pcBUS.XoaPhongChieu(Convert.ToInt32(cell.Text));
            string strBuilder = "<script language='javascript'>alert('" + "Xóa thành công" + "')</script>";

            Response.Write(strBuilder);
            FilGVDanhSachPhongChieu();
        }
        private void btnXoa_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Bạn có chắc chắn muốn xóa phòng chiếu này không?", "Thông Báo", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                PhongChieuBUS.Xoa(txtMaPC.Text);
                MessageBox.Show("Xóa phòng chiếu thành công", "Thông Báo");
            }
            DataTable dataTable = new DataTable();

            dataTable = PhongChieuBUS.LoadDSPC();
            Load_Data(dataTable);
            btnLamMoi_Click(sender, e);
        }
        private void btnThem_Click(object sender, RoutedEventArgs e)
        {
            frmAddPhongChieu frmAddPhongChieu = new frmAddPhongChieu();

            frmAddPhongChieu.ShowDialog();

            DataTable dataTable = new DataTable();

            dataTable = PhongChieuBUS.LoadDSPC();
            Load_Data(dataTable);
            //dtgDSPC.ItemsSource = PhongChieuBUS.LoadDSPC().DefaultView;

            KhongChoNhap();
            btnThem.Visibility = Visibility.Visible;
            btnSua.IsEnabled   = btnXoa.IsEnabled = true;
        }
        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 = PhongChieuBUS.LoadDSPC();
            Load_Data(dataTable);

            panelTimKiem.Visibility = btnLuu_Sua.Visibility = btnHuy_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 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);
            }
        }
Exemple #13
0
        void AddColumPhongChieu()
        {
            // 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_PhongChieu = new DataTable();

            DT_PhongChieu      = PhongChieuBUS.LoadDSPC();
            soluong_phongchieu = DT_PhongChieu.Rows.Count;
            tenphim            = new string[soluong_phongchieu];
            for (int i = 0; i < soluong_phongchieu; i++)
            {
                tenphim[i] = "";
            }

            for (int i = 0; i < soluong_phongchieu; i++)
            {
                DataGridTextColumn dataGridTextColumn = new DataGridTextColumn();
                dataGridTextColumn.Header  = "Phòng chiếu " + (i + 1).ToString();
                dataGridTextColumn.Binding = new Binding("TenPhim[" + i.ToString() + "]");
                dtgDSLichChieu.Columns.Add(dataGridTextColumn);
            }
        }
Exemple #14
0
        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Đ";
        }
        private void btnLuu_Click(object sender, RoutedEventArgs e)
        {
            bool TrungMaPC = false;

Nhaplai:
            string mapc = null;

            if (txtMaPC.Text.Length != 0)
            {
                mapc = txtMaPC.Text;
            }
            string tenpc = null;

            if (txtTenPC.Text.Length != 0)
            {
                tenpc = txtTenPC.Text;
            }

            string socho = null;

            if (txtSoCho.Text.Length != 0)

            {
                socho = txtSoCho.Text;
            }

            string maychieu = null;

            if (cbbMayChieu.Text.Length != 0)
            {
                maychieu = cbbMayChieu.Text;
            }
            string loa = null;

            if (cbbLoa.Text.Length != 0)
            {
                loa = cbbLoa.Text;
            }
            string dientich = null;

            if (txtDienTich.Text.Length != 0)
            {
                dientich = txtDienTich.Text;
            }
            string tinhtrang = null;

            if (txtTinhTrang.Text.Length != 0)
            {
                tinhtrang = txtTinhTrang.Text;
            }
            string trangthietbikhac = null;

            if (txtTrangThietBiKhac.Text.Length != 0)
            {
                trangthietbikhac = txtTrangThietBiKhac.Text;
            }


            PhongChieuDTO pc = new PhongChieuDTO(mapc, tenpc, Int32.Parse(socho), maychieu, loa, Int32.Parse(dientich), tinhtrang, trangthietbikhac);

            // báo lỗi nếu chưa nhập theo thứ tự trừ trên xuống , trái sang phải

            if (mapc == null)
            {
                if (TrungMaPC == false)
                {
                    MessageBox.Show("Chưa nhập mã phòng chiếu");
                    txtMaPC.Focus();
                }
                else
                {
                    MessageBox.Show("Mã phòng chiếu trùng");
                    txtMaPC.Focus();
                }
            }
            else if (tenpc == null)
            {
                MessageBox.Show("Chưa nhập tên phòng chiếu");
                txtTenPC.Focus();
            }
            else if (socho == null)
            {
                MessageBox.Show("Chưa nhập số chỗ");
                txtSoCho.Focus();
            }
            else if (maychieu == null)
            {
                MessageBox.Show("Chưa nhập máy chiếu");
                cbbMayChieu.Focus();
            }
            else if (loa == null)
            {
                MessageBox.Show("Chưa chọn loa");
                cbbLoa.Focus();
            }
            else if (dientich == null)
            {
                MessageBox.Show("Chưa nhập diện tích");
                txtDienTich.Focus();
            }

            else if (tinhtrang == null)
            {
                MessageBox.Show("Chưa nhập tình trạng");
                txtTinhTrang.Focus();
            }
            else if (trangthietbikhac == null)
            {
                MessageBox.Show("Chưa nhập trang thiết bị khác");
                txtTrangThietBiKhac.Focus();
            }
            else
            {
                try
                {
                    PhongChieuBUS.Them(pc);
                }
                catch
                {
                    txtMaPC.Clear();
                    TrungMaPC = true;
                    goto Nhaplai;
                }

                MessageBox.Show("Thêm phòng chiếu mới thành công", "Thông báo");
                this.Close();
            }
        }
        private void btnLuu_Sua_Click(object sender, RoutedEventArgs e)

        {
            bool TrungMaPC = false;

SuaLai:
            string mapc = null;

            if (txtMaPC.Text.Length != 0)
            {
                mapc = txtMaPC.Text;
            }
            string tenpc = null;

            if (txtTenPC.Text.Length != 0)
            {
                tenpc = txtTenPC.Text;
            }
            string socho = null;

            if (txtSoCho.Text.Length != 0)
            {
                socho = txtSoCho.Text;
            }
            string maychieu = null;

            if (txtMayChieu.Text.Length != 0)
            {
                maychieu = txtMayChieu.Text;
            }
            string loa = null;

            if (txtLoa.Text.Length != 0)
            {
                loa = txtLoa.Text;
            }
            string dientich = null;

            if (txtDienTich.Text.Length != 0)
            {
                dientich = txtDienTich.Text;
            }
            string tinhtrang = null;

            if (txtTinhTrang.Text.Length != 0)
            {
                tinhtrang = txtTinhTrang.Text;
            }
            string trangthietbikhac = null;

            if (txtTrangThietBiKhac.Text.Length != 0)
            {
                trangthietbikhac = txtTrangThietBiKhac.Text;
            }


            PhongChieuDTO nv = new PhongChieuDTO(mapc, tenpc, Int32.Parse(socho), maychieu, loa, Int32.Parse(dientich), tinhtrang, trangthietbikhac);


            if (mapc == null)
            {
                if (TrungMaPC == false)
                {
                    MessageBox.Show("Mã số phòng chiếu không được để trống");
                }
                else
                {
                    MessageBox.Show("Mã số phòng chiếu bị trùng");
                }
                txtMaPC.Focus();
            }
            else if (tenpc == null)
            {
                MessageBox.Show("Họ tên không được để trống");
                txtTenPC.Focus();
            }
            else if (socho == null)
            {
                MessageBox.Show("Số chỗ không được để trống");
                txtSoCho.Focus();
            }
            else if (maychieu == null)
            {
                MessageBox.Show("Máy chiếu không được để trống");
                txtMayChieu.Focus();
            }
            else if (loa == null)
            {
                MessageBox.Show("Loa không được để trống");
                txtLoa.Focus();
            }
            else if (dientich == null)
            {
                MessageBox.Show("Diện tích không được để trống");
                txtDienTich.Focus();
            }

            else if (tinhtrang == null)
            {
                MessageBox.Show("Tình trạng không được để trống");
                txtTinhTrang.Focus();
            }
            else if (trangthietbikhac == null)
            {
                MessageBox.Show("Trang thiết bị khác không được để trống");
                txtTrangThietBiKhac.Focus();
            }
            else
            {
                try
                {
                    PhongChieuBUS.Sua(nv);
                }
                catch
                {
                    txtMaPC.Clear();
                    TrungMaPC = true;
                    goto SuaLai;
                }
                MessageBox.Show("Sửa thông tin phòng chiếu  thành công", "Thông báo");

                DataTable dataTable = new DataTable();
                dataTable = PhongChieuBUS.LoadDSPC();
                Load_Data(dataTable);

                KhongChoNhap();
                btnLuu_Sua.Visibility = Visibility.Hidden;
                btnSua.Visibility     = Visibility.Visible;
                btnThem.IsEnabled     = btnXoa.IsEnabled = true;
                dtgDSPC.IsEnabled     = true;
                Selected = false;
            }
        }