/// <summary>
        /// This method returns all bank accounts for a particular user
        /// </summary>
        /// <param name="accType">accType</param>
        /// <param name="userID">userID</param>
        /// <returns></returns>
        public List <BankAccountInformation> GetAllBankInfosForUser(LoginAccountType accType, int userID)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var bankRepo            = new BankAccountInformationRepository(new EFRepository <BankAccountInformation>(), unitOfWork);
                    var clientBO            = new ClientBO();
                    var introducingBrokerBO = new IntroducingBrokerBO();

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

                    //Live
                    if (accType == LoginAccountType.LiveAccount)
                    {
                        var clientInformation = clientBO.GetClientInformation(userID);
                        return(bankAccountInformationObjSet.Where(clnt => clnt.FK_ClientID == clientInformation.PK_ClientID).ToList());
                    }
                    //Partner
                    else
                    {
                        var partnerInformation = introducingBrokerBO.GetClientInformation(userID);
                        return(bankAccountInformationObjSet.Where(part => part.FK_IntroducingBrokerID == partnerInformation.PK_IntroducingBrokerID).ToList());
                    }
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Exemplo n.º 2
0
        public EntityResponse <UserLoginInformation> UserLogin(LoginAccountType accountType, string accountId, string password, PasswordUseScope useScope)
        {
            List <SZKingdomArgument> arguments = new List <SZKingdomArgument>();

            arguments.Add(SZKingdomArgument.LoginAccountType(accountType));
            arguments.Add(SZKingdomArgument.LoginAccountId(accountId));
            arguments.Add(SZKingdomArgument.PasswordUseScpose(useScope));
            arguments.Add(SZKingdomArgument.AuthenticationData(_marketDataLibrary.EncryptPassword(accountId, password)));
            arguments.Add(SZKingdomArgument.EncryptionKey(accountId));
            arguments.Add(SZKingdomArgument.EncryptionType(EncryptionType.WinEncryption));
            arguments.Add(SZKingdomArgument.AuthenticationType(AuthenticationType.Password));             // password(0) is the only AUTH_TYPE

            EntityResponse <List <UserLoginInformation> > results =
                _marketDataLibrary.ExecuteCommandList <UserLoginInformation>(SZKingdomRequest.UserLogin, arguments);

            if (results.IsSuccess)
            {
                if (results.Entity.Count >= 1)
                {
                    UserLoginInformation result = results.Entity.First();                     //.Single(u => u.StockBoard == StockBoard.SHStockOptions);
                    return(result);
                }
                return(EntityResponse <UserLoginInformation> .Error(ErrorCode.AuthenticationIncorrectIdentity, string.Format(ErrorMessages.SZKingdom_Invalid_Account, accountId)));
            }
            return(EntityResponse <UserLoginInformation> .Error(results));
        }
Exemplo n.º 3
0
        /// <summary>
        /// This Function will get the individual Username depending upon the
        /// ClientID
        /// </summary>
        /// <param name="clientID">clientID</param>
        /// <param name="accType">accType</param>
        /// <returns></returns>
        public string GetLiveIndividualName(int clientID, LoginAccountType accType)
        {
            try
            {
                using (var unitOfWork = new EFUnitOfWork())
                {
                    var individualDetailsRepo =
                        new IndividualAccountInformationRepository(new EFRepository <IndividualAccountInformation>(), unitOfWork);

                    ObjectSet <IndividualAccountInformation> individualObjSet =
                        ((CurrentDeskClientsEntities)individualDetailsRepo.Repository.UnitOfWork.Context).IndividualAccountInformations;

                    if (accType == LoginAccountType.LiveAccount)
                    {
                        var res = individualObjSet.Where(ind => ind.FK_ClientID == clientID).FirstOrDefault();
                        return(res != null ? res.FirstName + " " + res.LastName : null);
                    }
                    else if (accType == LoginAccountType.PartnerAccount)
                    {
                        var res = individualObjSet.Where(ind => ind.FK_IntroducingBrokerID == clientID).FirstOrDefault();
                        return(res != null ? res.FirstName + " " + res.LastName : null);
                    }
                    return(string.Empty);
                }
            }
            catch (Exception ex)
            {
                CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
                throw;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method creates new user account in meta trader
        /// </summary>
        /// <param name="newUser"></param>
        /// <returns></returns>
        public static bool CreateMetaTraderAccountForUser(int pkClientAccID, int?fkPlatformID, User newUser, LoginAccountType accType)
        {
            try
            {
                var user = new MT4ManLibraryNETv03.UserRecordNET();
                user.group    = "FQ-IB-One";
                user.name     = newUser.UserEmailID;
                user.password = "******";

                var manager = new MetaTraderWrapperManager("mtdem01.primexm.com:443", 900, "!FQS123!!");
                if (manager.IsConnected() == 1)
                {
                    var accStatus = manager.CreateNewUser(user);

                    //If success
                    if (accStatus == 0)
                    {
                        var clientAccBO = new Client_AccountBO();
                        clientAccBO.InsertPlatformLoginForTradingAccount(pkClientAccID, fkPlatformID, user.password, user.login);
                        return(true);
                    }
                    else
                    {
                        var error = manager.ErrorDescription(accStatus);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                CurrentDeskLog.Error(ex.Message, ex);
                throw;
            }
        }