public SearchResult SearchSecurities(string searchString)
        {
            SearchResult retList = new SearchResult {
                HouseholdList = null, ProposalsList = null, secList = new List <SecBasicData>()
            };
            List <string> searchStrings = searchString.ToUpper().Split(',').ToList <string>();

            string sql = SqlConstants.SearchSecurities;

            sql = _dbWrapper.BuildSqlInClauseQuery(searchStrings, ":REPLACE_SEARCH_KEYS", sql);
            IEnumerable <IDataRecord> records = _dbWrapper.QueryDataRecord(cmd =>
            {
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = sql;
                _dbWrapper.BuildParamInClauseQuery(searchStrings, "REPLACE_SEARCH_KEYS", cmd);
            }, _context.Identity.InstitutionId);

            foreach (var row in records)
            {
                SecBasicData secDataInfo = new SecBasicData();
                secDataInfo.SecID    = row["SEC_ID"].ToString();;
                secDataInfo.SecType  = row["SECURITY_TYPE"].ToString();
                secDataInfo.Name     = row["SECURITY_NAME"].ToString();
                secDataInfo.CusipNum = row["CUSIP"].ToString();
                secDataInfo.MFID     = row["TA_ID"].ToString();
                secDataInfo.Ticker   = row["SYMBOL"].ToString();
                secDataInfo.SecNo    = row["SEC_NO"].ToString();
                secDataInfo.CogID    = row["COG_ID"].ToString();
                //if (useSpecialFactsheetHandling && secDataInfo.SecType == "MA")
                //{
                //    if (!string.IsNullOrEmpty(row["PERSON_ID"].ToString(); FACTSHEET_FILE_NAME)))
                //    {
                //        secDataInfo.DisplayFactSheetLink = true;
                //    }
                //}
                //else
                //    if (!string.IsNullOrEmpty(secDataInfo.CogID)) secDataInfo.DisplayFactSheetLink = true;
                secDataInfo.Price       = row["LAST_CLOSE_PRICE"].ToString();
                secDataInfo.PriceFactor = row["PRICE_FACTOR"].ToString();
                secDataInfo.SubType     = row["SUB_TYPE"].ToString();
                retList.secList.Add(secDataInfo);
            }

            return(retList);
        }
        private List <Team> GetParentTeams(List <Team> listOfTeam)
        {
            List <Team> parentTeams = new List <Team>();

            if (listOfTeam.Count == 0)
            {
                return(null);
            }
            List <string> teamIDList = new List <string>();

            foreach (Team team in listOfTeam)
            {
                teamIDList.Add(team.TeamId);
            }
            string sql = SqlConstants.GET_Parent_Teams;

            sql = _dbWrapper.BuildSqlInClauseQuery(teamIDList, ":TEAM_IDS", sql);
            IEnumerable <IDataRecord> records = _dbWrapper.QueryDataRecord(cmd =>
            {
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = sql;
                _dbWrapper.BuildParamInClauseQuery(teamIDList, "TEAM_IDS", cmd);
            }, _context.Identity.InstitutionId);

            foreach (var row in records)
            {
                Team team = new Team();
                team.TeamId        = row["TEAM_ID"].ToString();
                team.RepCode       = row["REP_CODE"].ToString();
                team.Name          = row["NAME"].ToString();
                team.Role          = (Team.TeamRole)(Convert.ToInt64(row["TEAM_ROLE_ID"]));
                team.AssignType    = (Team.TeamAssignmentType)(Convert.ToInt64(row["TEAM_ASSIGN_TYPE_ID"]));
                team.HierarchyType = (Team.TeamHierarchyType)(Convert.ToInt64(row["TEAM_HIERARCHY_TYPE_ID"]));
                parentTeams.Add(team);
            }
            return(parentTeams);
        }