コード例 #1
0
 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)
             {
                 DieuChinhGiaTriTaiSan temp = Utils.DataGridViewRow_to_DieuChinhGiaTriTaiSan(DataGridView.Rows[vtIndex]);
                 int kq = DieuChinhGiaTriTaiSanBiz.DeleteDieuChinhGiaTriTaiSan(temp);
                 //if (kq > 0) MSG.XoaThanhCong();
                 //else MSG.XoaThatBai();
                 if (kq <= 0)
                 {
                     MSG.XoaThatBai();
                 }
                 HienThi();
             }
         }
     }
     catch (Exception ex)
     {
         MSG.Error(ex);
     }
 }
コード例 #2
0
 private void HienThi()
 {
     Ldata = DieuChinhGiaTriTaiSanBiz.getListDieuChinhGiaTriTaiSan();
     DataGridView.DataSource = Ldata.ToArray();
     FixDataGirdView();
 }
コード例 #3
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            try
            {
                DieuChinhGiaTriTaiSan temp = new DieuChinhGiaTriTaiSan();
                temp.MaLyDoTangGiamTaiSan = txtMaLyDoTangGiamTaiSan.Text;
                List <LyDoTangGiamTaiSan> L = LyDoTangGiamTaiSanBiz.getListLyDoTangGiamTaiSan(temp.MaLyDoTangGiamTaiSan);
                temp.Loai             = (L.Count > 0) ? L[0].LoaiTangGiamTaiSan : true; //mặc định tăng
                temp.MaTaiSan         = txtMaTaiSan.Text;
                temp.Nam              = txtNam.Text;
                temp.Ky               = txtKy.Text;
                temp.NgayChungTu      = DateTime.Parse(txtNgayChungTu.Text);
                temp.SoChungTu        = txtSoChungTu.Text;
                temp.MaNguonVon       = txtMaNguonVon.Text;
                temp.NguyenGia        = double.Parse(txtNguyenGia.Text);
                temp.GiaTriDaKhauHao  = double.Parse(txtGiaTriDaKhauHao.Text);
                temp.GiaTriConLai     = double.Parse(txtGiaTriConLai.Text);
                temp.GiaTriKhauHao1Ky = double.Parse(txtGiaTriKhauHao1Ky.Text);
                temp.DienGiai         = txtDienGiai.Text;

                bool ThatBai = false;
                if (Them)
                {//Thêm
                    if (!CheckLoi(temp))
                    {
                        return;
                    }

                    int kq = DieuChinhGiaTriTaiSanBiz.AddDieuChinhGiaTriTaiSan(temp);
                    if (kq > 0)
                    {
                        MSG.ThemThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.ThemThatBai();
                    }
                }
                else
                {//Sửa
                    temp.DieuChinhGiaTriTaiSanID = idDieuChinhGiaTriTaiSan;
                    int kq = DieuChinhGiaTriTaiSanBiz.EditDieuChinhGiaTriTaiSan(temp);
                    if (kq > 0)
                    {
                        MSG.SuaThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.SuaThatBai();
                    }
                }
                if (ThatBai && MSG.MESSAGE("Bạn có muốn sửa lại dữ liệu không?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    return;
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MSG.Error(ex);
            }
        }