/// <summary> /// This method returns list of funding sources based on sourceids passed /// </summary> /// <param name="sourceIds">sourceIds</param> /// <param name="organizationID">organizationID</param> /// <returns></returns> public List <FundingSource> GetFundingSourcesFromIDs(string sourceIds, int organizationID) { try { using (var unitOfWork = new EFUnitOfWork()) { //Array of source ids var arrIds = sourceIds.Split(','); var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; //Get all active sources var activeSources = fundSourceObjSet.Where(src => src.IsDeleted == false && src.IsEnabled == true && src.FK_OrganizationID == organizationID).ToList(); //Filter and return return(activeSources.Where(src => arrIds.Contains(src.PK_FundingSourceID.ToString())).ToList()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This method enables a funding source /// </summary> /// <param name="fundSourceID">fundSourceID</param> /// <returns></returns> public bool EnableFundingSource(int fundSourceID) { try { using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; //Get particular funding source var selectedFundSource = fundSourceObjSet.Where(fnd => fnd.PK_FundingSourceID == fundSourceID).FirstOrDefault(); //Set IsEnabled true if (selectedFundSource != null) { selectedFundSource.IsEnabled = true; fundSourceRepo.Save(); return(true); } return(false); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); return(false); } }
/// <summary> /// This method returns list of funding sources that have not been deleted /// for display during Fund Account /// </summary> /// <param name="sourceIds">sourceIds</param> /// <param name="organizationID">organizationID</param> /// <returns></returns> public List <FundTransferSourceDetail> GetAllClientTransferFundSources(string sourceIds, int organizationID) { try { //Array of source ids var arrIds = sourceIds.Split(','); using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; //Get all active sources var activeSources = fundSourceObjSet.Include("L_Country").Where(src => src.FK_OrganizationID == organizationID && src.IsDeleted == false && src.IsEnabled == true).ToList(); //Filter and return return(activeSources.Where(src => arrIds.Contains(src.PK_FundingSourceID.ToString())).Select(x => new FundTransferSourceDetail { PK_FundingSourceID = x.PK_FundingSourceID, BankDetail = x.BankName + " - " + x.L_Country.CountryName }).ToList()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This method updates funding source /// </summary> /// <param name="updateSource">updateSource</param> /// <returns></returns> public bool UpdateFundingSource(FundingSource updateSource) { try { using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; var source = fundSourceObjSet.Where(src => src.PK_FundingSourceID == updateSource.PK_FundingSourceID).FirstOrDefault(); if (source != null) { source.SourceName = updateSource.SourceName; source.SourceType = updateSource.SourceType; source.BankName = updateSource.BankName; source.AccountNumber = updateSource.AccountNumber; source.BicOrSwiftCode = updateSource.BicOrSwiftCode; source.FK_ReceivingBankInfoID = updateSource.FK_ReceivingBankInfoID; source.ReceivingBankInfo = updateSource.ReceivingBankInfo; source.BankAddress = updateSource.BankAddress; source.BankCity = updateSource.BankCity; source.FK_BankCountryID = updateSource.FK_BankCountryID; source.BankPostalCode = updateSource.BankPostalCode; source.InterBankName = updateSource.InterBankName; source.FK_InterBankCountryID = updateSource.FK_InterBankCountryID; source.InterBicOrSwiftCode = updateSource.InterBicOrSwiftCode; source.IncomingWireFeeAmount = updateSource.IncomingWireFeeAmount; source.OutgoingWireFeeAmount = updateSource.OutgoingWireFeeAmount; source.FK_IncomingWireFeeCurrency = updateSource.FK_IncomingWireFeeCurrency; source.FK_OutgoingWireFeeCurrency = updateSource.FK_OutgoingWireFeeCurrency; fundSourceRepo.Save(); return(true); } return(false); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); return(false); } }
/// <summary> /// This method returns list of funding sources that have not been deleted /// </summary> /// <param name="organizationID">organizationID</param> /// <returns></returns> public List <FundingSource> GetAllFundSources(int organizationID) { try { using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; return(fundSourceObjSet.Where(fnd => fnd.IsDeleted == false && fnd.FK_OrganizationID == organizationID).ToList()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
// Add your own data access methods here. If you wish to // expose your public method to a WCF service, marked them with // the attribute [NCPublish], and another T4 template will generate your service contract /// <summary> /// This method adds new Funding source info into database /// </summary> /// <param name="newFundSource">newFundSource</param> /// <returns></returns> public bool AddNewFundingSource(FundingSource newFundSource) { try { using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); //Add and save fundSourceRepo.Add(newFundSource); fundSourceRepo.Save(); return(true); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); return(false); } }
/// <summary> /// This method returns funding source details /// </summary> /// <param name="pkFundSourceID">pkFundSourceID</param> /// <returns></returns> public FundingSource GetFundingSourceDetails(int pkFundSourceID) { try { using (var unitOfWork = new EFUnitOfWork()) { var fundSourceRepo = new FundingSourceRepository(new EFRepository <FundingSource>(), unitOfWork); ObjectSet <FundingSource> fundSourceObjSet = ((CurrentDeskClientsEntities)fundSourceRepo.Repository.UnitOfWork.Context).FundingSources; //Return particular funding source return(fundSourceObjSet.Where(fnd => fnd.PK_FundingSourceID == pkFundSourceID).FirstOrDefault()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }