private void Xoa() { try { if (vtIndex != -1) //khi click lên tiêu đề header của datagrid thì bỏ qua { if (MSG.BanCoChacChanMuonXoaKhong() == System.Windows.Forms.DialogResult.Yes) { PhanNhomTaiSan temp = Utils.DataGridViewRow_to_PhanNhomTaiSan(DataGridView.Rows[vtIndex]); int kq = PhanNhomTaiSanBiz.DeletePhanNhomTaiSan(temp); //if (kq > 0) MSG.XoaThanhCong(); //else MSG.XoaThatBai(); if (kq <= 0) { MSG.XoaThatBai(); } HienThi(); } } } catch (Exception ex) { MSG.Error(ex); } }
private void btnDongY_Click(object sender, EventArgs e) { if (Them) {//Thêm PhanNhomTaiSan temp = new PhanNhomTaiSan(); temp.MaPhanNhomTaiSan = txtMa.Text; temp.TenPhanNhomTaiSan = txtTen.Text; temp.KieuPhanNhomTaiSan = txtKieuPhanNhomTS.Text; if (!CheckLoi(temp)) { return; } int kq = PhanNhomTaiSanBiz.AddPhanNhomTaiSan(temp); if (kq > 0) { MSG.ThemThanhCong(); } else { MSG.ThemThatBai(); } } else {//Sửa PhanNhomTaiSan temp = new PhanNhomTaiSan(); temp.MaPhanNhomTaiSan = txtMa.Text; temp.TenPhanNhomTaiSan = txtTen.Text; temp.KieuPhanNhomTaiSan = txtKieuPhanNhomTS.Text; if (!CheckLoi(temp)) { return; } int kq = PhanNhomTaiSanBiz.EditPhanNhomTaiSan(temp); if (kq > 0) { MSG.SuaThanhCong(); } else { MSG.SuaThatBai(); } } this.Close(); }
//------------------------------------------> private void HienThi() { switch (chose) { case CONFIG.ConstFrm.frmDMLoaiTaiSan: { Lloaitaisan = LoaiTaiSanBiz.getListLoaiTaiSan(); DataGridView.DataSource = Lloaitaisan.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMTaiSan: { Ltaisan = TaiSanBiz.getListTaiSan(); DataGridView.DataSource = Ltaisan.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMPhanNhomTaiSan: { Lphannhomtaisan = PhanNhomTaiSanBiz.getListPhanNhomTaiSan(); DataGridView.DataSource = Lphannhomtaisan.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMLyDoTangGiamTaiSan: { Llydotanggiamtaisan = LyDoTangGiamTaiSanBiz.getListLyDoTangGiamTaiSan(); DataGridView.DataSource = Llydotanggiamtaisan.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMBoPhanHachToan: { Lbophanhachtoan = BoPhanHachToanBiz.getListBoPhanHachToan(); DataGridView.DataSource = Lbophanhachtoan.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMPhanXuong: { Lphanxuong = PhanXuongBiz.getListPhanXuong(); DataGridView.DataSource = Lphanxuong.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMPhi: { Lphi = PhiBiz.getListPhi(); DataGridView.DataSource = Lphi.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMBoPhanSuDung: { Lbophansusung = BoPhanSuDungBiz.getListBoPhanSuDung(); DataGridView.DataSource = Lbophansusung.ToArray(); FixDataGirdView(); break; } case CONFIG.ConstFrm.frmDMNguonVon: { Lnguonvon = NguonVonBiz.getListNguonVon(); DataGridView.DataSource = Lnguonvon.ToArray(); FixDataGirdView(); break; } default: break; } }
private void HienThi() { Ldata = PhanNhomTaiSanBiz.getListPhanNhomTaiSan(); DataGridView.DataSource = Ldata.ToArray(); FixDataGirdView(); }