private void DataGridViewCTPhuTungKemTheo_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { int vtIndex = e.RowIndex; if (vtIndex != -1) //khi click lên tiêu đề header của datagrid thì bỏ qua { if (isEditChiTietPhuTung) { MSG.MESSAGE("Bạn đang sửa Phụ tùng!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } txtMaPhuTungKemTheo.Text = LPhuTungKemTheo[vtIndex].MaPhuTungKemTheo; txtTenPhuTungKemTheo.Text = LPhuTungKemTheo[vtIndex].TenPhuTungKemTheo; txtDonViTinh.Text = LPhuTungKemTheo[vtIndex].DVT; txtSoLuong.Text = LPhuTungKemTheo[vtIndex].SoLuong.ToString(); txtGiaTri.Text = LPhuTungKemTheo[vtIndex].GiaTri.ToString(); txtGhiChuPhuTungKemTheo.Text = LPhuTungKemTheo[vtIndex].GhiChu.ToString(); LPhuTungKemTheo.RemoveAt(vtIndex); DataGridViewCTPhuTungKemTheo.DataSource = LPhuTungKemTheo.ToArray(); FixDataGirdView(DataGridViewCTPhuTungKemTheo, true); isEditChiTietPhuTung = true; } } catch (Exception ex) { MSG.Error(ex); } }
private void DataGridViewCTNguonVon_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { int vtIndex = e.RowIndex; if (vtIndex != -1) //khi click lên tiêu đề header của datagrid thì bỏ qua { if (isEditChiTietTaiSan) { MSG.MESSAGE("Bạn đang sửa Nguồn vốn!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } txtNguonVon.Text = LChiTietTaiSan[vtIndex].MaNguonVon; txtNgayChungTu.Text = LChiTietTaiSan[vtIndex].NgayChungTu.ToString("dd/MM/yyyy"); txtSoChungTu.Text = LChiTietTaiSan[vtIndex].SoChungTu; txtNguyenGia.Text = LChiTietTaiSan[vtIndex].NguyenGia.ToString(); txtGiaTriDaKhauHao.Text = LChiTietTaiSan[vtIndex].GiaTriDaKhauHao.ToString(); txtGiaTriConLai.Text = LChiTietTaiSan[vtIndex].GiaTriConLai.ToString(); txtGiaTriKhauHao1Ky.Text = LChiTietTaiSan[vtIndex].GiaTriKhauHao1Ky.ToString(); txtDienGiai.Text = LChiTietTaiSan[vtIndex].DienGiai; LChiTietTaiSan.RemoveAt(vtIndex); DataGridViewCTNguonVon.DataSource = LChiTietTaiSan.ToArray(); FixDataGirdView(DataGridViewCTNguonVon, false); isEditChiTietTaiSan = true; } } catch (Exception ex) { MSG.Error(ex); } }
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); } }
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); } }
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); } }
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); } }
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); } }