Пример #1
0
        public List <PhimDTO> LayDanhSach()
        {
            List <PhimDTO> listPhimDTO = new List <PhimDTO>();

            String    query = "SELECT * FROM Phim";
            DataTable dt    = DataProvider.ExecuteQuery(query);

            foreach (DataRow dr in dt.Rows)
            {
                PhimDTO phimDTO = new PhimDTO();
                phimDTO.MaPhim        = Convert.ToInt32(dr["MaPhim"]);
                phimDTO.Ten           = dr["Ten"].ToString();
                phimDTO.TheLoai       = dr["TheLoai"].ToString();
                phimDTO.DaoDien       = dr["DaoDien"].ToString();
                phimDTO.DienVien      = dr["DienVien"].ToString();
                phimDTO.GioiHanDoTuoi = Convert.ToInt32(dr["GioiHanDoTuoi"]);
                phimDTO.NoiDung       = dr["NoiDung"].ToString();
                phimDTO.NamSanXuat    = Convert.ToInt32(dr["NamSanXuat"]);
                phimDTO.Poster        = dr["Poster"].ToString();
                phimDTO.Trailer       = dr["Trailer"].ToString();

                listPhimDTO.Add(phimDTO);
            }

            return(listPhimDTO);
        }
Пример #2
0
        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();
        }
Пример #3
0
 public bool UpdatePhim(PhimDTO p)
 {
     try
     {
         using (QLRPContext context = new QLRPContext())
         {
             Phim pc = context.Phims.SingleOrDefault(px => px.MaPhim == p.MaPhim);
             if (pc != null)
             {
                 if (Utils.ValidateRowversion(pc.RowVersion, p.RowVersion))
                 {
                     pc.TenPhim       = p.TenPhim;
                     pc.TheLoai       = p.TheLoai;
                     pc.NgayKhoiChieu = p.NgayKhoiChieu;
                     pc.NgaySua       = DateTime.Now;
                     pc.NguoiSua      = CurrentUser.Username;
                     context.SaveChanges();
                     return(true);
                 }
                 throw new Exception("Có ai đó đã update đối tượng này trước đó. Danh sách sẽ được load lại.");
             }
             throw new Exception("Phim này đã bị xóa bởi ai đó. Danh sách sẽ được load lại.");
         }
     }
     catch (DbUpdateConcurrencyException)
     {
         throw new Exception("Hiện tại, có ai đó cũng đang update đối tượng này. Danh sách sẽ được load lại.");
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #4
0
        public List <PhimDTO> TimKiemTheoTheLoai(string theloai)
        {
            List <PhimDTO> listPhimDTO = new List <PhimDTO>();

            String    query = string.Format("SELECT * FROM Phim WHERE TheLoai LIKE N'{0}'", theloai);
            DataTable dt    = DataProvider.ExecuteQuery(query);

            foreach (DataRow dr in dt.Rows)
            {
                PhimDTO phimDTO = new PhimDTO();
                phimDTO.MaPhim        = Convert.ToInt32(dr["MaPhim"]);
                phimDTO.Ten           = dr["Ten"].ToString();
                phimDTO.TheLoai       = dr["TheLoai"].ToString();
                phimDTO.DaoDien       = dr["DaoDien"].ToString();
                phimDTO.DienVien      = dr["DienVien"].ToString();
                phimDTO.GioiHanDoTuoi = Convert.ToInt32(dr["GioiHanDoTuoi"]);
                phimDTO.NoiDung       = dr["NoiDung"].ToString();
                phimDTO.NamSanXuat    = Convert.ToInt32(dr["NamSanXuat"]);
                phimDTO.Poster        = dr["Poster"].ToString();
                phimDTO.Trailer       = dr["Trailer"].ToString();

                listPhimDTO.Add(phimDTO);
            }
            return(listPhimDTO);
        }
Пример #5
0
 public bool ThemPhim(PhimDTO p)
 {
     try
     {
         using (QLRPContext context = new QLRPContext())
         {
             context.Phims.Add(new Phim()
             {
                 MaPhim        = p.MaPhim,
                 MoTa          = p.MoTa,
                 NgayKhoiChieu = p.NgayKhoiChieu,
                 TenPhim       = p.TenPhim,
                 TheLoai       = p.TheLoai,
                 NgayTao       = DateTime.Now,
                 NguoiTao      = CurrentUser.Username,
                 NgaySua       = DateTime.Now,
                 NguoiSua      = CurrentUser.Username
             });
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #6
0
        public void ThemPhim(PhimDTO ph)
        {
            String insertSQL = @"INSERT INTO Phim VALUES " +
                               "(N'{0}', N'{1}', N'{2}', N'{3}', {4}, N'{5}', {6}, '{7}', '{8}')";

            String query = string.Format(insertSQL, ph.Ten, ph.TheLoai, ph.DaoDien, ph.DienVien, ph.GioiHanDoTuoi,
                                         ph.NoiDung, ph.NamSanXuat, ph.Poster, ph.Trailer);

            DataProvider.ExecuteQuery(query);
        }
Пример #7
0
        public void ThemPhim(PhimDTO obj)
        {
            string truyvan = $"INSERT INTO " +
                             $"[dbo].[Phim]([id], [ten], [theloai], [quocgia], [diemdanhgia]) " +
                             $"VALUES ('{obj.Id}', '{obj.Ten}', '{obj.Theloai}', '{obj.Quocgia}', '{obj.DiemDanhGia}')";

            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = truyvan;

            base.GhiDuLieu(cmd);
        }
Пример #8
0
        public void CapNhatTTPhim(PhimDTO obj, object idPhim)
        {
            string truyvan = $"UPDATE [dbo].[Phim] " +
                             $"SET [id] = '{obj.Id}', [ten] = '{obj.Ten}', [theloai] = '{obj.Theloai}', " +
                             $"[quocgia] = '{obj.Quocgia}', [diemdanhgia] = '{obj.DiemDanhGia}' " +
                             $"WHERE [id] = '{idPhim}'";

            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = truyvan;

            base.GhiDuLieu(cmd);
        }
Пример #9
0
        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();
            }
        }
Пример #10
0
        private void dtgDSPhim_MouseUp(object sender, MouseButtonEventArgs e)
        {
            int index = dtgDSPhim.SelectedIndex;

            if (index >= 0) // tránh lỗi click vẫn trong datagrid nhưng mà click chỗ k có dòng nào
            {
                Selected = true;
                PhimDTO nv = dtgDSPhim.SelectedItem as PhimDTO;
                txtMaPhim.Text    = nv.MaPhim;
                txtTenPhim.Text   = nv.TenPhim;
                txtDaoDien.Text   = nv.DaoDien;
                txtDienVien.Text  = nv.DienVien;
                txtNoiDung.Text   = nv.NoiDung;
                txtNamSX.Text     = nv.NamSX;
                txtNuocSX.Text    = nv.NuocSX;
                txtThoiLuong.Text = nv.ThoiLuong;
            }
        }
Пример #11
0
        public List <PhimDTO> LoadPhim()
        {
            SqlConnection  conn       = DataProvider.TaoKetNoi();
            string         strTruyVan = "Select * From Movie where TrangThai=1";
            SqlDataReader  sdr        = DataProvider.TruyVanDuLieu(strTruyVan, conn);
            List <PhimDTO> ls         = new List <PhimDTO>();

            while (sdr.Read())
            {
                PhimDTO ketqua = new PhimDTO();
                ketqua.MaPhim  = int.Parse(sdr["MaPhim"].ToString());
                ketqua.TenPhim = sdr["TenPhim"].ToString();
                ls.Add(ketqua);
            }
            sdr.Close();
            conn.Close();
            return(ls);
        }
Пример #12
0
 public bool ThemPhim(string ten, string theloai, DateTime khoichieu, string mota)
 {
     try
     {
         PhimDTO p = new PhimDTO()
         {
             TenPhim = ten, TheLoai = theloai, NgayKhoiChieu = khoichieu, MoTa = mota
         };
         if (phimDAL.ThemPhim(p))
         {
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #13
0
        private void btnThemPhim_Click(object sender, EventArgs e)
        {
            PhimDTO p = new PhimDTO();

            if (tbIdPhim.Text.Length != 0)
            {
                try
                {
                    p.Id          = tbIdPhim.Text;
                    p.Ten         = tbTenPhim.Text;
                    p.Theloai     = cbTheLoai.Text;
                    p.Quocgia     = cbQuocGia.Text;
                    p.DiemDanhGia = Convert.ToDouble(tbDiemDanhGia.Text);

                    obj.ThemPhim(p);
                    MessageBox.Show("Thêm phim thành công.");
                    XoaDuLieuDaNhap();

                    grvPhim.DataSource = obj.HienThiTatCaPhim();
                }
                catch (Exception)
                {
                    MessageBox.Show("Dữ liệu đã tồn tại hoặc không hợp lệ.");
                    return;

                    throw;
                }
            }
            else
            {
                p.Id          = tbIdPhim.Text;
                p.Ten         = tbTenPhim.Text;
                p.Theloai     = cbTheLoai.Text;
                p.Quocgia     = cbQuocGia.Text;
                p.DiemDanhGia = Convert.ToDouble(tbDiemDanhGia.Text);

                obj.ThemPhim(p);
                MessageBox.Show("Thêm phim thành công.");

                grvPhim.DataSource = obj.HienThiTatCaPhim();
                XoaDuLieuDaNhap();
            }
        }
Пример #14
0
 public bool UpdatePhim(int ma, string ten, string theloai, DateTime khoichieu, string rowVersion)
 {
     try
     {
         PhimDTO p = new PhimDTO()
         {
             MaPhim        = ma, TenPhim = ten, TheLoai = theloai,
             NgayKhoiChieu = khoichieu,
             RowVersion    = rowVersion
         };
         if (phimDAL.UpdatePhim(p))
         {
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #15
0
        public static void Them(PhimDTO phim)
        {
            // mở kết nối
            SqlConnection connection = SQLConnectionData.HamKetNoi();

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO PHIM VALUES(@MAPHIM,@TENPHIM,@DAODIEN,@DIENVIEN,@MALP,@NOIDUNG,@NAMSX,@NUOCSX,@THOILUONG)";
            command.CommandText = "EXEC Themphim @MAPHIM,@TENPHIM,@DAODIEN,@DIENVIEN,@NOIDUNG,@NAMSX,@NUOCSX,@THOILUONG";
            command.Parameters.Add("@MAPHIM", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENPHIM", SqlDbType.NVarChar, 40);
            command.Parameters.Add("@DAODIEN", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@DIENVIEN", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@NOIDUNG", SqlDbType.NVarChar, 1000);
            command.Parameters.Add("@NAMSX", SqlDbType.VarChar, 10);
            command.Parameters.Add("@NUOCSX", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@THOILUONG", SqlDbType.NVarChar, 100);


            // gán giá trị
            command.Parameters["@MAPHIM"].Value    = phim.MaPhim;
            command.Parameters["@TENPHIM"].Value   = phim.TenPhim;
            command.Parameters["@DAODIEN"].Value   = phim.DaoDien;
            command.Parameters["@DIENVIEN"].Value  = phim.DienVien;
            command.Parameters["@NOIDUNG"].Value   = phim.NoiDung;
            command.Parameters["@NAMSX"].Value     = phim.NamSX;
            command.Parameters["@NUOCSX"].Value    = phim.NuocSX;
            command.Parameters["@THOILUONG"].Value = phim.ThoiLuong;
            command.Parameters["@DAODIEN"].Value   = phim.DaoDien;


            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Пример #16
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Đ";
        }
Пример #17
0
        private void btSuaTTPhim_Click(object sender, EventArgs e)
        {
            if (tbIdPhim.Text != null)
            {
                PhimDTO p = new PhimDTO();
                p.Id          = tbIdPhim.Text;
                p.Ten         = tbTenPhim.Text;
                p.Theloai     = cbTheLoai.Text;
                p.Quocgia     = cbQuocGia.Text;
                p.DiemDanhGia = Convert.ToDouble(tbDiemDanhGia.Text);

                obj.CapNhatTTPhim(p, p.Id);
                MessageBox.Show("Cập nhật thành công.");

                grvPhim.DataSource = obj.HienThiTatCaPhim();
                XoaDuLieuDaNhap();
            }
            else
            {
                MessageBox.Show("Hãy chọn phim cần cập nhật.");
            }
        }
Пример #18
0
        public List <PhimDTO> LoadPhim(int MaLich)
        {
            SqlConnection conn       = DataProvider.TaoKetNoi();
            string        strTruyVan = "Select * From Movie, ChiTietLichChieu, PhongChieu, CTLoaiPhong where Movie.MaPhim = ChiTietLichChieu.MaPhim AND ChiTietLichChieu.MaPhong = PhongChieu.MaPhong AND PhongChieu.LoaiPhong = CTLoaiPhong.MaLoai AND ChiTietLichChieu.MaLich = @MaLich AND Movie.TrangThai=1";

            SqlParameter[] par = new SqlParameter[1];
            par[0] = new SqlParameter("@MaLich", MaLich);
            SqlDataReader  sdr = DataProvider.TruyVanDuLieu(strTruyVan, par, conn);
            List <PhimDTO> ls  = new List <PhimDTO>();

            while (sdr.Read())
            {
                PhimDTO ketqua = new PhimDTO();
                ketqua.MaPhim  = int.Parse(sdr["MaPhim"].ToString());
                ketqua.Mac     = sdr["Mac"].ToString();
                ketqua.NDPhim  = sdr["NDPhim"].ToString();
                ketqua.TenPhim = sdr["TenPhim"].ToString();
                ls.Add(ketqua);
            }
            sdr.Close();
            conn.Close();
            return(ls);
        }
Пример #19
0
        public void Sua(PhimDTO phim)
        {
            // mở kết nối

            connection.Open();

            // tạo câu lệnh Thêm
            SqlCommand command = connection.CreateCommand();

            command.CommandType = CommandType.Text;
            //command.CommandText = "INSERT INTO NHANVIEN VALUES(@MANV,@HOTEN,@CHUCVU,@SDT,@GIOITINH,@NGAYSINH,@DIACHI,@LUONG,@NGAYVL)";
            command.CommandText = "EXEC Suaphim @MAPHIM,@TENPHIM,@DAODIEN,@DIENVIEN,@NOIDUNG,@NAMSX,@NUOCSX,@THOILUONG";
            command.Parameters.Add("@MAPHIM", SqlDbType.VarChar, 10);
            command.Parameters.Add("@TENPHIM", SqlDbType.NVarChar, 40);
            command.Parameters.Add("@DAODIEN", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@DIENVIEN", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@NOIDUNG", SqlDbType.NVarChar, 1000);
            command.Parameters.Add("@NAMSX", SqlDbType.VarChar, 10);
            command.Parameters.Add("@NUOCSX", SqlDbType.NVarChar, 100);
            command.Parameters.Add("@THOILUONG", SqlDbType.NVarChar, 100);


            // gán giá trị
            command.Parameters["@MAPHIM"].Value    = phim.MaPhim;
            command.Parameters["@TENPHIM"].Value   = phim.TenPhim;
            command.Parameters["@DAODIEN"].Value   = phim.DaoDien;
            command.Parameters["@DIENVIEN"].Value  = phim.DienVien;
            command.Parameters["@NOIDUNG"].Value   = phim.NoiDung;
            command.Parameters["@NAMSX"].Value     = phim.NamSX;
            command.Parameters["@NUOCSX"].Value    = phim.NuocSX;
            command.Parameters["@THOILUONG"].Value = phim.ThoiLuong;
            command.Parameters["@DAODIEN"].Value   = phim.DaoDien;
            command.ExecuteNonQuery();

            // đóng kết nối
            connection.Close();
        }
Пример #20
0
        public PhimDTO LayThongTin(int id)
        {
            PhimDTO phimDTO = null;

            String    query = string.Format("SELECT * FROM Phim WHERE MaPhim = {0}", id);
            DataTable dt    = DataProvider.ExecuteQuery(query);

            if (dt.Rows.Count > 0)
            {
                phimDTO               = new PhimDTO();
                phimDTO.MaPhim        = Convert.ToInt32(dt.Rows[0]["MaPhim"]);
                phimDTO.Ten           = dt.Rows[0]["Ten"].ToString();
                phimDTO.TheLoai       = dt.Rows[0]["TheLoai"].ToString();
                phimDTO.DaoDien       = dt.Rows[0]["DaoDien"].ToString();
                phimDTO.DienVien      = dt.Rows[0]["DienVien"].ToString();
                phimDTO.GioiHanDoTuoi = Convert.ToInt32(dt.Rows[0]["GioiHanDoTuoi"]);
                phimDTO.NoiDung       = dt.Rows[0]["NoiDung"].ToString();
                phimDTO.NamSanXuat    = Convert.ToInt32(dt.Rows[0]["NamSanXuat"]);
                phimDTO.Poster        = dt.Rows[0]["Poster"].ToString();
                phimDTO.Trailer       = dt.Rows[0]["Trailer"].ToString();
            }

            return(phimDTO);
        }
Пример #21
0
 public static void Them(PhimDTO p)
 {
     PhimDAO.Them(p);
 }
Пример #22
0
 public void ThemPhim(PhimDTO ph)
 {
     phimDAO.ThemPhim(ph);
 }
Пример #23
0
 public void ThemPhim(PhimDTO obj)
 {
     obj_phim.ThemPhim(obj);
 }
Пример #24
0
        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;
            }
        }
Пример #25
0
 public void CapNhatTTPhim(PhimDTO obj, object idPhim)
 {
     obj_phim.CapNhatTTPhim(obj, idPhim);
 }
Пример #26
0
 public static void Sua(PhimDTO p)
 {
     PhimDAO.Sua(p);
 }
Пример #27
0
        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();
            }
        }
Пример #28
0
 public void AddThanhVien([FromBody] PhimDTO phim)
 {
     bus.Them(phim);
 }
Пример #29
0
 public void UpdateThanhVien([FromBody] PhimDTO phim)
 {
     bus.Sua(phim);
 }