/// <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; } }
/// <summary> /// This method adds new bank account for Live user /// </summary> /// <param name="userID">userID</param> /// <param name="bankAccountInformation">bankAccountInformation</param> /// <returns></returns> public bool AddNewLiveBankAccountInformation(int userID, BankAccountInformation bankAccountInformation) { try { using (var unitOfWork = new EFUnitOfWork()) { var bankRepo = new BankAccountInformationRepository(new EFRepository <BankAccountInformation>(), unitOfWork); var clientBO = new ClientBO(); var clientInformation = clientBO.GetClientInformation(userID); bankAccountInformation.FK_ClientID = clientInformation.PK_ClientID; bankRepo.Add(bankAccountInformation); bankRepo.Save(); return(true); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }