示例#1
0
        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);
            }
        }
示例#2
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> LoadTruongPhongDuyet(LoadTruongPhongDuyet37InputDto input)
        {
            try
            {
                var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                if (hosoxl != null && hosoxl.Id > 0)
                {
                    var tenChuyenVienThuLy = "";
                    var chuyenVienPhoiHop  = "";
                    var tenNguoiGui        = "";
                    if (hosoxl.ChuyenVienThuLyId.HasValue)
                    {
                        var cv1 = await _userRepos.FirstOrDefaultAsync(hosoxl.ChuyenVienThuLyId.Value);

                        if (cv1 != null)
                        {
                            tenChuyenVienThuLy = cv1.Surname + " " + cv1.Name;
                        }
                    }
                    if (hosoxl.ChuyenVienPhoiHopId.HasValue)
                    {
                        var cv2 = await _userRepos.FirstOrDefaultAsync(hosoxl.ChuyenVienPhoiHopId.Value);

                        if (cv2 != null)
                        {
                            tenChuyenVienThuLy = cv2.Surname + " " + cv2.Name;
                        }
                    }

                    if (hosoxl.NguoiGuiId.HasValue)
                    {
                        var u = await _userRepos.FirstOrDefaultAsync(hosoxl.NguoiGuiId.Value);

                        if (u != null)
                        {
                            tenNguoiGui = u.Surname + " " + u.Name;
                        }
                    }

                    var nguoiDuyet = new
                    {
                        chuyenVienThuLyId = hosoxl.ChuyenVienThuLyId,
                        tenChuyenVienThuLy,
                        chuyenVienPhoiHopId = hosoxl.ChuyenVienPhoiHopId,
                        chuyenVienPhoiHop,
                        nguoiGuiId = hosoxl.NguoiGuiId,
                        tenNguoiGui
                    };

                    var _hoSoXuLyDto = hosoxl.MapTo <XHoSoXuLyDto>();
                    //if (_hoSoXuLyDto.BienBanThamDinhId_CVThuLy.HasValue && _hoSoXuLyDto.BienBanThamDinhId_CVThuLy > 0)
                    //{
                    //    XBienBanThamDinh bienBanThamDinh = null;
                    //    bienBanThamDinh = await _BienBanThamDinhRepos.GetAsync(_hoSoXuLyDto.BienBanThamDinhId_CVThuLy.Value);
                    //    _hoSoXuLyDto.BienBanThamDinh_ChuyenVienPhoiHop = new BienBanThamDinhPhoiHop37Dto()
                    //    {
                    //        IsCopyThamXet = bienBanThamDinh.IsCopyThamXet
                    //    };
                    //}
                    if (_hoSoXuLyDto.HoSoXuLyHistoryId_Active.HasValue)
                    {
                        XHoSoXuLyHistory _history = null;
                        if (_hoSoXuLyDto.HoSoXuLyHistoryId_Active.HasValue)
                        {
                            _history = await _hoSoXuLyHistoryRepos.GetAsync(_hoSoXuLyDto.HoSoXuLyHistoryId_Active.Value);
                        }

                        return(new
                        {
                            hoSoXuLy = _hoSoXuLyDto,
                            nguoiDuyet,
                            duyetHoSo = _history
                        });
                    }

                    return(new
                    {
                        hoSoXuLy = _hoSoXuLyDto,
                        nguoiDuyet
                    });
                }

                return(null);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(null);
            }
        }
        // duyệt thẩm định hồ sơ bổ sung
        public async Task <int> TruongPhongDuyetThamDinh(LuuTruongPhongDuyet37InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hoso = await _hoSoRepos.GetAsync(input.HoSoId.Value);

                    var hsxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hsxl != null)
                    {
                        if (input.IsTraLaiChuyenVien.HasValue && input.IsTraLaiChuyenVien.Value)
                        {
                            hsxl.LyDoTraLai           = input.NoiDungYKien;
                            hsxl.DonViGui             = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                            hsxl.DonViXuLy            = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP;
                            hsxl.NguoiGuiId           = _session.UserId;
                            hsxl.NguoiXuLyId          = hsxl.ChuyenVienThuLyId;
                            hsxl.TruongPhongDaDuyet   = null;
                            hsxl.TruongPhongNgayDuyet = DateTime.Now;
                            hoso.TrangThaiHoSo        = (int)CommonENum.TRANG_THAI_HO_SO.HO_SO_THAM_DINH_LAI;
                        }
                        else
                        {
                            hsxl.NoiDungCV            = input.NoiDungCV;
                            hsxl.DonViGui             = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                            hsxl.DonViXuLy            = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC;
                            hsxl.NguoiGuiId           = _session.UserId;
                            hsxl.NguoiXuLyId          = hsxl.LanhDaoCucId;
                            hsxl.TruongPhongDaDuyet   = true;
                            hsxl.TruongPhongNgayDuyet = DateTime.Now;

                            hoso.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.SUA_DOI_BO_SUNG;
                        }



                        hsxl.HoSoXuLyHistoryId_Active = null;
                        hsxl.TruongPhongDaDuyet       = true;

                        //Lưu hồ sơ
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

                        if (hsxl.HoSoXuLyHistoryId_Active.HasValue)
                        {
                            _history = _hoSoXuLyHistoryRepos.Get(hsxl.HoSoXuLyHistoryId_Active.Value);
                        }

                        _history.ThuTucId    = hsxl.ThuTucId;
                        _history.NgayXuLy    = DateTime.Now;
                        _history.HoSoXuLyId  = hsxl.Id;
                        _history.HoSoId      = input.HoSoId;
                        _history.IsHoSoBS    = hsxl.IsHoSoBS;
                        _history.LuongXuLy   = (int)CommonENum.LUONG_XU_LY_TT37.LUONG_THAM_DINH;
                        _history.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                        _history.ActionEnum  = (int)CommonENum.FORM_FUNCTION.TRUONG_PHONG_DUYET_THAM_DINH;
                        _history.NguoiXuLyId = _session.UserId;

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hsxl.HoSoXuLyHistoryId_Active = _historyId;

                        #endregion

                        await _hoSoRepos.UpdateAsync(hoso);

                        await _hoSoXuLyRepos.UpdateAsync(hsxl);


                        return(1);
                    }
                }

                return(0);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }