コード例 #1
0
        void LuuPhim()
        {
            if (txbPMaPhim.Text == "")
            {
                return;
            }
            PhimDAO ttphim = new PhimDAO()
            {
                MaPhim        = txbPMaPhim.Text,
                TenPhim       = txbPTenPhim.Text,
                NuocSX        = cbPNuocSX.SelectedItem.ToString(),
                HangSX        = cbPHangSX.SelectedItem.ToString(),
                DaoDien       = txbPDaoDien.Text,
                TheLoai       = cbPTheLoai.SelectedItem.ToString(),
                NgayKhoiChieu = dtpPNgayBatDau.Value,
                NgayKetThuc   = dtpPNgayKetThuc.Value,
                NamDVChinh    = txbPNamChinh.Text,
                NuDVChinh     = txbPNuChinh.Text,
                NoiDungChinh  = rtxbNoiDungChinh.Text,
                TongChiPhi    = long.Parse(txbPTongChiPhi.Text)
            };

            if (phim.KiemTraPhim(ttphim.MaPhim))
            {
                bool kt = phim.SuaPhim(ttphim);
            }
            else
            {
                phim.ThemPhim(ttphim);
            }
            LoadDtgvPhim();
            MessageBox.Show("Lưu phim thành công!");
        }
コード例 #2
0
ファイル: frmPhim.cs プロジェクト: Hiissu/Phimwf
        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();
            }
        }
コード例 #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc muốn thêm?", "Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         try
         {
             string   tenPhim, theLoai, moTa;
             DateTime khoiChieu;
             tenPhim   = txtTenPhim.Text;
             theLoai   = txtTheLoai.Text;
             moTa      = txtTenPhim.Text + ".jpg";
             khoiChieu = timePickerKhoiChieu.Value.Date;
             if (phimBLL.ThemPhim(tenPhim, theLoai, khoiChieu, moTa))
             {
                 MessageBox.Show("Thêm thành công!");
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         QuanLyPhim_Load(sender, e);
     }
 }