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);
            }
        }