public async Task <int> KyVaChuyenVanThu(LanhDaoXuLy37Input input) { try { var hoso = await _hoSoRepos.GetAsync(input.HoSoId); var hoSoXuLy = await _hoSoXuLyRepos.GetAsync(input.HoSoXuLyId); if (hoSoXuLy != null) { #region Lưu lịch sử var _history = new XHoSoXuLyHistory(); _history.HoSoXuLyId = hoSoXuLy.Id; _history.ThuTucId = hoSoXuLy.ThuTucId; _history.HoSoId = hoSoXuLy.HoSoId; _history.IsHoSoBS = hoSoXuLy.IsHoSoBS; _history.DonViXuLy = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC; _history.NguoiXuLyId = _session.UserId; _history.HoSoIsDat_Pre = hoSoXuLy.HoSoIsDat; _history.HoSoIsDat = hoSoXuLy.HoSoIsDat; _history.TrangThaiCV = input.TrangThaiCV; _history.NoiDungCV = null; _history.NgayXuLy = DateTime.Now; _history.NoiDungYKien = input.NoiDungYKien; _history.ActionEnum = (int)CommonENum.FORM_FUNCTION.LANH_DAO_CUC_DUYET; _history.DonViKeTiep = input.DonViKeTiep; await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history); #endregion hoSoXuLy.DonViXuLy = (int)CommonENum.DON_VI_XU_LY.VAN_THU; hoSoXuLy.DonViGui = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC; hoSoXuLy.NguoiGuiId = _session.UserId; hoSoXuLy.NguoiXuLyId = null; hoSoXuLy.LanhDaoCucDaDuyet = true; if (!string.IsNullOrEmpty(input.DuongDanTepCA)) { hoSoXuLy.LanhDaoCucIsCA = true; hoSoXuLy.LanhDaoCucNgayKy = DateTime.Now; hoSoXuLy.DuongDanTepCA = input.DuongDanTepCA; } hoSoXuLy.LyDoTraLai = _history.NoiDungYKien; await _hoSoXuLyRepos.UpdateAsync(hoSoXuLy); //hoso.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.LANH_DAO_DA_DUYET_THAM_XET; //await _hoSoRepos.UpdateAsync(hoso); } return(1); } catch (Exception ex) { Logger.Fatal(ex.Message); return(0); } }
public async Task <int> ChuyenLaiTruongPhongThamDinhLai(LanhDaoXuLy37Input input) { try { var hoso = await _hoSoRepos.GetAsync(input.HoSoId); var hoSoXuLy = await _hoSoXuLyRepos.FirstOrDefaultAsync(x => x.Id == input.HoSoXuLyId); if (hoSoXuLy != null) { #region Lưu lịch sử var _history = new XHoSoXuLyHistory(); _history.HoSoXuLyId = hoSoXuLy.Id; _history.ThuTucId = hoSoXuLy.ThuTucId; _history.HoSoId = hoSoXuLy.HoSoId; _history.IsHoSoBS = hoSoXuLy.IsHoSoBS; _history.DonViXuLy = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC; _history.DonViKeTiep = input.DonViKeTiep; _history.NguoiXuLyId = _session.UserId; _history.HoSoIsDat_Pre = hoSoXuLy.HoSoIsDat; _history.HoSoIsDat = input.HoSoIsDat; _history.TrangThaiCV = input.TrangThaiCV; _history.NoiDungCV = null; _history.NgayXuLy = DateTime.Now; _history.NoiDungYKien = input.NoiDungYKien; _history.ActionEnum = (int)CommonENum.FORM_FUNCTION.LANH_DAO_CUC_DUYET_THAM_DINH; await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history); #endregion hoSoXuLy.DonViXuLy = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG; hoSoXuLy.DonViGui = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC; hoSoXuLy.NguoiGuiId = _session.UserId; hoSoXuLy.LyDoTraLai = input.NoiDungYKien; hoSoXuLy.NguoiXuLyId = hoSoXuLy.TruongPhongId; hoSoXuLy.LanhDaoCucDaDuyet = null; hoso.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.HO_SO_THAM_DINH_LAI; await _hoSoRepos.UpdateAsync(hoso); await _hoSoXuLyRepos.UpdateAsync(hoSoXuLy); } return(1); } catch (Exception ex) { Logger.Fatal(ex.Message); return(0); } }
public async Task <dynamic> LoadLanhDaoCucDuyet(LanhDaoXuLy37Input input) { try { var hosoxl = await _hoSoXuLyRepos.GetAsync(input.HoSoXuLyId); if (hosoxl != null && hosoxl.Id > 0) { var _yKienTruongPhong = (from yk in _hoSoXuLyHistoryRepos.GetAll() join r_us in _userRepos.GetAll() on yk.NguoiXuLyId equals r_us.Id into tb_us //Left Join from us in tb_us.DefaultIfEmpty() where yk.HoSoXuLyId == hosoxl.Id && (yk.DonViXuLy == (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG || yk.DonViXuLy == (int)CommonENum.DON_VI_XU_LY.PHO_PHONG) orderby yk.Id descending select new { yk.DonViXuLy, yk.NoiDungYKien, TenTruongPhong = us.Surname + " " + us.Name }).FirstOrDefault(); if (hosoxl.HoSoXuLyHistoryId_Active.HasValue) { var xetDuyet = await _hoSoXuLyHistoryRepos.GetAsync(hosoxl.HoSoXuLyHistoryId_Active.Value); return(new { hoSoXuLy = hosoxl, yKienTruongPhong = _yKienTruongPhong, duyetHoSo = xetDuyet }); } return(new { hoSoXuLy = hosoxl, yKienTruongPhong = _yKienTruongPhong }); } return(null); } catch (Exception ex) { Logger.Fatal(ex.Message); return(null); } }