示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        // 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);
            }
        }