예제 #1
0
        public async Task <int> ThamDinhLai_Chuyen(LuuThamDinh99InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hosoxl != null && _session.UserId == hosoxl.ChuyenVienThuLyId)
                    {
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

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

                        _history.ThuTucId        = hosoxl.ThuTucId;
                        _history.HoSoXuLyId      = hosoxl.Id;
                        _history.HoSoId          = hosoxl.HoSoId;
                        _history.IsHoSoBS        = hosoxl.IsHoSoBS;
                        _history.NguoiXuLyId     = _session.UserId;
                        _history.ActionEnum      = (int)CommonENum.FORM_FUNCTION.THAM_XET_LAI;
                        _history.NguoiXuLyId     = _session.UserId;
                        _history.HoSoIsDat_Pre   = hosoxl.HoSoIsDat;
                        _history.HoSoIsDat       = input.HoSoIsDat_Input;
                        _history.TrangThaiCV     = input.TrangThaiCV;
                        _history.TieuDeCV        = input.TieuDeCV_Input;
                        _history.NoiDungCV       = input.NoiDungCV_Input;
                        _history.IsChuyenNhanh   = input.IsChuyenNhanh;
                        _history.LyDoChuyenNhanh = input.LyDoChuyenNhanh;
                        _history.TruongPhongId   = input.TruongPhongId;
                        _history.PhoPhongId      = input.PhoPhongId;
                        _history.NoiDungYKien    = input.LyDoChuyenNhanh;
                        #endregion

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hosoxl.HoSoXuLyHistoryId_Active = null;

                        hosoxl.HoSoIsDat = input.HoSoIsDat_Input;
                        if (input.HoSoIsDat_Input != null)
                        {
                            hosoxl.NoiDungCV = input.NoiDungCV_Input;
                        }

                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
예제 #2
0
        public async Task <int> ThamDinhLai_Luu(LuuThamDinh99InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hosoxl != null && _session.UserId == hosoxl.ChuyenVienThuLyId)
                    {
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

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

                        _history.HoSoXuLyId      = hosoxl.Id;
                        _history.HoSoId          = hosoxl.HoSoId;
                        _history.IsHoSoBS        = hosoxl.IsHoSoBS;
                        _history.DonViXuLy       = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP;
                        _history.NoiDungYKien    = input.LyDoChuyenNhanh;
                        _history.NguoiXuLyId     = _session.UserId;
                        _history.HoSoIsDat_Pre   = hosoxl.HoSoIsDat;
                        _history.HoSoIsDat       = input.HoSoIsDat_Input;
                        _history.TrangThaiCV     = input.TrangThaiCV;
                        _history.TieuDeCV        = input.TieuDeCV_Input;
                        _history.NoiDungCV       = input.NoiDungCV_Input;
                        _history.IsChuyenNhanh   = input.IsChuyenNhanh;
                        _history.LyDoChuyenNhanh = input.LyDoChuyenNhanh;
                        #endregion

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hosoxl.HoSoXuLyHistoryId_Active = _historyId;

                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
예제 #3
0
        public async Task <int> ChuyenLaiTruongPhong(LanhDaoXuLy99Input input)
        {
            try
            {
                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.NoiDungYKien  = input.NoiDungYKien;
                    _history.ActionEnum    = (int)CommonENum.FORM_FUNCTION.LANH_DAO_CUC_DUYET;

                    await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history);

                    #endregion

                    hoSoXuLy.DonViXuLy         = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET;
                    hoSoXuLy.DonViGui          = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC;
                    hoSoXuLy.NguoiGuiId        = _session.UserId;
                    hoSoXuLy.YKienGui          = _history.NoiDungYKien;
                    hoSoXuLy.NguoiXuLyId       = hoSoXuLy.ChuyenVienThuLyId;
                    hoSoXuLy.LanhDaoCucDaDuyet = true;

                    await _hoSoXuLyRepos.UpdateAsync(hoSoXuLy);
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
        public async Task BaoCaoSaiSot(VanThuXuLy99InputDto input)
        {
            try
            {
                var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                if (hosoxl != null && hosoxl.Id > 0)
                {
                    #region Lưu lịch sử
                    var _history = new XHoSoXuLyHistory();
                    _history.ThuTucId      = hosoxl.ThuTucId;
                    _history.HoSoXuLyId    = hosoxl.Id;
                    _history.HoSoId        = hosoxl.HoSoId;
                    _history.IsHoSoBS      = hosoxl.IsHoSoBS;
                    _history.NguoiXuLyId   = _session.UserId;
                    _history.NoiDungYKien  = input.NoiDungYKien;
                    _history.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.VAN_THU;
                    _history.ActionEnum    = (int)CommonENum.FORM_FUNCTION.VAN_THU_BAO_CAO_CONG_VAN_CO_SAI_SOT;
                    _history.HoSoIsDat     = hosoxl.HoSoIsDat;
                    _history.HoSoIsDat_Pre = hosoxl.HoSoIsDat;
                    _history.TrangThaiCV   = null;

                    await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history);

                    #endregion

                    hosoxl.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC;
                    hosoxl.DonViGui      = (int)CommonENum.DON_VI_XU_LY.VAN_THU;
                    hosoxl.NguoiGuiId    = _session.UserId;
                    hosoxl.NguoiXuLyId   = hosoxl.LanhDaoCucId;
                    hosoxl.NgayGui       = DateTime.Now;
                    hosoxl.VanThuDaDuyet = true;
                    hosoxl.YKienGui      = _history.NoiDungYKien;

                    await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
            }
        }
예제 #5
0
        public async Task <dynamic> LoadTruongPhongDuyet(LoadTruongPhongDuyet99InputDto 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 BienBanThamDinhPhoiHop99Dto()
                    //    {
                    //        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);
            }
        }
예제 #6
0
        public async Task <int> TruongPhongDuyet_Chuyen(LuuTruongPhongDuyet99InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hosoxl != null && _session.UserId == hosoxl.TruongPhongId)
                    {
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

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

                        _history.ThuTucId      = hosoxl.ThuTucId;
                        _history.HoSoXuLyId    = hosoxl.Id;
                        _history.HoSoId        = hosoxl.HoSoId;
                        _history.ThuTucId      = hosoxl.ThuTucId;
                        _history.IsHoSoBS      = hosoxl.IsHoSoBS;
                        _history.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                        _history.ActionEnum    = (int)CommonENum.FORM_FUNCTION.TRUONG_PHONG_DUYET;
                        _history.DonViKeTiep   = input.DonViKeTiep;
                        _history.NoiDungYKien  = input.NoiDungYKien;
                        _history.NguoiXuLyId   = _session.UserId;
                        _history.HoSoIsDat_Pre = hosoxl.HoSoIsDat;
                        _history.HoSoIsDat     = input.HoSoIsDat;
                        _history.TrangThaiCV   = input.TrangThaiCV;
                        _history.IsSuaCV       = input.IsSuaCV;
                        if (input.HoSoIsDat != true && input.IsSuaCV.HasValue && input.IsSuaCV.Value)
                        {
                            _history.NoiDungCV = input.NoiDungCV;
                        }
                        else
                        {
                            _history.NoiDungCV = null;
                        }

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hosoxl.HoSoXuLyHistoryId_Active = _historyId;
                        #endregion

                        if (input.HoSoIsDat != true && input.IsSuaCV.HasValue && input.IsSuaCV.Value)
                        {
                            hosoxl.NoiDungCV = input.NoiDungCV;
                        }
                        hosoxl.DonViKeTiep = input.DonViKeTiep;
                        hosoxl.HoSoIsDat   = input.HoSoIsDat;
                        hosoxl.TrangThaiCV = input.TrangThaiCV;

                        if (hosoxl.DonViKeTiep == (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC)
                        {
                            hosoxl.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.LANH_DAO_CUC;
                            hosoxl.DonViGui     = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                            hosoxl.LanhDaoCucId = input.LanhDaoCucId;
                            hosoxl.NguoiXuLyId  = input.LanhDaoCucId;
                        }
                        else if (hosoxl.DonViKeTiep == (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP)
                        {
                            hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP;
                            hosoxl.NguoiXuLyId = hosoxl.ChuyenVienThuLyId;
                            hosoxl.DonViGui    = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                        }

                        hosoxl.HoSoXuLyHistoryId_Active = null;
                        hosoxl.NguoiGuiId         = _session.UserId;
                        hosoxl.YKienGui           = _history.NoiDungYKien;
                        hosoxl.TruongPhongDaDuyet = true;

                        hosoxl.YKienChung = input.YKienChung;

                        //Lưu hồ sơ
                        hosoxl.NgayGui = DateTime.Now;

                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
        public async Task DongDau(VanThuXuLy99InputDto input)
        {
            var vanThuId = _session.UserId;

            try
            {
                var hoSo = await _hoSoRepos.FirstOrDefaultAsync(x => x.Id == input.HoSoId);

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

                if (hosoxl != null && hoSo != null && hosoxl.Id > 0)
                {
                    if (hosoxl.HoSoIsDat == true)
                    {
                        hoSo.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.DA_HOAN_TAT;
                        hoSo.NgayTraKetQua = DateTime.Now;
                    }
                    else
                    {
                        hoSo.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.SUA_DOI_BO_SUNG;
                        hoSo.IsHoSoBS      = true;
                    }

                    hosoxl.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.DOANH_NGHIEP;
                    hosoxl.DonViGui      = (int)CommonENum.DON_VI_XU_LY.VAN_THU;
                    hosoxl.NguoiGuiId    = _session.UserId;
                    hosoxl.NguoiXuLyId   = hoSo.CreatorUserId;
                    hosoxl.NgayGui       = DateTime.Now;
                    hosoxl.VanThuDaDuyet = true;

                    hosoxl.VanThuId          = vanThuId;
                    hosoxl.VanThuIsCA        = true;
                    hosoxl.VanThuNgayDongDau = DateTime.Now;
                    hosoxl.DuongDanTepCA     = input.DuongDanTepCA;
                    hosoxl.GiayTiepNhanCA    = input.GiayTiepNhanCA;
                    if (hosoxl.HoSoIsDat == true)
                    {
                        hoSo.GiayTiepNhan     = input.GiayTiepNhanCA;
                        hoSo.GiayTiepNhanFull = input.GiayTiepNhanCA;
                    }
                    else
                    {
                        hoSo.GiayTiepNhan     = null;
                        hoSo.GiayTiepNhanFull = null;
                    }
                    hosoxl.YKienGui = null;


                    await _hoSoRepos.UpdateAsync(hoSo);

                    await _hoSoXuLyRepos.UpdateAsync(hosoxl);

                    if (hosoxl.HoSoIsDat != true)
                    {
                        #region HoSo_Clone

                        var hoSoClone = new XHoSoDto();
                        hoSo.MapTo(hoSoClone);
                        hoSoClone.PId = hoSo.PId != null ? hoSo.PId : hoSo.Id;
                        var insertInput = hoSoClone.MapTo <XHoSo>();

                        long idClone = await _hoSoRepos.InsertAndGetIdAsync(insertInput);

                        CurrentUnitOfWork.SaveChanges();
                        var teps = _hoSoTepDinhKemRepos.GetAll()
                                   .Where(x => x.HoSoId == input.HoSoId);

                        foreach (var tep in teps)
                        {
                            var tepNew = new XHoSoTepDinhKem
                            {
                                HoSoId         = insertInput.Id,
                                IsActive       = tep.IsActive,
                                DuongDanTep    = tep.DuongDanTep,
                                IsCA           = tep.IsCA,
                                DaTaiLen       = tep.DaTaiLen,
                                LoaiTepDinhKem = tep.LoaiTepDinhKem,
                                MoTaTep        = tep.MoTaTep,
                                TenTep         = tep.TenTep
                            };
                            await _hoSoTepDinhKemRepos.InsertAsync(tepNew);
                        }
                        #endregion
                    }

                    #region Lưu lịch sử
                    var _history = new XHoSoXuLyHistory();
                    _history.ThuTucId     = hosoxl.ThuTucId;
                    _history.HoSoXuLyId   = hosoxl.Id;
                    _history.HoSoId       = hosoxl.HoSoId;
                    _history.IsHoSoBS     = hosoxl.IsHoSoBS;
                    _history.NguoiXuLyId  = _session.UserId;
                    _history.NoiDungYKien = null;
                    _history.TrangThaiCV  = hosoxl.TrangThaiCV;
                    _history.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.VAN_THU;
                    _history.ActionEnum   = (int)CommonENum.FORM_FUNCTION.VAN_THU_DONG_DAU;

                    _history.HoSoIsDat     = hosoxl.HoSoIsDat;
                    _history.HoSoIsDat_Pre = hosoxl.HoSoIsDat;

                    await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
            }
        }
예제 #8
0
        public async Task <int> TongHopThamDinh_Chuyen(LuuThamDinh99InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hosoxl != null && _session.UserId == hosoxl.ChuyenVienThuLyId)
                    {
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

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

                        _history.HoSoXuLyId    = hosoxl.Id;
                        _history.HoSoId        = hosoxl.HoSoId;
                        _history.IsHoSoBS      = hosoxl.IsHoSoBS;
                        _history.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP;
                        _history.NguoiXuLyId   = _session.UserId;
                        _history.HoSoIsDat_Pre = hosoxl.HoSoIsDat;
                        _history.HoSoIsDat     = input.HoSoIsDat_Input;
                        _history.TrangThaiCV   = input.TrangThaiCV;
                        _history.TieuDeCV      = input.TieuDeCV_Input;
                        _history.NoiDungCV     = input.NoiDungCV_Input;
                        _history.ActionEnum    = (int)CommonENum.FORM_FUNCTION.CHUYEN_VIEN_DUYET_THAM_XET;

                        //Thêm lý do khi thực hiện chuyển nhanh
                        if (input.IsChuyenNhanh != null && input.IsChuyenNhanh.Value)
                        {
                            _history.LyDoChuyenNhanh = input.LyDoChuyenNhanh;
                            hosoxl.YKienGui          = input.LyDoChuyenNhanh;
                            hosoxl.DonViXuLy         = (int)CommonENum.DON_VI_XU_LY.TRUONG_PHONG;
                            hosoxl.NguoiXuLyId       = hosoxl.TruongPhongId;
                        }
                        else
                        {
                            hosoxl.YKienGui    = null;
                            hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.PHO_PHONG;
                            hosoxl.PhoPhongId  = input.PhoPhongId;
                            hosoxl.NguoiXuLyId = input.PhoPhongId;
                        }
                        #endregion

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hosoxl.HoSoXuLyHistoryId_Active = null;
                        hosoxl.NguoiGuiId = _session.UserId;

                        hosoxl.HoSoIsDat = input.HoSoIsDat_Input;
                        if (input.HoSoIsDat_Input != null)
                        {
                            hosoxl.NoiDungCV = input.NoiDungCV_Input;
                        }

                        hosoxl.DonViGui = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET_TONG_HOP;

                        hosoxl.NgayGui = DateTime.Now;
                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
        public async Task <int> PhoPhongDuyet_Luu(LuuPhoPhongDuyet99InputDto input)
        {
            try
            {
                if (input.HoSoXuLyId > 0)
                {
                    var hosoxl = await _hoSoXuLyRepos.FirstOrDefaultAsync(input.HoSoXuLyId);

                    if (hosoxl != null && _session.UserId == hosoxl.PhoPhongId)
                    {
                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();

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

                        _history.ThuTucId      = hosoxl.ThuTucId;
                        _history.HoSoXuLyId    = hosoxl.Id;
                        _history.HoSoId        = hosoxl.HoSoId;
                        _history.ThuTucId      = hosoxl.ThuTucId;
                        _history.IsHoSoBS      = hosoxl.IsHoSoBS;
                        _history.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.PHO_PHONG;
                        _history.NoiDungYKien  = input.NoiDungYKien;
                        _history.DonViKeTiep   = input.DonViKeTiep;
                        _history.NguoiXuLyId   = _session.UserId;
                        _history.HoSoIsDat_Pre = hosoxl.HoSoIsDat;
                        _history.HoSoIsDat     = input.HoSoIsDat;
                        _history.TrangThaiCV   = input.TrangThaiCV;
                        _history.IsSuaCV       = input.IsSuaCV;
                        if (input.HoSoIsDat != true && input.IsSuaCV.HasValue && input.IsSuaCV.Value)
                        {
                            _history.NoiDungCV = input.NoiDungCV;
                        }
                        else
                        {
                            _history.NoiDungCV = null;
                        }

                        var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                        hosoxl.HoSoXuLyHistoryId_Active = _historyId;
                        #endregion

                        if (input.HoSoIsDat != true && input.IsSuaCV.HasValue && input.IsSuaCV.Value)
                        {
                            hosoxl.NoiDungCV = input.NoiDungCV;
                        }

                        hosoxl.HoSoIsDat  = input.HoSoIsDat;
                        hosoxl.YKienChung = input.YKienChung;

                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                    }
                }

                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
        public async Task <dynamic> LoadPhoPhongDuyet(LoadPhoPhongDuyet99InputDto 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>();

                    #region Data xem biên bản thẩm định

                    #endregion

                    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);
            }
        }
예제 #11
0
        public async Task <int> KyVaChuyenVanThu(LanhDaoXuLy99Input input)
        {
            try
            {
                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.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;
                    }
                    if (!string.IsNullOrEmpty(input.GiayTiepNhanCA))
                    {
                        hoSoXuLy.LanhDaoCucIsCA   = true;
                        hoSoXuLy.LanhDaoCucNgayKy = DateTime.Now;
                        hoSoXuLy.GiayTiepNhanCA   = input.GiayTiepNhanCA;
                    }
                    hoSoXuLy.YKienGui = _history.NoiDungYKien;

                    if (hoSoXuLy.HoSoIsDat == true)
                    {
                        var hoSo = await _hoSoRepos.GetAsync(hoSoXuLy.HoSoId);

                        hoSo.SoGiayTiepNhan = input.SoTiepNhan;
                        await _hoSoRepos.UpdateAsync(hoSo);
                    }

                    await _hoSoXuLyRepos.UpdateAsync(hoSoXuLy);
                }
                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }