private void btnDongY_Click(object sender, EventArgs e)
        {
            try
            {
                DieuChuyenBoPhanSuDung temp = new DieuChuyenBoPhanSuDung();
                temp.DieuChuyenBoPhanSuDungID = idDieuChuyenBoPhanSuDung;
                temp.MaTaiSan       = txtMaTaiSan.Text;
                temp.Nam            = txtNam.Text;
                temp.Ky             = txtKy.Text;
                temp.MaBoPhanSuDung = txtBoPhanSuDung.Text;
                temp.TKTaiSan       = txtTKTaiSan.Text;
                temp.TKKhauHao      = txtTKKhauHao.Text;
                temp.TKChiPhi       = txtTKChiPhi.Text;

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

                    int kq = DieuChuyenBoPhanSuDungBiz.AddDieuChuyenBoPhanSuDung(temp);
                    if (kq > 0)
                    {
                        MSG.ThemThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.ThemThatBai();
                    }
                }
                else
                {//Sửa
                    temp.DieuChuyenBoPhanSuDungID = idDieuChuyenBoPhanSuDung;
                    int kq = DieuChuyenBoPhanSuDungBiz.EditDieuChuyenBoPhanSuDung(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);
            }
        }
Exemple #2
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            try
            {
                GiamTaiSanCoDinh temp = new GiamTaiSanCoDinh();
                temp.GiamTaiSanCoDinhID   = idGiamTaiSanCoDinh;
                temp.MaTaiSan             = txtMaTaiSan.Text;
                temp.MaLyDoTangGiamTaiSan = txtLyDoTangGiamTaiSan.Text;
                temp.NgayGiam             = DateTime.Parse(txtNgayGiamTaiSan.Text);
                temp.NgayKetThucKhauHao   = DateTime.Parse(txtNgayKetThucKhauHao.Text);
                temp.SoChungTu            = txtSoChungTu.Text;
                temp.LyDo = txtLyDo.Text;

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

                    int kq = GiamTaiSanCoDinhBiz.AddGiamTaiSanCoDinh(temp);
                    if (kq > 0)
                    {
                        MSG.ThemThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.ThemThatBai();
                    }
                }
                else
                {//Sửa
                    temp.GiamTaiSanCoDinhID = idGiamTaiSanCoDinh;
                    int kq = GiamTaiSanCoDinhBiz.EditGiamTaiSanCoDinh(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);
            }
        }
Exemple #3
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            try
            {
                ThoiKhauHaoTaiSan temp = new ThoiKhauHaoTaiSan();
                temp.ThoiKhauHaoTaiSanID = idThoiKhauHaoTaiSan;
                temp.MaTaiSan            = txtMaTaiSan.Text;
                temp.NgayThoiKhauHao     = DateTime.Parse(txtNgayThoiKhauHao.Text);

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

                    int kq = ThoiKhauHaoTaiSanBiz.AddThoiKhauHaoTaiSan(temp);
                    if (kq > 0)
                    {
                        MSG.ThemThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.ThemThatBai();
                    }
                }
                else
                {//Sửa
                    temp.ThoiKhauHaoTaiSanID = idThoiKhauHaoTaiSan;
                    int kq = ThoiKhauHaoTaiSanBiz.EditThoiKhauHaoTaiSan(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);
            }
        }
Exemple #4
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                LyDoTangGiamTaiSan temp = new LyDoTangGiamTaiSan();
                temp.LoaiTangGiamTaiSan     = cbbLoaiTangGiamTaiSan.SelectedIndex == 0 ? true : false;
                temp.LoaiTangGiamTaiSanVIEW = temp.LoaiTangGiamTaiSan ? "1" : "2";
                temp.MaLyDoTangGiamTaiSan   = txtMa.Text;
                temp.TenLyDoTangGiamTaiSan  = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = LyDoTangGiamTaiSanBiz.AddLyDoTangGiamTaiSan(temp);
                if (kq > 0)
                {
                    MSG.ThemThanhCong();
                }
                else
                {
                    MSG.ThemThatBai();
                }
            }
            else
            {//Sửa
                LyDoTangGiamTaiSan temp = new LyDoTangGiamTaiSan();
                temp.LoaiTangGiamTaiSan     = cbbLoaiTangGiamTaiSan.SelectedIndex == 0 ? true : false;
                temp.LoaiTangGiamTaiSanVIEW = temp.LoaiTangGiamTaiSan ? "1" : "2";
                temp.MaLyDoTangGiamTaiSan   = txtMa.Text;
                temp.TenLyDoTangGiamTaiSan  = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = LyDoTangGiamTaiSanBiz.EditLyDoTangGiamTaiSan(temp);
                if (kq > 0)
                {
                    MSG.SuaThanhCong();
                }
                else
                {
                    MSG.SuaThatBai();
                }
            }
            this.Close();
        }
Exemple #5
0
        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();
        }
Exemple #6
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                LoaiTaiSan temp = new LoaiTaiSan();
                temp.MaLoaiTaiSan  = txtMa.Text;
                temp.TenLoaiTaiSan = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = LoaiTaiSanBiz.AddLoaiTaiSan(temp);
                if (kq > 0)
                {
                    MSG.ThemThanhCong();
                }
                else
                {
                    MSG.ThemThatBai();
                }
            }
            else
            {//Sửa
                LoaiTaiSan temp = new LoaiTaiSan();
                temp.MaLoaiTaiSan  = txtMa.Text;
                temp.TenLoaiTaiSan = txtTen.Text;
                int kq = LoaiTaiSanBiz.EditLoaiTaiSan(temp);
                if (kq > 0)
                {
                    MSG.SuaThanhCong();
                }
                else
                {
                    MSG.SuaThatBai();
                }
            }
            this.Close();
        }
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                BoPhanSuDung temp = new BoPhanSuDung();
                temp.MaBoPhanSuDung  = txtMa.Text;
                temp.TenBoPhanSuDung = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = BoPhanSuDungBiz.AddBoPhanSuDung(temp);
                if (kq > 0)
                {
                    MSG.ThemThanhCong();
                }
                else
                {
                    MSG.ThemThatBai();
                }
            }
            else
            {//Sửa
                BoPhanSuDung temp = new BoPhanSuDung();
                temp.MaBoPhanSuDung  = txtMa.Text;
                temp.TenBoPhanSuDung = txtTen.Text;
                int kq = BoPhanSuDungBiz.EditBoPhanSuDung(temp);
                if (kq > 0)
                {
                    MSG.SuaThanhCong();
                }
                else
                {
                    MSG.SuaThatBai();
                }
            }
            this.Close();
        }
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                ThietBi temp = new ThietBi();
                temp.MaThietBi  = txtMa.Text;
                temp.TenThietBi = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = ThietBiBiz.AddThietBi(temp);
                if (kq > 0)
                {
                    MSG.ThemThanhCong();
                }
                else
                {
                    MSG.ThemThatBai();
                }
            }
            else
            {//Sửa
                ThietBi temp = new ThietBi();
                temp.MaThietBi  = txtMa.Text;
                temp.TenThietBi = txtTen.Text;
                int kq = ThietBiBiz.EditThietBi(temp);
                if (kq > 0)
                {
                    MSG.SuaThanhCong();
                }
                else
                {
                    MSG.SuaThatBai();
                }
            }
            this.Close();
        }
Exemple #9
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                NguonVon temp = new NguonVon();
                temp.MaNguonVon  = txtMa.Text;
                temp.TenNguonVon = txtTen.Text;

                if (!CheckLoi(temp))
                {
                    return;
                }

                int kq = NguonVonBiz.AddNguonVon(temp);
                if (kq > 0)
                {
                    MSG.ThemThanhCong();
                }
                else
                {
                    MSG.ThemThatBai();
                }
            }
            else
            {//Sửa
                NguonVon temp = new NguonVon();
                temp.MaNguonVon  = txtMa.Text;
                temp.TenNguonVon = txtTen.Text;
                int kq = NguonVonBiz.EditNguonVon(temp);
                if (kq > 0)
                {
                    MSG.SuaThanhCong();
                }
                else
                {
                    MSG.SuaThatBai();
                }
            }
            this.Close();
        }
Exemple #10
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);
            }
        }
Exemple #11
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            try
            {
                TaiSan temp = new TaiSan();
                temp.MaTaiSan             = txtMaTaiSan.Text;
                temp.TenTaiSan            = txtTenTaiSan.Text;
                temp.MaLoaiTaiSan         = txtNhomTaiSan.Text;
                temp.MaLyDoTangGiamTaiSan = txtLyDoTang.Text;
                temp.NgayTangTaiSan       = !string.IsNullOrEmpty(txtNgayTangTaiSan.Text) ? DateTime.Parse(txtNgayTangTaiSan.Text) : new DateTime(1753, 1, 1);
                temp.NgayTinhKhauHao      = !string.IsNullOrEmpty(txtNgayTinhKhauHao.Text) ? DateTime.Parse(txtNgayTinhKhauHao.Text) : new DateTime(1753, 1, 1);
                temp.SoKyKhauHao          = txtSoKyKhauHao.Text;
                temp.MaBoPhanHachToan     = txtBoPhanHachToan.Text;
                temp.MaPhanXuong          = txtMaPhanXuong.Text;
                temp.MaPhi          = txtMaPhi.Text;
                temp.MaBoPhanSuDung = txtBoPhanSuDung.Text;
                temp.TKTaiSan       = txtTKTaiSan.Text;
                temp.TKKhauHao      = txtTKKhauHao.Text;
                temp.TKChiPhi       = txtTKChiPhi.Text;
                temp.PhanNhom1      = txtPhanNhom1.Text;
                temp.PhanNhom2      = txtPhanNhom2.Text;
                temp.PhanNhom3      = txtPhanNhom3.Text;

                temp.TenKhac           = txtTenKhac.Text;
                temp.SoHieuTaiSan      = txtSoHieuTaiSan.Text;
                temp.ThongSoKyThuat    = txtThongSoKyThuat.Text;
                temp.NuocSanXuat       = txtNuocSanXuat.Text;
                temp.NamSanXuat        = txtNamSanXuat.Text;
                temp.NgayDuaVaoSuDung  = !string.IsNullOrEmpty(txtNgayDuaVaoSuDung.Text) ? DateTime.Parse(txtNgayDuaVaoSuDung.Text) : new DateTime(1753, 1, 1);
                temp.NgayDinhChiSuDung = !string.IsNullOrEmpty(txtNgayDinhChiSuDung.Text) ? DateTime.Parse(txtNgayDinhChiSuDung.Text) : new DateTime(1753, 1, 1);
                temp.LyDoDinhChi       = txtLyDoDinhChi.Text;
                temp.GhiChu            = txtGhiChu.Text;

                temp.Lchitiettaisan.AddRange(LChiTietTaiSan);
                temp.Lphutungkemtheo.AddRange(LPhuTungKemTheo);

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

                    int kq = TaiSanBiz.AddTaiSan(temp);
                    if (kq > 0)
                    {
                        MSG.ThemThanhCong();
                    }
                    else
                    {
                        ThatBai = true;
                        MSG.ThemThatBai();
                    }
                }
                else
                {//Sửa
                    int kq = TaiSanBiz.EditTaiSan(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);
            }
        }