public Form_QuanLyDanhMuc()
 {
     InitializeComponent();
     dmbll = new DanhMucBLL();
     dataGridView1.AutoGenerateColumns = false;
     formDN = new Form_QuanLy.Form_DangNhap();
 }
Exemple #2
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            #region Xóa
            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
            }
            // Vì khách hàng có thể làm mất đĩa nên vẫn có thể xóa được đĩa trong trạng thái thuê, đoạn code dưới dùng để kiểm tra đĩa còn ở của hàng ko.
            //else if(diabll.kiemTraDiaTaiCuaHang(tbThem_IdDia.Text) != true)
            //{
            //    XtraMessageBox.Show("Đĩa này đang được thuê bởi một khách hàng, không thể xóa !");
            //}
            else if (Form_Main.trangThaiLogin == true)
            {
                #region diglog
                DialogResult dg = new DialogResult();
                dg = XtraMessageBox.Show("Bạn có muốn xóa đĩa này không, thao tác này không thể hoàn tác !", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dg == DialogResult.Yes)
                {
                    try
                    {
                        eDia dia = new eDia();
                        dia.IdDia        = tbIdDia.Text;
                        dia.TrangThaiXoa = true;

                        if (diabll.XoaDia(dia))
                        {
                            XtraMessageBox.Show("Xóa đĩa thành công !");
                            dataGridViewD.DataSource = null;
                            LoadDataDia(dataGridViewTD.CurrentRow.Cells[0].Value.ToString());
                            tdbll.capnhatSoLuong(dataGridViewTD.CurrentRow.Cells[0].Value.ToString());
                            dataGridViewTD.DataSource = null;
                            dataGridViewTD.DataSource = tdbll.LayDanhSachTieuDeTheoTenDanhMuc(cbbPhanLoaiDanhMuc.SelectedValue.ToString());

                            XoaPanel();
                            panelQuanLyTD.Enabled = false;
                            btnLuu.Enabled        = false;
                            btnHuy.Enabled        = false;
                            btnThem.Enabled       = true;
                            KEY = 0;
                        }
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show("Lỗi: " + ex);
                    }
                }
                else
                {
                    dg = DialogResult.Cancel;
                }
                #endregion
            }
            #endregion
        }
 //Load Form
 private void Form_QuanLyKhachHang_Load(object sender, EventArgs e)
 {
     formDN = new Form_QuanLy.Form_DangNhap();
     loadData();
     LoadCell();
     btnSua.Enabled  = true;
     btnXoa.Enabled  = true;
     btnThem.Enabled = true;
 }
Exemple #4
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            #region Xóa
            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
            }
            else if (Form_Main.trangThaiLogin == true)
            {
                DialogResult dg = new DialogResult();
                dg = XtraMessageBox.Show("Bạn có muốn xóa khách hàng này không, thao tác này không thể hoàn tác !", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dg == DialogResult.Yes)
                {
                    try
                    {
                        eTieuDe kh = new eTieuDe();
                        kh.IdTieuDe     = tbIdTieuDe.Text;
                        kh.TrangThaiXoa = true;

                        if (tdbll.kiemtraSoLuongDiaConLai(tbIdTieuDe.Text))
                        {
                            XtraMessageBox.Show("Xóa không thành công vì còn tồn tại Đĩa với tiêu đề này !");
                        }
                        else
                        {
                            if (tdbll.XoaTieuDe(kh))
                            {
                                XtraMessageBox.Show("Xóa thành công !");
                                XoaPanel();
                                panelQuanLyTD.Enabled = false;
                                btnLuu.Enabled        = false;
                                btnHuy.Enabled        = false;
                                btnThem.Enabled       = true;
                                KEY = 0;
                                LoadData();
                                dataGridView1.Update();
                                dataGridView1.Refresh();
                                LoadCell();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show("Lỗi: " + ex);
                    }
                }
                else
                {
                    dg = DialogResult.Cancel;
                }
            }
            #endregion
        }
 private void btn_SuaSoNgayThue_Click(object sender, EventArgs e)
 {
     if (Form_Main.trangThaiLogin != true)
     {
         XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
         formDN = new Form_QuanLy.Form_DangNhap();
         formDN.ShowDialog();
     }
     else
     {
         KEY                    = 3;
         btnLuu.Enabled         = btn_Huy.Enabled = true;
         btn_SuaPhiThue.Enabled = btn_SuaPhiTreHan.Enabled = btn_SuaSoNgayThue.Enabled = false;
         tbSoNgayThue.Enabled   = true;
         tbSoNgayThue.Focus();
     }
 }
        private void btnXoaPhiTre_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(dataGridView2.CurrentRow.Cells[7].Value);

            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
            }
            else
            {
                if (ctptbll.XoaMotKhoanPhiTre(id))
                {
                    XtraMessageBox.Show("Đã xóa phí trễ THÀNH CÔNG");
                    if (khbll.TongPhiTreKhachHang(tbIdKH.Text) == 0)
                    {
                        dataGridView2.DataSource = null;
                        btnXacNhanIDKhach.Text   = "Xác Nhận";
                        checkBox1.Enabled        = false;
                        tbSoTienKhachTra.Enabled = false;
                        tbSoTienKhachTra.Text    = "";
                        tbIdKH.Focus();
                        btnXacNhanTraPhi.Enabled = false;
                        clearALLtextbox();
                        btnXoaPhiTre.Enabled = false;
                    }
                    else
                    {
                        dataGridView2.DataSource = null;
                        dataGridView2.DataSource = ctptbll.DanhSachPhiTretheoIDKhachHang(tbIdKH.Text);
                        loadCell();
                        checkBox1.Enabled        = true;
                        tbSoTienKhachTra.Enabled = true;
                        tbSoTienKhachTra.Text    = "";
                        tbSoTienKhachTra.Focus();
                        btnXacNhanTraPhi.Enabled = true;
                        tbTienNo.Text            = khbll.TongPhiTreKhachHang(tbIdKH.Text).ToString();
                    }
                }
                else
                {
                    XtraMessageBox.Show("Đã xóa phí trễ THẤT BẠI !");
                }
            }
        }
Exemple #7
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
            }
            else
            {
                KEY = 1;

                panelThemDia.Visible = true;

                //Code cũ
                //cbbThem_TenTieuDe.DataSource = (from a in db.TieuDes
                //                                where a.TrangThaiXoa == false
                //                                select a.TenTieuDe
                //);

                // Binding dữ liệu từ List danh mục vào combobox
                BindingSource binding = new BindingSource();
                binding.DataSource              = tdbll.LayDanhSachTenTieuDe();
                cbbThem_TenTieuDe.DataSource    = binding.DataSource;
                cbbThem_TenTieuDe.DisplayMember = "TenTieuDe";
                cbbThem_TenTieuDe.ValueMember   = "TenTieuDe";

                cbbThem_TenTieuDe.Text = dataGridViewTD.CurrentRow.Cells[1].Value.ToString().Trim();
                XoaPanel();
                tbThem_IdDia.Text    = NextID(diabll.LayMaDiaCaoNhat(), "CD");
                tbThem_IdDia.Enabled = tbThem_IdTieuDe.Enabled = false;


                btnThem.Enabled = false;
                btnLuu.Enabled  = true;
                btnHuy.Enabled  = true;
                //btnSua.Enabled = false;
                btnXoa.Enabled         = false;
                panelQuanLyTD.Enabled  = true;
                dataGridViewD.Enabled  = false;
                dataGridViewTD.Enabled = false;
            }
        }
Exemple #8
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
            }
            else if (Form_Main.trangThaiLogin == true)
            {
                KEY = 1;
                XoaPanel();
                tbIdTieuDe.Text = NextID(tdbll.LayMaTieuDeCaoNhat(), "TD");

                btnThem.Enabled       = false;
                btnLuu.Enabled        = true;
                btnHuy.Enabled        = true;
                btnXoa.Enabled        = false;
                panelQuanLyTD.Enabled = true;
                dataGridView1.Enabled = false;
            }
        }
        private void btn_SuaPhiThue_Click(object sender, EventArgs e)
        {
            DevExpress.XtraBars.Ribbon.RibbonPage rbPg = ((Form_Main)this.Owner).rbPage_QuanLy;
            rbPg.Visible = true;

            if (Form_Main.trangThaiLogin != true)
            {
                XtraMessageBox.Show("Vui lòng đăng nhập tài khoản quản lý để thực hiện chức năng này !");
                formDN = new Form_QuanLy.Form_DangNhap();
                formDN.ShowDialog();
                if (Form_Main.trangThaiLogin == true)
                {
                    ((Form_Main)MdiParent).kichHoatMenuQuanLy();



                    //foreach (DevExpress.XtraBars.Ribbon.RibbonPage rbp in this.MdiParent as MDIMaster)
                    //{
                    //    if (rbp is Form_QuanLyPhiTre)
                    //    {
                    //        rbp.Activate();
                    //        // do something
                    //        check = 1;
                    //        break;
                    //    }
                    //}
                    //this.IsMdiContainer.rbPage_QuanLy.Visible = true;
                }
            }
            else
            {
                KEY                      = 1;
                btnLuu.Enabled           = btn_Huy.Enabled = true;
                btn_SuaPhiTreHan.Enabled = btn_SuaSoNgayThue.Enabled = btn_SuaPhiThue.Enabled = false;
                tbPhiThue.Enabled        = true;
                tbPhiThue.Focus();
            }
        }
 private void Form_QuanLyPhiTre_Load(object sender, EventArgs e)
 {
     formDN = new Form_QuanLy.Form_DangNhap();
     tbIdKH.Focus();
 }