/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <bool> Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO thêm thông tin quá trình công tác var repo = new QuaTrinhCongTacRepository(_context); var result = await repo.Delete(QuaTrinhCongTacId); // goi lai ham execute cua tang dac // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public override async Task <IEnumerable <QuaTrinhCongTacDto> > Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NHAN_VIEN_ID; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // goi lai ham execute cua tang dac var result = await base.Execute(); // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <QuaTrinhCongTacDto> Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO thêm thông tin quá trình công tác var repo = new QuaTrinhCongTacRepository(_context); var entity = ToEntity(); entity = await repo.UpdatePartial(entity , nameof(TuNgay) , nameof(DenNgay) , nameof(ChucVuId) , nameof(CongViecChinh) , nameof(ThanhTuu) , nameof(Hinh) ); // TODO kiểm tra update thành công bằng CtrVersion if (entity.CtrVersion == CtrVersion) { throw new BaseException("Không thể lưu quá trình công tác"); } // TODO lấy thông tin sau khi update var quaTrinhCongTacBiz = new GetListQuaTrinhCongTacByCriteriaDac(_context); quaTrinhCongTacBiz.QUA_TRINH_CONG_TAC_ID = entity.QuaTrinhCongTacId; var listQuaTrinhCongTac = (await quaTrinhCongTacBiz.Execute()); var result = listQuaTrinhCongTac.FirstOrDefault(); // goi lai ham execute cua tang dac // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <Entity.MSSQL_QLDN_QLNS.Entity.QuanLyHopDong> Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO thêm thông tin quá trình công tác var _ctrVersion = CtrVersion; // lưu lại ctrVersion trước khi khi update để kiểm tra var repo = new QuanLyHopDongRepository(_context); var result = (await repo.UpdatePartial(this , nameof(TuNgay) , nameof(DenNgay) , nameof(HopDong) , nameof(HuongLuong) , nameof(Hinh) , nameof(Luong) , nameof(NgayKetThucSom) )); if (result.CtrVersion == _ctrVersion) { throw new BaseException("Không thể thêm hợp đồng cho nhân viên"); } // goi lai ham execute cua tang dac // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <Entity.MSSQL_QLDN_QLNS.Entity.LuongPhuCap> Execute() { Init(); Validate(); // TODO kiểm tra sự tồn tại của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO kiểm tra nhân viên có lương phụ cấp chưa var getByNhanVienIdDac = new GetLuongPhuCapByNhanVienIdDac(_context); getByNhanVienIdDac.NHAN_VIEN_ID = NhanVienId; var listLuongPhuCap = (await getByNhanVienIdDac.Execute()); if (listLuongPhuCap != null && listLuongPhuCap.Count() == 0) { throw new BaseException("Nhân viên này chưa có thông tin lương phụ cấp."); } // Cập nhật lương phụ cấp var repo = new LuongPhuCapRepository(_context); var result = await repo.UpdatePartial(this , nameof(LuongCoBan) , nameof(LuongChinhThuc) , nameof(HuongLuong) , nameof(ComTrua) , nameof(DienThoai) , nameof(TrachNhiem) , nameof(DongPhuc) , nameof(Khac) ); return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <QuaTrinhCongTacDto> Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO thêm thông tin quá trình công tác var repo = new QuaTrinhCongTacRepository(_context); var entity = ToEntity(); entity = (await repo.Insert(entity)); if (entity.QuaTrinhCongTacId == 0) { throw new BaseException("Không thể thêm quá trình công tác"); } var quaTrinhCongTacBiz = new GetListQuaTrinhCongTacByCriteriaDac(_context); quaTrinhCongTacBiz.QUA_TRINH_CONG_TAC_ID = entity.QuaTrinhCongTacId; var listQuaTrinhCongTac = (await quaTrinhCongTacBiz.Execute()); var result = listQuaTrinhCongTac.FirstOrDefault(); // goi lai ham execute cua tang dac // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <Entity.MSSQL_QLDN_QLNS.Entity.QuanLyHopDong> Execute() { Init(); Validate(); // to do: // biz se thuc hien viec abc o day truoc khi goi dac // TODO kiểm tra trạng thái của nhân viên var getNhanVienByIdDac = new GetThongTinNhanVienByIdDac(_context); getNhanVienByIdDac.NHAN_VIEN_ID = NhanVienId; var listNhanVien = (await getNhanVienByIdDac.Execute()).ToList(); if (listNhanVien != null && (listNhanVien.Count() == 0 || listNhanVien[0].XoaYN == "Y")) { throw new BaseException("Không tìm thấy thông tin nhân viên."); } // TODO thêm thông tin quá trình công tác var repo = new QuanLyHopDongRepository(_context); var result = (await repo.Insert(this)); if (result.QuanLyHopDongId == 0) { throw new BaseException("Không thể thêm hợp đồng cho nhân viên"); } // goi lai ham execute cua tang dac // to do: // biz se thuc hien viec abc voi result truoc khi return return(result); }