示例#1
0
        /// <summary>
        /// This methods string of funding source ids belonging
        /// to a particular currency
        /// </summary>
        /// <param name="currId">currId</param>
        /// <returns></returns>
        public string GetAllTransferFundingSourceOfParticularCurrency(int currId)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var sourceAcceptedCurrRepo =
                        new FundingSourceAcceptedCurrencyRepository(new EFRepository <FundingSourceAcceptedCurrency>(),
                                                                    unitOfWork);

                    ObjectSet <FundingSourceAcceptedCurrency> acceptedCurrObjSet =
                        ((CurrentDeskClientsEntities)sourceAcceptedCurrRepo.Repository.UnitOfWork.Context)
                        .FundingSourceAcceptedCurrencies;
                    string returnStr = String.Empty;

                    //Get all ids of source of a currency
                    var acceptedSource = acceptedCurrObjSet.Where(src => src.IsDeleted == false && (src.FK_LCurrencyValueID == currId || src.FK_LCurrencyValueID == 6))
                                         .GroupBy(s => s.FK_FundingSourceID)
                                         .Select(a => new CurrencyFundingSource {
                        ID = (int)a.Key
                    }).ToList();
                    foreach (var res in acceptedSource)
                    {
                        returnStr += res.ID + ",";
                    }

                    return(returnStr.TrimEnd(','));
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
示例#2
0
        /// <summary>
        /// This method returns string of accepted currencies of funding source
        /// </summary>
        /// <param name="pkFundingSourceID">pkFundingSourceID</param>
        /// <returns></returns>
        public string GetAllAcceptedCurrenciesofSource(int pkFundingSourceID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    string            strAcceptedCurrencies = String.Empty;
                    L_CurrencyValueBO lCurrValueBO          = new L_CurrencyValueBO();

                    var sourceAcceptedCurrRepo =
                        new FundingSourceAcceptedCurrencyRepository(new EFRepository <FundingSourceAcceptedCurrency>(), unitOfWork);

                    ObjectSet <FundingSourceAcceptedCurrency> acceptedCurrObjSet =
                        ((CurrentDeskClientsEntities)sourceAcceptedCurrRepo.Repository.UnitOfWork.Context).FundingSourceAcceptedCurrencies;

                    //Get all currencies
                    var acceptedCurrencies = acceptedCurrObjSet.Where(curr => curr.FK_FundingSourceID == pkFundingSourceID && curr.IsDeleted == false).ToList();

                    //Make string of currencies comma separated
                    foreach (var curr in acceptedCurrencies)
                    {
                        strAcceptedCurrencies += lCurrValueBO.GetCurrencySymbolFromID((int)curr.FK_LCurrencyValueID) + ", ";
                    }

                    return(strAcceptedCurrencies.TrimEnd(' ').TrimEnd(','));
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(String.Empty);
            }
        }
示例#3
0
        /// <summary>
        /// This method updates funding source accepted currencies
        /// </summary>
        /// <param name="pkFundingSourceID">pkFundingSourceID</param>
        /// <param name="acceptedCurr">acceptedCurr</param>
        /// <returns></returns>
        public bool UpdateFundingSourceAcceptedCurrency(int pkFundingSourceID, string acceptedCurr)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    //Get array of currencies
                    var allCurr = acceptedCurr.Split(',');
                    int parseResult;

                    var sourceAcceptedCurrRepo =
                        new FundingSourceAcceptedCurrencyRepository(new EFRepository <FundingSourceAcceptedCurrency>(), unitOfWork);

                    ObjectSet <FundingSourceAcceptedCurrency> acceptedCurrObjSet =
                        ((CurrentDeskClientsEntities)sourceAcceptedCurrRepo.Repository.UnitOfWork.Context).FundingSourceAcceptedCurrencies;

                    //Get old records and set IsDelete true
                    var oldRecords = acceptedCurrObjSet.Where(curr => curr.FK_FundingSourceID == pkFundingSourceID).ToList();
                    foreach (var record in oldRecords)
                    {
                        record.IsDeleted = true;
                    }

                    //Insert to repo for each currency
                    foreach (var curr in allCurr)
                    {
                        if (Int32.TryParse(curr, out parseResult))
                        {
                            FundingSourceAcceptedCurrency fundAcceptedCurr = new FundingSourceAcceptedCurrency();
                            fundAcceptedCurr.FK_FundingSourceID  = pkFundingSourceID;
                            fundAcceptedCurr.FK_LCurrencyValueID = Convert.ToInt32(curr);
                            fundAcceptedCurr.IsDeleted           = false;

                            sourceAcceptedCurrRepo.Add(fundAcceptedCurr);
                        }
                    }

                    //Save
                    sourceAcceptedCurrRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
示例#4
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 inserts each row for various currency accepted by funding source
        /// </summary>
        /// <param name="pkFundingSourceID"></param>
        /// <param name="acceptedCurr"></param>
        /// <returns></returns>
        public bool AddFundingSourceAcceptedCurrency(int pkFundingSourceID, string acceptedCurr)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var sourceAcceptedCurrRepo =
                        new FundingSourceAcceptedCurrencyRepository(new EFRepository <FundingSourceAcceptedCurrency>(), unitOfWork);

                    //Get array of currencies
                    var allCurr = acceptedCurr.Split(',');
                    int parseResult;

                    //Insert to repo for each currency
                    foreach (var curr in allCurr)
                    {
                        if (Int32.TryParse(curr, out parseResult))
                        {
                            FundingSourceAcceptedCurrency fundAcceptedCurr = new FundingSourceAcceptedCurrency();
                            fundAcceptedCurr.FK_FundingSourceID  = pkFundingSourceID;
                            fundAcceptedCurr.FK_LCurrencyValueID = Convert.ToInt32(curr);
                            fundAcceptedCurr.IsDeleted           = false;

                            sourceAcceptedCurrRepo.Add(fundAcceptedCurr);
                        }
                    }

                    //Save
                    sourceAcceptedCurrRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }