Пример #1
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);
            }
        }
Пример #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);
            }
        }
 /// <summary>
 /// This method gets all account number creation rules rows
 /// </summary>
 /// <returns></returns>
 public List <AccountCreationRule> GetRule()
 {
     try
     {
         using (var unitOfWork = new EFUnitOfWork())
         {
             var accountCreationRuleRepo =
                 new AccountCreationRuleRepository(new EFRepository <AccountCreationRule>(), unitOfWork);
             return(accountCreationRuleRepo.All().ToList());
         }
     }
     catch (Exception ex)
     {
         CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
         throw;
     }
 }
Пример #4
0
        /// <summary>
        /// This function will insert new Error
        /// </summary>
        /// <returns></returns>
        public void AddNewError(ErrorLog newError)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var errorLogRepo =
                        new ErrorLogRepository(new EFRepository <ErrorLog>(), unitOfWork);

                    errorLogRepo.Add(newError);
                    errorLogRepo.Save();
                }
            }
            catch (Exception ex)
            {
                //Send mail
            }
        }
        /// <summary>
        /// This method gets cfd trade volume for a particular day
        /// </summary>
        /// <param name="introducingBrokerID">introducingBrokerID</param>
        /// <param name="fromDate">fromDate</param>
        /// <param name="toDate">toDate</param>
        /// <returns></returns>
        public double GetCFDTradesVolumeByDay(int introducingBrokerID, long fromDate, long toDate)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var ibRepo =
                        new IntroducingBrokerRepository(new EFRepository <IntroducingBroker>(), unitOfWork);

                    return(((CurrentDeskClientsEntities)ibRepo.Repository.UnitOfWork.Context).GetCFDTradesVolumeByDay(introducingBrokerID, fromDate, toDate).FirstOrDefault() ?? 0);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #6
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



        public void UpdateMargin(Margin newMargin)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var marginRepo =
                        new MarginRepository(new EFRepository <Margin>(), unitOfWork);


                    ObjectSet <Margin> marginObj =
                        ((CurrentDeskClientsEntities)marginRepo.Repository.UnitOfWork.Context).Margins;


                    //Check existing margin
                    var dbMargin = marginObj.Where(m => m.Login == newMargin.Login).FirstOrDefault();
                    if (dbMargin == null)
                    {
                        marginRepo.Add(newMargin);
                    }
                    else
                    {
                        dbMargin.Login       = newMargin.Login;
                        dbMargin.Group       = newMargin.Group;
                        dbMargin.Leverage    = newMargin.Leverage;
                        dbMargin.Updated     = newMargin.Updated;
                        dbMargin.Balance     = newMargin.Balance;
                        dbMargin.Equity      = newMargin.Equity;
                        dbMargin.Volume      = newMargin.Volume;
                        dbMargin.Margin1     = newMargin.Margin1;
                        dbMargin.MarginFree  = newMargin.MarginFree;
                        dbMargin.MarginLevel = newMargin.MarginLevel;
                        dbMargin.MarginType  = newMargin.MarginType;
                        dbMargin.LevelType   = newMargin.LevelType;
                    }

                    marginRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
        }
Пример #7
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 function will insert new partner spread details in PartnerCommission table
        /// </summary>
        /// <returns></returns>
        public void AddNewPartnerSpread(PartnerCommission partComm)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var partCommRepo =
                        new PartnerCommissionRepository(new EFRepository <PartnerCommission>(), unitOfWork);

                    partCommRepo.Add(partComm);
                    partCommRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #8
0
        /// <summary>
        /// This Function Will get all the open trades related to the list of asset manager.
        /// </summary>
        /// <param name="loginIDList">AssetManager Platform LoginIDList</param>
        /// <param name="lastProcessedID">Last Processed ID</param>
        /// <returns>List of Open Trades</returns>
        public List <Trade> GetAssetManagerOpenTrades(List <int> loginIDList, int lastProcessedID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var tradeRepo =
                        new TradeRepository(new EFRepository <Trade>(), unitOfWork);

                    return(((CurrentDeskClientsEntities)tradeRepo.Repository.UnitOfWork.Context).Trades.
                           Where(x => loginIDList.Contains((int)x.Login) && x.PK_TradeID > lastProcessedID).OrderBy(x => x.PK_TradeID).ToList());
                }
            }
            catch (Exception exceptionMessage)
            {
                CommonErrorLogger.CommonErrorLog(exceptionMessage, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(null);
            }
        }
Пример #9
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 gets all trades from Trades table
        /// </summary>
        /// <returns></returns>
        public List <Trade> GetAllTrades()
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var tradeRepo =
                        new TradeRepository(new EFRepository <Trade>(), unitOfWork);

                    //Returning List Of Trades
                    return(tradeRepo.All().ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #10
0
        /// <summary>
        /// Add a new trade
        /// </summary>
        /// <param name="trade"></param>
        public void AddTrade(Trade trade)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var tradeRepo =
                        new TradeRepository(new EFRepository <Trade>(), unitOfWork);

                    tradeRepo.Add(trade);

                    tradeRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
        }
        // 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 or updates new transaction settings
        /// </summary>
        /// <param name="setting">setting</param>
        /// <returns></returns>
        public bool AddOrUpdateTransactionSetting(TransactionSetting setting)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var transactionSettingRepo =
                        new TransactionSettingRepository(new EFRepository <TransactionSetting>(), unitOfWork);

                    ObjectSet <TransactionSetting> transactionSettingObjSet =
                        ((CurrentDeskClientsEntities)transactionSettingRepo.Repository.UnitOfWork.Context).TransactionSettings;

                    //Get present setting from db
                    var dbSetting = transactionSettingObjSet.Where(sett => sett.FK_AdminTransactionTypeID == setting.FK_AdminTransactionTypeID && sett.FK_OrganizationID == setting.FK_OrganizationID).FirstOrDefault();

                    //If settings present in db
                    if (dbSetting != null)
                    {
                        dbSetting.FK_CurrencyID                   = setting.FK_CurrencyID;
                        dbSetting.MinimumDepositAmount            = setting.MinimumDepositAmount;
                        dbSetting.TransferFee                     = setting.TransferFee;
                        dbSetting.InternalTransferApprovalOptions = setting.InternalTransferApprovalOptions;
                        dbSetting.InternalTransferLimitedAmount   = setting.InternalTransferLimitedAmount;
                        dbSetting.MarginRestriction               = setting.MarginRestriction;
                        dbSetting.ConversionMarkupType            = setting.ConversionMarkupType;
                        dbSetting.ConversionMarkupValue           = setting.ConversionMarkupValue;
                    }
                    else
                    {
                        transactionSettingRepo.Add(setting);
                    }

                    //Save and return true
                    transactionSettingRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
        /// <summary>
        /// This Function will get last closed trade ProcessedID
        /// </summary>
        /// <returns></returns>
        public int GetLastClosedTradeProcessedID()
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var boMAMTradeRepo =
                        new BOMAMTradeRepository(new EFRepository <BOMAMTrade>(), unitOfWork);

                    return(((CurrentDeskClientsEntities)boMAMTradeRepo.Repository.UnitOfWork.Context).
                           BOMAMTrades.Where(trade => trade.IsopenTrades == false).Max(trade => trade.LastIDProcessed));
                }
            }
            catch (Exception exceptionMessage)
            {
                CommonErrorLogger.CommonErrorLog(exceptionMessage, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(0);
            }
        }
Пример #13
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 function will insert new user into Users table
        /// </summary>
        /// <returns></returns>
        public void AddNewUser(User newUser)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var userRepo =
                        new UserRepository(new EFRepository <User>(), unitOfWork);

                    userRepo.Add(newUser);
                    userRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #14
0
        /// <summary>
        /// This Function Will return all the selected Currency
        /// </summary>
        /// <returns></returns>
        public List <L_Languages> GetLanguages()
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var languageRepo =
                        new L_LanguagesRepository(new EFRepository <L_Languages>(), unitOfWork);

                    //Return all the languages
                    return(languageRepo.All().ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #15
0
        /// <summary>
        /// This function will insert individual account details for new client
        /// </summary>
        /// <param name="newClient">newClient</param>
        public void AddIndividualAccDetailsForNewClient(IndividualAccountInformation newClient)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var individualDetailsRepo =
                        new IndividualAccountInformationRepository(new EFRepository <IndividualAccountInformation>(), unitOfWork);

                    individualDetailsRepo.Add(newClient);
                    individualDetailsRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #16
0
        public void InsertPrice(List <Price> lstPrice)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var priceRepo =
                        new PriceRepository(new EFRepository <Price>(), unitOfWork);


                    ObjectSet <Price> priceObj =
                        ((CurrentDeskClientsEntities)priceRepo.Repository.UnitOfWork.Context).Prices;

                    var lstSymbole = lstPrice.Select(s => s.Symbole).ToList();

                    //Get the existing price from DB and update with New DB
                    var lstDBPrice = priceObj.Where(p => lstSymbole.Contains(p.Symbole)).ToList();
                    foreach (var uPrice in lstDBPrice)
                    {
                        var newPrice = lstPrice.Where(s => s.Symbole == uPrice.Symbole.Trim()).FirstOrDefault();
                        if (newPrice != null)
                        {
                            uPrice.Ask = newPrice.Ask;
                            uPrice.Bid = newPrice.Bid;
                        }
                    }

                    //Add new price
                    var lstDBPriceSymbole = lstDBPrice.Select(p => p.Symbole.Trim()).ToList();
                    var newPricesToAdd    = lstPrice.Where(lp => !lstDBPriceSymbole.Contains(lp.Symbole)).Distinct().ToList();
                    foreach (var price in newPricesToAdd)
                    {
                        priceRepo.Add(price);
                    }

                    priceRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
        }
Пример #17
0
        /// <summary>
        /// This Function Will return all the demo Leads
        /// </summary>
        /// <returns></returns>
        public List <DemoLead> GetDemoLeads()
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var demoLeadRepo =
                        new DemoLeadRepository(new EFRepository <DemoLead>(), unitOfWork);

                    //Returning List Of Demo Lead
                    return(demoLeadRepo.All().ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This method returns all Commission increment entries from db
        /// </summary>
        /// <returns></returns>
        public List <L_CommissionIncrementValue> GetCommissionIncrementValues()
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var lCommissionIncrementValueRepo =
                        new L_CommissionIncrementValueRepository(new EFRepository <L_CommissionIncrementValue>(), unitOfWork);

                    //Returning List Of Demo Lead
                    return(lCommissionIncrementValueRepo.All().ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This function will insert introducing broker details
        /// </summary>
        /// <param name="newIB">newIB</param>
        public void AddIntroducingBrokerDetails(IntroducingBroker newIB)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var IBDetailsRepo =
                        new IntroducingBrokerRepository(new EFRepository <IntroducingBroker>(), unitOfWork);

                    IBDetailsRepo.Add(newIB);
                    IBDetailsRepo.Save();
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #20
0
        /// <summary>
        /// Get Connection string
        /// </summary>
        /// <returns></returns>
        public string GetConnectionString()
        {
            string strConnection = string.Empty;

            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var context = (CurrentDeskClientsEntities)unitOfWork.Context;
                    strConnection = ((EntityConnection)context.Connection).StoreConnection.ConnectionString;
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            return(strConnection);
        }
        /// <summary>
        /// This method returns list of clients transactions of particular type
        /// </summary>
        /// <param name="clientIds">clientIds</param>
        /// <param name="transactionType">transactionType</param>
        /// <param name="organizationID">organizationID</param>
        /// <returns></returns>
        public List <AdminTransaction> GetAllClientsTransactionOfParticulaType(string clientIds, int transactionType, int organizationID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var adminTransactionRepo =
                        new AdminTransactionRepository(new EFRepository <AdminTransaction>(), unitOfWork);

                    ObjectSet <AdminTransaction> transactionObjSet =
                        ((CurrentDeskClientsEntities)adminTransactionRepo.Repository.UnitOfWork.Context)
                        .AdminTransactions;

                    var allTransactions = transactionObjSet.Where(tran => tran.IsDeleted == false && tran.FK_OrganizationID == organizationID).ToList();

                    //All pending transactions
                    var allPendingTransactions =
                        allTransactions.Where(
                            transaction => clientIds.Contains(transaction.FK_UserID.ToString()) &&
                            transaction.FK_AdminTransactionTypeID == transactionType &&
                            transaction.IsApproved == false)
                        .OrderByDescending(tran => tran.TransactionDate)
                        .ToList();

                    //Latest 5 approved transactions
                    var latestApprovedTransactions =
                        allTransactions.Where(
                            tran => clientIds.Contains(tran.FK_UserID.ToString()) &&
                            tran.FK_AdminTransactionTypeID == transactionType &&
                            tran.IsApproved == true).OrderByDescending(odr => odr.ApprovedDate).Take(5).ToList();

                    allPendingTransactions.AddRange(latestApprovedTransactions);

                    return(allPendingTransactions.OrderByDescending(odr => odr.TransactionDate).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 fund account request in AdminTransaction table
        /// </summary>
        /// <param name="newRequest">newRequest</param>
        /// <returns></returns>
        public bool AddNewAdminTransactionRequest(AdminTransaction newRequest)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var adminTransactionRepo =
                        new AdminTransactionRepository(new EFRepository <AdminTransaction>(), unitOfWork);

                    adminTransactionRepo.Add(newRequest);
                    adminTransactionRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
        /// <summary>
        /// This Function will calculate all the pnl
        /// and return it Slave Account
        /// </summary>
        /// <param name="clientAccountID">clientAccountID</param>
        /// <returns>sum of pnl</returns>
        public double GetProfitSummation(int clientAccountID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var boMAMTradeRepo =
                        new BOMAMTradeRepository(new EFRepository <BOMAMTrade>(), unitOfWork);

                    return
                        (((CurrentDeskClientsEntities)boMAMTradeRepo.Repository.UnitOfWork.Context).BOMAMTrades.
                         Where(act => act.FK_ClientAccountID == clientAccountID && act.IsopenTrades == true).Sum(act => act.Pnl + act.Commission + act.Swap) ?? 0);
                }
            }
            catch (Exception exceptionMessage)
            {
                CommonErrorLogger.CommonErrorLog(exceptionMessage, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(0);
            }
        }
Пример #24
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 managed account program for Asset Manager
        /// </summary>
        /// <param name="program"></param>
        /// <returns></returns>
        public bool AddNewManagedAccount(ManagedAccountProgram program)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var accProgramRepo =
                        new ManagedAccountProgramRepository(new EFRepository <ManagedAccountProgram>(), unitOfWork);

                    accProgramRepo.Add(program);
                    accProgramRepo.Save();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
        /// <summary>
        /// This method returns bank account details based on pkBankID
        /// </summary>
        /// <param name="pkBankInfoID">pkBankInfoID</param>
        /// <returns></returns>
        public BankAccountInformation GetBankAccountDetails(int pkBankInfoID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var bankRepo = new BankAccountInformationRepository(new EFRepository <BankAccountInformation>(), unitOfWork);

                    ObjectSet <BankAccountInformation> bankAccountInformationObjSet =
                        ((CurrentDeskClientsEntities)bankRepo.Repository.UnitOfWork.Context).BankAccountInformations;

                    return(bankAccountInformationObjSet.Where(bnk => bnk.PK_BankAccountInformationID == pkBankInfoID).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #26
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 agent information
        /// </summary>
        /// <param name="newAgent">newAgent</param>
        /// <param name="introducingBrokerUserID">introducingBrokerUserID</param>
        /// <returns></returns>
        public bool AddNewAgent(Agent newAgent, int introducingBrokerUserID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var agentRepo =
                        new AgentRepository(new EFRepository <Agent>(), unitOfWork);

                    ObjectSet <Agent> agentObjSet =
                        ((CurrentDeskClientsEntities)agentRepo.Repository.UnitOfWork.Context).Agents;

                    //Get number of agents under this IB
                    var highestAgent = agentObjSet.Where(agnt => agnt.FK_IntroducingBrokerUserID == introducingBrokerUserID).OrderByDescending(agnt => agnt.AgentIntroducingBrokerCode).FirstOrDefault();

                    //If IB has agents
                    if (highestAgent != null)
                    {
                        newAgent.AgentIntroducingBrokerCode = highestAgent.AgentIntroducingBrokerCode + 1;
                    }
                    //If no agents under this IB
                    else
                    {
                        newAgent.AgentIntroducingBrokerCode = 1;
                    }

                    newAgent.FK_IntroducingBrokerUserID = introducingBrokerUserID;
                    newAgent.IsActive = true;

                    agentRepo.Add(newAgent);
                    agentRepo.Save();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                return(false);
            }
        }
Пример #27
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 returns user document details
        /// </summary>
        /// <param name="userID">userID</param>
        /// <param name="docID">docID</param>
        /// <returns></returns>
        public UserDocument GetUserDocumentDetails(int userID, int docID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var userDocRepo =
                        new UserDocumentRepository(new EFRepository <UserDocument>(), unitOfWork);

                    ObjectSet <UserDocument> userDocObjSet =
                        ((CurrentDeskClientsEntities)userDocRepo.Repository.UnitOfWork.Context).UserDocuments;

                    return(userDocObjSet.Include("Document").Where(doc => doc.FK_UserID == userID && doc.FK_DocumentID == docID && doc.IsDeleted == false).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This method returns list of all incoming fund transfer request
        /// </summary>
        /// <returns></returns>
        public List <AdminTransaction> GetAllIncomingFundRequests(int organizationID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var adminTransactionRepo =
                        new AdminTransactionRepository(new EFRepository <AdminTransaction>(), unitOfWork);

                    ObjectSet <AdminTransaction> transactionObjSet =
                        ((CurrentDeskClientsEntities)adminTransactionRepo.Repository.UnitOfWork.Context).AdminTransactions;

                    return(transactionObjSet.Include("FundingSource").Where(transaction => transaction.FK_AdminTransactionTypeID == (int)AdminTransactionType.IncomingFunds && transaction.FK_OrganizationID == organizationID && transaction.IsApproved == false && transaction.IsDeleted == false).ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
        /// <summary>
        /// This method returns sum of pending transfer request amount for an account
        /// </summary>
        /// <param name="accountNumber">accountNumber</param>
        /// <param name="organizationID">organizationID</param>
        /// <returns></returns>
        public decimal GetPendingTransferAmount(string accountNumber, int organizationID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var adminTransactionRepo =
                        new AdminTransactionRepository(new EFRepository <AdminTransaction>(), unitOfWork);

                    ObjectSet <AdminTransaction> transactionObjSet =
                        ((CurrentDeskClientsEntities)adminTransactionRepo.Repository.UnitOfWork.Context).AdminTransactions;

                    return((decimal)transactionObjSet.Where(tran => tran.AccountNumber == accountNumber && tran.FK_OrganizationID == organizationID && (tran.FK_AdminTransactionTypeID == (int)AdminTransactionType.InternalTransfers || tran.FK_AdminTransactionTypeID == (int)AdminTransactionType.ConversionsRequests) && tran.IsApproved == false && tran.IsDeleted == false).ToList().Sum(tran => tran.TransactionAmount));
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Пример #30
0
        /// <summary>
        /// This method returns all agents under a particular IB
        /// </summary>
        /// <param name="introducingBrokerUserID">introducingBrokerUserID</param>
        /// <returns></returns>
        public List <Agent> GetAllAgentsOfIB(int introducingBrokerUserID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var agentRepo =
                        new AgentRepository(new EFRepository <Agent>(), unitOfWork);

                    ObjectSet <Agent> agentObjSet =
                        ((CurrentDeskClientsEntities)agentRepo.Repository.UnitOfWork.Context).Agents;

                    return(agentObjSet.Where(agnt => agnt.FK_IntroducingBrokerUserID == introducingBrokerUserID).ToList());
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }