Ejemplo n.º 1
0
        public async Task <PagedResultDto <XHoSoLienThong> > GetListHoSoPaging(XPagingInput input, int?chiCucId)
        {
            try
            {
                var query = QueryAll(input, chiCucId.Value);

                #region Query fromCase
                if (input.FormCase != 0)
                {
                    if (input.FormCase == 1) //Hồ sơ chưa liên thông
                    {
                        query = query.Where(p => p.TrangThaiLienThong == null);
                    }
                    else if (input.FormCase == 2) //Hồ sơ đã liên thông nhưng không thành công
                    {
                        query = query.Where(p => p.TrangThaiLienThong == (int)CommonENum.TRANG_THAI_LIEN_THONG.DA_LIEN_THONG_KHONG_THANH_CONG);
                    }
                    else if (input.FormCase == 3) //Hồ sơ đã liên thông thành công
                    {
                        query = query.Where(p => p.TrangThaiLienThong == (int)CommonENum.TRANG_THAI_LIEN_THONG.DA_LIEN_THONG_THANH_CONG /*&& p.LienThongId != null*/);
                    }
                }
                #endregion

                var _total = await query.CountAsync();

                var dataGrids = await query
                                .OrderBy(p => p.HoSoId)
                                .PageBy(input)
                                .ToListAsync();

                if (dataGrids != null && dataGrids.Count() > 0)
                {
                    foreach (var item in dataGrids)
                    {
                        if (item.TinhId.HasValue)
                        {
                            var tinh = await _tinhRepos.GetAsync(item.TinhId.Value);

                            item.StrTinh = tinh != null ? tinh.Ten : "";
                        }
                        if (item.NhomSanPhamId.HasValue)
                        {
                            var nsp = await _nhomSanPhamRepos.GetAsync(item.NhomSanPhamId.Value);

                            item.StrNhomSanPham = nsp != null ? nsp.TenNhomSanPham : "";
                        }
                    }
                }

                return(new PagedResultDto <XHoSoLienThong>(_total, dataGrids));
            }
            catch (Exception ex)
            {
                _logger.Fatal(ex.Message);
                return(null);
            }
        }
Ejemplo n.º 2
0
        public async Task <PagedResultDto <XHoSoLienThong> > GetListHoSoPaging(XPagingInput input)
        {
            try
            {
                var query = await _tuCongBoLTDomainService.GetListHoSoPaging(input, _session.TenantId);

                return(query);
            }
            catch (Exception ex)
            {
                _logger.Fatal(ex.Message);
                return(null);
            }
        }
Ejemplo n.º 3
0
        public async Task <KetQuaLienThong> AotuLienThongHoSo(int?chiCucId)
        {
            try
            {
                var KetQua = new KetQuaLienThong();
                if (_callApiAppService.IsAccountLienThong(chiCucId.Value))
                {
                    var input = new XPagingInput();

                    string strTinh = RemoveUnicodeTinh(chiCucId.Value);

                    int _chiCucId = chiCucId == null ? 0 : chiCucId.Value;
                    var query     = QueryAll(input, _chiCucId);
                    var list      = await query.Where(p => p.TrangThaiLienThong != (int)CommonENum.TRANG_THAI_LIEN_THONG.DA_LIEN_THONG_THANH_CONG)
                                    .OrderBy(p => p.HoSoId)
                                    .ToListAsync();

                    if (list.Count > 0)
                    {
                        List <XCallApiInput> inputCallApi = list.MapTo <List <XCallApiInput> >();

                        KetQua = await LienThongHoSo(inputCallApi, _chiCucId, strTinh);
                    }
                    else
                    {
                        KetQua.TrangThaiLienThongRequest = (int)CommonENum.TRANG_THAI_LIEN_THONG_REQUEST.KHONG_CO_HO_SO_HOAC_DA_LIEN_THONG;
                    }
                }
                else
                {
                    KetQua.TrangThaiLienThongRequest = (int)CommonENum.TRANG_THAI_LIEN_THONG_REQUEST.CHUA_CO_TAI_KHOAN;
                }
                return(KetQua);
            }
            catch (Exception ex)
            {
                _logger.Fatal(ex.Message);
                return(null);
            }
        }
Ejemplo n.º 4
0
        private IQueryable <XHoSoLienThong> QueryAll(XPagingInput input, int chiCucId)
        {
            long.TryParse(input.Keyword, out long hoSoId);
            DateTime NgayTraKetQuaToi = new DateTime(), NgayTraKetQuaTu = new DateTime();

            if (input.NgayTraKetQuaToi.HasValue && input.NgayTraKetQuaTu.HasValue)
            {
                NgayTraKetQuaToi = new DateTime(input.NgayTraKetQuaToi.Value.Year, input.NgayTraKetQuaToi.Value.Month, input.NgayTraKetQuaToi.Value.Day, 23, 59, 59);
                NgayTraKetQuaTu  = new DateTime(input.NgayTraKetQuaTu.Value.Year, input.NgayTraKetQuaTu.Value.Month, input.NgayTraKetQuaTu.Value.Day, 0, 0, 0);
            }

            var query = (from hoso in _vfaHoSoRepos.GetAll()
                         where hoso.TrangThaiHoSo == (int)CommonENum.TRANG_THAI_HO_SO.DA_HOAN_TAT && hoso.ChiCucId == chiCucId
                         join r_dn in _doanhNghiepRepos.GetAll() on hoso.DoanhNghiepId equals r_dn.Id into tb_dn //Left Join
                         from dn in tb_dn.DefaultIfEmpty()
                         select new XHoSoLienThong
            {
                Id = hoso.Id,
                ChiCucId = hoso.ChiCucId,
                HoSoId = hoso.HoSoId,
                ThuTucId = hoso.ThuTucId,
                MaSoThue = hoso.MaSoThue,
                MaHoSo = hoso.MaHoSo,
                SoDangKy = hoso.SoDangKy,
                IsCA = hoso.IsCA,
                OnIsCA = hoso.OnIsCA,
                IsHoSoBS = hoso.IsHoSoBS,
                LoaiHoSoId = hoso.LoaiHoSoId,
                DoanhNghiepId = hoso.DoanhNghiepId,
                TenDoanhNghiep = hoso.TenDoanhNghiep,
                TenSanPhamDangKy = hoso.TenSanPhamDangKy,
                ThanhPhanSanPhamDangKy = hoso.ThanhPhanSanPhamDangKy,
                ThoiHanSuDung = hoso.ThoiHanSuDung,
                NgayTraKetQua = hoso.NgayTraKetQua,
                NgayTiepNhan = hoso.NgayTiepNhan,
                HoSoXuLyId_Active = hoso.HoSoXuLyId_Active,
                TrangThaiHoSo = hoso.TrangThaiHoSo,
                PhongBanId = hoso.PhongBanId,
                TrangThaiLienThong = hoso.TrangThaiLienThong,
                ChatLieuBaoBi = hoso.ChatLieuBaoBi,
                QuyCachDongGoi = hoso.QuyCachDongGoi,
                TenCoSoSanXuat = hoso.TenCoSoSanXuat,
                DiaChiCoSoSanXuat = hoso.DiaChiCoSoSanXuat,
                QuyChuanKyThuatQuocGia = hoso.QuyChuanKyThuatQuocGia,
                TieuChuanQuocGia = hoso.TieuChuanQuocGia,
                ThongTu = hoso.ThongTu,
                TieuChuanQuocTe = hoso.TieuChuanQuocTe,
                QuyChuanDiaPhuong = hoso.QuyChuanDiaPhuong,
                TieuChuanNhaSanXuat = hoso.TieuChuanNhaSanXuat,
                IsNhapKhau = hoso.IsNhapKhau,
                QuocGiaNhapKhauId = hoso.QuocGiaNhapKhauId,
                DuongDanTepCA = hoso.DuongDanTepCA,
                NgayTuCongBo = hoso.NgayTuCongBo,
                NhomSanPhamId = hoso.NhomSanPhamId,
                GiayTiepNhanFull = hoso.GiayTiepNhanFull,
                Guid = hoso.Guid,
                //DoanhNghiep
                DiaChi = dn.DiaChi,
                SoDienThoai = dn.SoDienThoai,
                Fax = dn.Fax,
                TinhId = (dn != null) ? dn.TinhId : 0,
                HuyenId = (dn != null) ? dn.HuyenId : 0,
                XaId = (dn != null) ? dn.XaId : 0,
                Website = dn.Website,
                TenNguoiDaiDien = dn.TenNguoiDaiDien
            })
                        .WhereIf(!string.IsNullOrEmpty(input.Keyword),
                                 u => (u.SoDangKy != null && u.SoDangKy.LocDauLowerCaseDB().Contains(input.Keyword.LocDauLowerCaseDB())) ||
                                 (u.MaHoSo != null && u.MaHoSo.Contains(input.Keyword.LocDauLowerCaseDB())) ||
                                 (u.TenDoanhNghiep != null && u.TenDoanhNghiep.LocDauLowerCaseDB().Contains(input.Keyword.LocDauLowerCaseDB())) ||
                                 (u.Id == hoSoId))
                        .WhereIf(input.NgayTraKetQuaTu.HasValue && input.NgayTraKetQuaToi.HasValue, u => !u.NgayTraKetQua.HasValue || (u.NgayTraKetQua >= NgayTraKetQuaTu && u.NgayTraKetQua <= NgayTraKetQuaToi))
                        .WhereIf(input.TinhId.HasValue, u => u.TinhId == input.TinhId.Value)
                        .WhereIf(input.DoanhNghiepId.HasValue, u => u.DoanhNghiepId == input.DoanhNghiepId.Value);

            return(query);
        }