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) { PhanXuong temp = Utils.DataGridViewRow_to_PhanXuong(DataGridView.Rows[vtIndex]); int kq = PhanXuongBiz.DeletePhanXuong(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 PhanXuong temp = new PhanXuong(); temp.MaPhanXuong = txtMa.Text; temp.TenPhanXuong = txtTen.Text; if (!CheckLoi(temp)) { return; } int kq = PhanXuongBiz.AddPhanXuong(temp); if (kq > 0) { MSG.ThemThanhCong(); } else { MSG.ThemThatBai(); } } else {//Sửa PhanXuong temp = new PhanXuong(); temp.MaPhanXuong = txtMa.Text; temp.TenPhanXuong = txtTen.Text; int kq = PhanXuongBiz.EditPhanXuong(temp); if (kq > 0) { MSG.SuaThanhCong(); } else { MSG.SuaThatBai(); } } this.Close(); }
private void HienThi() { Ldata = PhanXuongBiz.getListPhanXuong(); DataGridView.DataSource = Ldata.ToArray(); FixDataGirdView(); }
//------------------------------------------> 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; } }