示例#1
0
        private void FixupIntroducingBroker(IntroducingBroker previousValue)
        {
            if (previousValue != null && previousValue.R_AssetManager_IntroducingBroker_ClientAccount.Contains(this))
            {
                previousValue.R_AssetManager_IntroducingBroker_ClientAccount.Remove(this);
            }


            if (IntroducingBroker != null)
            {
                if (!IntroducingBroker.R_AssetManager_IntroducingBroker_ClientAccount.Contains(this))
                {
                    IntroducingBroker.R_AssetManager_IntroducingBroker_ClientAccount.Add(this);
                }

                if (FK_IBID != IntroducingBroker.PK_IntroducingBrokerID)

                {
                    FK_IBID = IntroducingBroker.PK_IntroducingBrokerID;
                }
            }

            else if (!_settingFK)

            {
                FK_IBID = null;
            }
        }
示例#2
0
        private void FixupIntroducingBroker(IntroducingBroker previousValue)
        {
            if (previousValue != null && previousValue.TrustAccountInformations.Contains(this))
            {
                previousValue.TrustAccountInformations.Remove(this);
            }


            if (IntroducingBroker != null)
            {
                if (!IntroducingBroker.TrustAccountInformations.Contains(this))
                {
                    IntroducingBroker.TrustAccountInformations.Add(this);
                }

                if (FK_IntroducingBrokerID != IntroducingBroker.PK_IntroducingBrokerID)

                {
                    FK_IntroducingBrokerID = IntroducingBroker.PK_IntroducingBrokerID;
                }
            }

            else if (!_settingFK)

            {
                FK_IntroducingBrokerID = null;
            }
        }
示例#3
0
        private void FixupIntroducingBroker(IntroducingBroker previousValue)
        {
            if (previousValue != null && previousValue.R_Employee_IntroducingBroker.Contains(this))
            {
                previousValue.R_Employee_IntroducingBroker.Remove(this);
            }


            if (IntroducingBroker != null)
            {
                if (!IntroducingBroker.R_Employee_IntroducingBroker.Contains(this))
                {
                    IntroducingBroker.R_Employee_IntroducingBroker.Add(this);
                }

                if (FK_IBID != IntroducingBroker.PK_IntroducingBrokerID)

                {
                    FK_IBID = IntroducingBroker.PK_IntroducingBrokerID;
                }
            }

            else if (!_settingFK)

            {
                FK_IBID = null;
            }
        }
        private void FixupIntroducingBroker1(IntroducingBroker previousValue)
        {
            if (previousValue != null && previousValue.R_IntroducingBroker_IntroducingBroker1.Contains(this))
            {
                previousValue.R_IntroducingBroker_IntroducingBroker1.Remove(this);
            }


            if (IntroducingBroker1 != null)
            {
                if (!IntroducingBroker1.R_IntroducingBroker_IntroducingBroker1.Contains(this))
                {
                    IntroducingBroker1.R_IntroducingBroker_IntroducingBroker1.Add(this);
                }

                if (FK_IntroducingBrokerParentID != IntroducingBroker1.PK_IntroducingBrokerID)

                {
                    FK_IntroducingBrokerParentID = IntroducingBroker1.PK_IntroducingBrokerID;
                }
            }

            else if (!_settingFK)

            {
                FK_IntroducingBrokerParentID = null;
            }
        }
        /// <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;
            }
        }
        private void FixupIntroducingBroker(IntroducingBroker previousValue)
        {
            if (previousValue != null && previousValue.BOMAMTrades.Contains(this))
            {
                previousValue.BOMAMTrades.Remove(this);
            }


            if (IntroducingBroker != null)
            {
                if (!IntroducingBroker.BOMAMTrades.Contains(this))
                {
                    IntroducingBroker.BOMAMTrades.Add(this);
                }

                if (FK_IBID != IntroducingBroker.PK_IntroducingBrokerID)

                {
                    FK_IBID = IntroducingBroker.PK_IntroducingBrokerID;
                }
            }
        }
示例#7
0
 public void Delete(IntroducingBroker entity)
 {
     Repository.Delete(entity);
 }
示例#8
0
 public void Add(IntroducingBroker entity)
 {
     Repository.Add(entity);
 }
示例#9
0
        /// <summary>
        /// This action creates new account number for partner user after successful
        /// registration and inserts into ClientAccounts table
        /// </summary>
        /// <param name="newIB"></param>
        public static int CreateAccountNumberForPartnerUser(IntroducingBroker newIB)
        {
            try
            {
                var tradingAccountNumber   = string.Empty;
                var landingAccountNumber   = string.Empty;
                var landingAccCurrencyCode = string.Empty;
                var lAccNumber             = 0L;

                //Get organization id from session
                var organizationID = (int)SessionManagement.OrganizationID;

                var rulelist    = accountCreationRuleBO.GetRule(organizationID).OrderBy(c => c.Position);
                var currencyID  = curencyBO.GetCurrencyLookUpID(newIB.FK_AccountCurrencyID);
                var currAccCode = currencyBO.GetCurrencyAccountCode(currencyID);

                //Iterating through each rule/steps of account creation
                foreach (var item in rulelist)
                {
                    //Currency
                    if (item.Meaning == Constants.K_ACC_RULE_CURRENCY)
                    {
                        tradingAccountNumber += currAccCode + "-";
                        landingAccountNumber += currAccCode + "-";
                    }
                    //Account Number Belonging to that Currency
                    else if (item.Meaning == Constants.K_ACC_RULE_CURR_NUMBER)
                    {
                        var template        = item.Template;
                        var tradingAccCount = clientAccBO.GetNumberOfSameCurrencyTradingAccountForUser(LoginAccountType.PartnerAccount, newIB.PK_IntroducingBrokerID, currencyID);
                        tradingAccountNumber += (tradingAccCount + 1).ToString("D" + template.Length) + "-";

                        //Required for creating landing account
                        for (var ctDigit = 0; ctDigit < template.Length; ctDigit++)
                        {
                            landingAccCurrencyCode += "0";
                        }
                        landingAccountNumber += landingAccCurrencyCode + "-";
                    }
                    //Client Account Number
                    else if (item.Meaning == Constants.K_ACC_RULE_ACC_NUMBER)
                    {
                        var template          = item.Template;
                        var existingAccNumber = clientAccBO.GetUserExistingAccountNumber(LoginAccountType.PartnerAccount, newIB.PK_IntroducingBrokerID);
                        var latestAccNumber   = clientAccBO.GetLatestAccountNumber(organizationID);

                        //If no previous account exists for the user
                        if (existingAccNumber == "")
                        {
                            //If any acc number exists in db
                            if (latestAccNumber != "")
                            {
                                lAccNumber            = Convert.ToInt64(latestAccNumber);
                                tradingAccountNumber += (lAccNumber + 1).ToString("D" + template.Length) + "-";
                                landingAccountNumber += (lAccNumber + 1).ToString("D" + template.Length) + "-";
                                lAccNumber++;
                            }
                            //If no acc number exists in db
                            else
                            {
                                lAccNumber            = 1;
                                tradingAccountNumber += lAccNumber.ToString("D" + template.Length) + "-";
                                landingAccountNumber += lAccNumber.ToString("D" + template.Length) + "-";
                            }
                        }
                        //If user has acc number in system
                        else
                        {
                            tradingAccountNumber += existingAccNumber.Split('-')[((int)item.Position - 1)] + "-";
                            landingAccountNumber += existingAccNumber.Split('-')[((int)item.Position - 1)] + "-";
                            lAccNumber            = Convert.ToInt64(existingAccNumber.Split('-')[((int)item.Position - 1)]);
                        }
                    }
                }

                //Insert client account information in ClientAccounts table
                return(clientAccBO.InsertAccountNumberForUser(LoginAccountType.PartnerAccount, newIB.PK_IntroducingBrokerID, newIB.FK_AccountID, currencyID, landingAccountNumber.TrimEnd('-'), tradingAccountNumber.TrimEnd('-'), lAccNumber, organizationID));
            }
            catch (Exception ex)
            {
                CurrentDeskLog.Error(ex.Message, ex);
                throw;
            }
        }