Example #1
0
        public async Task <int> YeuCauThanhToan(PhanCongPhongBan99InputDto input)
        {
            try
            {
                int count = 0;
                foreach (var _id in input.ArrHoSoId)
                {
                    var hoSo = _hoSoRepos.FirstOrDefault(_id);
                    if (hoSo.Id > 0)
                    {
                        if (hoSo.HoSoXuLyId_Active.HasValue)
                        {
                            var hosoxl = _hoSoXuLyRepos.FirstOrDefault(hoSo.HoSoXuLyId_Active.Value);
                            hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.DOANH_NGHIEP;
                            hosoxl.DonViGui    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            hosoxl.NguoiGuiId  = _session.UserId;
                            hosoxl.NguoiXuLyId = null;
                            hosoxl.NgayGui     = DateTime.Now;

                            #region Lưu lịch sử
                            var _history = new XHoSoXuLyHistory();
                            _history.HoSoXuLyId   = hosoxl.Id;
                            _history.ThuTucId     = hoSo.ThuTucId;
                            _history.HoSoId       = hoSo.Id;
                            _history.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            _history.NguoiXuLyId  = _session.UserId;
                            _history.NoiDungYKien = "Đề nghị thanh toán lệ phí hồ sơ!";
                            _history.ActionEnum   = (int)CommonENum.FORM_FUNCTION.MOT_CUA_PHAN_CONG_HO_SO;
                            if (hoSo.PhongBanId.HasValue && hoSo.PhongBanId.Value > 0)
                            {
                                _history.ActionEnum = (int)CommonENum.FORM_FUNCTION.MOT_CUA_PHAN_CONG_LAI_HO_SO;
                            }

                            var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                            hosoxl.HoSoXuLyHistoryId_Active = _historyId;
                            #endregion

                            await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                        }
                        hoSo.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.CHO_DOANH_NGHIEP_THANH_TOAN;
                        await _hoSoRepos.UpdateAsync(hoSo);

                        count++;
                    }
                }

                return(count);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
Example #2
0
        public async Task <int> TuChoiTiepNhan(PhanCongPhongBan99InputDto input)
        {
            try
            {
                int count = 0;
                foreach (var _id in input.ArrHoSoId)
                {
                    var hoSo = _hoSoRepos.FirstOrDefault(_id);

                    if (hoSo.Id > 0)
                    {
                        hoSo.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.MOT_CUA_TRA_LAI;
                        await _hoSoRepos.UpdateAsync(hoSo);

                        if (hoSo.HoSoXuLyId_Active.HasValue)
                        {
                            var hosoxl = _hoSoXuLyRepos.FirstOrDefault(hoSo.HoSoXuLyId_Active.Value);
                            hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.DOANH_NGHIEP;
                            hosoxl.DonViGui    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            hosoxl.NguoiGuiId  = _session.UserId;
                            hosoxl.NguoiXuLyId = hoSo.CreatorUserId;
                            hosoxl.YKienGui    = input.LyDoTuChoi;
                            hosoxl.HoSoIsDat   = null;
                            hosoxl.NgayGui     = DateTime.Now;

                            #region Lưu lịch sử
                            var _history = new XHoSoXuLyHistory();
                            _history.HoSoXuLyId   = hosoxl.Id;
                            _history.ThuTucId     = hoSo.ThuTucId;
                            _history.HoSoId       = hoSo.Id;
                            _history.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            _history.DonViKeTiep  = (int)CommonENum.DON_VI_XU_LY.DOANH_NGHIEP;
                            _history.NguoiXuLyId  = _session.UserId;
                            _history.NoiDungYKien = input.LyDoTuChoi;
                            _history.ActionEnum   = (int)CommonENum.FORM_FUNCTION.MOT_CUA_PHAN_CONG_HO_SO;

                            var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                            hosoxl.HoSoXuLyHistoryId_Active = null;
                            #endregion

                            await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                        }
                        count++;
                    }
                }
                return(count);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
Example #3
0
        public async Task <int> PhanCongPhongBan(PhanCongPhongBan99InputDto input)
        {
            try
            {
                int count = 0;
                foreach (var _id in input.ArrHoSoId)
                {
                    var hoSo = _hoSoRepos.FirstOrDefault(_id);
                    if (hoSo.Id > 0)
                    {
                        if (hoSo.HoSoXuLyId_Active.HasValue)
                        {
                            var hosoxl = _hoSoXuLyRepos.FirstOrDefault(hoSo.HoSoXuLyId_Active.Value);
                            hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.PHONG_BAN_PHAN_CONG;
                            hosoxl.DonViGui    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            hosoxl.NguoiGuiId  = _session.UserId;
                            hosoxl.NguoiXuLyId = null;
                            hosoxl.NgayGui     = DateTime.Now;

                            #region Lưu lịch sử
                            var _history = new XHoSoXuLyHistory();
                            _history.HoSoXuLyId   = hosoxl.Id;
                            _history.ThuTucId     = hoSo.ThuTucId;
                            _history.HoSoId       = hoSo.Id;
                            _history.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                            _history.NguoiXuLyId  = _session.UserId;
                            _history.NoiDungYKien = string.Format("Chuyển hồ sơ tới phòng: [{0}] {1}", input.PhongBanId, input.TenPhongBan);
                            _history.ActionEnum   = (int)CommonENum.FORM_FUNCTION.MOT_CUA_PHAN_CONG_HO_SO;

                            var _historyId = await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

                            hosoxl.HoSoXuLyHistoryId_Active = _historyId;
                            #endregion

                            await _hoSoXuLyRepos.UpdateAsync(hosoxl);
                        }
                        hoSo.MotCuaChuyenId   = _session.UserId;
                        hoSo.NgayMotCuaChuyen = DateTime.Now;
                        hoSo.PhongBanId       = input.PhongBanId;
                        hoSo.TrangThaiHoSo    = (int)CommonENum.TRANG_THAI_HO_SO.MOT_CUA_DA_TIEP_NHAN;
                        await _hoSoRepos.UpdateAsync(hoSo);

                        count++;
                    }
                }

                return(count);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
Example #4
0
        public async Task <int> KyGiayTiepNhanVaTraDoanhNghiep(MotCuaTraGiayTiepNhan99InputDto input)
        {
            try
            {
                var hoSo = await _hoSoRepos.GetAsync(input.HoSoId);

                hoSo.SoGiayTiepNhan = input.SoTiepNhan;
                if (!string.IsNullOrEmpty(input.GiayTiepNhanCA))
                {
                    hoSo.GiayTiepNhan = input.GiayTiepNhanCA;
                }
                await _hoSoRepos.UpdateAsync(hoSo);

                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      = hoSo.ThuTucId;
                    _history.HoSoId        = hoSoXuLy.HoSoId;
                    _history.IsHoSoBS      = hoSoXuLy.IsHoSoBS;
                    _history.DonViXuLy     = (int)CommonENum.DON_VI_XU_LY.MOT_CUA_TIEP_NHAN;
                    _history.NguoiXuLyId   = _session.UserId;
                    _history.HoSoIsDat_Pre = hoSoXuLy.HoSoIsDat;
                    _history.HoSoIsDat     = hoSoXuLy.HoSoIsDat;
                    _history.TrangThaiCV   = input.TrangThaiCV;
                    _history.NoiDungCV     = null;
                    _history.NoiDungYKien  = "Bộ phận một cửa trả giấy tiếp nhận";
                    _history.ActionEnum    = (int)CommonENum.FORM_FUNCTION.MOT_CUA_PHAN_CONG_HO_SO;
                    await _hoSoXuLyHistoryRepos.InsertAndGetIdAsync(_history);

                    #endregion
                    hoSoXuLy.NguoiGuiId  = _session.UserId;
                    hoSoXuLy.NguoiXuLyId = null;
                    hoSoXuLy.DonViKeTiep = input.DonViKeTiep;
                    if (!string.IsNullOrEmpty(input.GiayTiepNhanCA))
                    {
                        hoSoXuLy.GiayTiepNhanCA = input.GiayTiepNhanCA;
                    }
                    await _hoSoXuLyRepos.UpdateAsync(hoSoXuLy);
                }
                return(1);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
Example #5
0
        public async Task <int> PhanCongThamDinh(PhanCongThamDinh99InputDto input)
        {
            try
            {
                int count = 0;
                foreach (var _id in input.ArrHoSoId)
                {
                    var hosoxl = _hoSoXuLyRepos.FirstOrDefault(_id);
                    if (hosoxl.Id > 0)
                    {
                        var hoSo = _hoSoRepos.FirstOrDefault(hosoxl.HoSoId);

                        #region Lưu lịch sử
                        var _history = new XHoSoXuLyHistory();
                        _history.HoSoXuLyId  = hosoxl.Id;
                        _history.ThuTucId    = hosoxl.ThuTucId;
                        _history.HoSoId      = hosoxl.HoSoId;
                        _history.IsHoSoBS    = hosoxl.IsHoSoBS;
                        _history.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.PHONG_BAN_PHAN_CONG;
                        _history.NguoiXuLyId = _session.UserId;
                        _history.ActionEnum  = (int)CommonENum.FORM_FUNCTION.PHONG_BAN_PHAN_CONG;
                        if (hosoxl.ChuyenVienThuLyId != null && hosoxl.ChuyenVienThuLyDaDuyet == null)
                        {
                            _history.ActionEnum = (int)CommonENum.FORM_FUNCTION.PHAN_CONG_LAI_HO_SO_CHUA_XU_LY;
                        }

                        _history.ChuyenVienThuLyId   = input.ChuyenVienThuLyId;
                        _history.ChuyenVienPhoiHopId = input.ChuyenVienPhoiHopId;

                        _history.IsChuyenNhanh = input.IsChuyenNhanh;
                        await _hoSoXuLyHistoryRepos.InsertOrUpdateAsync(_history);

                        #endregion

                        hosoxl.HoSoXuLyHistoryId_Active = null;
                        //Update trạng thái hồ sơ
                        hosoxl.TruongPhongId       = input.TruongPhongId;
                        hosoxl.ChuyenVienThuLyId   = input.ChuyenVienThuLyId;
                        hosoxl.PhoPhongId          = input.PhoPhongId;
                        hosoxl.ChuyenVienPhoiHopId = input.ChuyenVienPhoiHopId;

                        hosoxl.NguoiXuLyId = input.ChuyenVienThuLyId;
                        hosoxl.DonViGui    = (int)CommonENum.DON_VI_XU_LY.PHONG_BAN_PHAN_CONG;
                        hosoxl.DonViXuLy   = (int)CommonENum.DON_VI_XU_LY.CHUYEN_VIEN_THAM_XET;

                        hosoxl.NguoiGuiId = _session.UserId;
                        hosoxl.YKienGui   = null;
                        hosoxl.NgayGui    = DateTime.Now;
                        await _hoSoXuLyRepos.UpdateAsync(hosoxl);

                        count++;
                    }
                }

                return(count);
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex.Message);
                return(0);
            }
        }
        public async Task <int> KeToanDuyet_Chuyen(LuuXacNhanKeToan99InputDto input)
        {
            try
            {
                if (input.HoSoId > 0 && input.ThanhToanId > 0)
                {
                    var thanhtoan = await _thanhToanRepos.FirstOrDefaultAsync(input.ThanhToanId);

                    if (thanhtoan != null)
                    {
                        if (input.XacNhanThanhToan == 1)
                        {
                            thanhtoan.TrangThaiNganHang    = (int)CommonENum.TRANG_THAI_GIAO_DICH.GIAO_DICH_THANH_CONG;
                            thanhtoan.TrangThaiKeToan      = (int)CommonENum.TRANG_THAI_KE_TOAN.KE_TOAN_XAC_NHAN_THANH_CONG;
                            thanhtoan.NgayXacNhanThanhToan = DateTime.Now;
                            thanhtoan.PhiXacNhan           = input.PhiXacNhan;
                            await _thanhToanRepos.UpdateAsync(thanhtoan);

                            var hoso = _hoSoRepos.Get(input.HoSoId);
                            if (hoso != null)
                            {
                                hoso.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.DA_NOP_HO_SO_MOI;
                                await _hoSoRepos.UpdateAsync(hoso);

                                await _xuLyHoSoDoanhNghiepAppService.NopHoSoMoi(hoso, false, true);
                            }
                        }
                        else
                        {
                            var hoso = _hoSoRepos.Get(input.HoSoId);
                            if (hoso == null)
                            {
                                return(0);
                            }

                            hoso.TrangThaiHoSo = (int)CommonENum.TRANG_THAI_HO_SO.THANH_TOAN_THAT_BAI;
                            await _hoSoRepos.UpdateAsync(hoso);

                            thanhtoan.LyDoHuyThanhToan  = input.YKienXacNhan;
                            thanhtoan.TrangThaiNganHang = (int)CommonENum.TRANG_THAI_GIAO_DICH.GIAO_DICH_KHONG_THANH_CONG;
                            thanhtoan.TrangThaiKeToan   = (int)CommonENum.TRANG_THAI_KE_TOAN.KE_TOAN_XAC_NHAN_KHONG_THANH_CONG;
                            await _thanhToanRepos.UpdateAsync(thanhtoan);

                            #region Lưu lịch sử
                            var _history = new XHoSoXuLyHistory();
                            _history.ThuTucId     = hoso.ThuTucId;
                            _history.HoSoId       = input.HoSoId;
                            _history.HoSoXuLyId   = 0;
                            _history.DonViXuLy    = (int)CommonENum.DON_VI_XU_LY.KE_TOAN;
                            _history.NoiDungYKien = input.YKienXacNhan;
                            _history.NguoiXuLyId  = _session.UserId;
                            _history.ActionEnum   = (int)CommonENum.FORM_FUNCTION.KE_TOAN_XAC_NHAN_THANH_TOAN;
                            await _hoSoXuLyHistoryRepos.InsertOrUpdateAndGetIdAsync(_history);

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