Esempio n. 1
0
        /// <summary>
        /// Retrieve searcher results
        /// </summary>
        public async Task <SqlDataReader> GetSearchRecordsAsync(SqlIOAsync sqlIO,
                                                                SearchManager searcher)
        {
            SqlDataReader dataReader = null;

            if (searcher.SearchResult.URIDataManager.AppType == GeneralHelpers.APPLICATION_TYPES.networks ||
                searcher.SearchResult.URIDataManager.AppType == GeneralHelpers.APPLICATION_TYPES.locals ||
                searcher.SearchResult.URIDataManager.AppType == GeneralHelpers.APPLICATION_TYPES.addins)
            {
                dataReader = await GetAdminPageSearch(sqlIO, searcher);
            }
            else
            {
                if (searcher.SearchResult.URIDataManager.ServerSubActionType
                    == GeneralHelpers.SERVER_SUBACTION_TYPES.searchbyservice)
                {
                    dataReader = await GetPageSearchByService(sqlIO, searcher);
                }
                else
                {
                    dataReader = await GetPageSearch(sqlIO, searcher);
                }
            }
            return(dataReader);
        }
Esempio n. 2
0
        private async Task <SqlDataReader> GetPageSearchByService(SqlIOAsync sqlIO, SearchManager searcher)
        {
            SqlDataReader dataReader = null;
            //initialize parameters for general query
            string sQry = GetSearchByServiceQry(searcher.SearchResult);

            if (sQry != string.Empty && sQry != null)
            {
                SqlParameter[] oPrams = GetPageSearchByServiceParams(searcher, sqlIO);
                dataReader = await sqlIO.RunProcAsync(sQry, oPrams);

                if (dataReader != null)
                {
                    searcher.RowCount = dataReader.RecordsAffected;
                }
            }
            return(dataReader);
        }
Esempio n. 3
0
        private static SqlParameter[] GetPageSearchByServiceParams(SearchManager searcher,
                                                                   SqlIOAsync data)
        {
            int iIsForward = GeneralHelpers.ConvertStringToInt(searcher.IsForward);

            if (iIsForward != 1 || iIsForward != 0)
            {
                iIsForward = 1;
            }
            bool bNeedsTypeId = NeedsTypeIdSearchParam(searcher.SearchResult.URIDataManager.AppType);

            if (bNeedsTypeId)
            {
                SqlParameter[] oPrams2 =
                {
                    data.MakeInParam("@AccountId",   SqlDbType.Int,        4, searcher.SearchResult.URIMember.ClubInUse.PKId),
                    data.MakeInParam("@NetworkId",   SqlDbType.Int,        4, searcher.NetworkSelected.PKId),
                    data.MakeInParam("@NetworkType", SqlDbType.NVarChar,  25, searcher.NetworkType.ToString()),
                    data.MakeInParam("@Keywords",    SqlDbType.NVarChar, 255, searcher.Keywords),
                    data.MakeInParam("@IsForward",   SqlDbType.Bit,        1, iIsForward),
                    data.MakeInParam("@StartRow",    SqlDbType.Int,        4, searcher.StartRow),
                    data.MakeInParam("@PageSize",    SqlDbType.Int,        4, searcher.PageSize),
                    //filter for types
                    data.MakeInParam("@TypeId",      SqlDbType.Int,        4, searcher.TypeId),
                    data.MakeInParam("@ServiceId",   SqlDbType.Int,        4, searcher.ServiceSelected.ServiceId)
                };
                return(oPrams2);
            }
            else
            {
                SqlParameter[] oPrams3 =
                {
                    data.MakeInParam("@AccountId",   SqlDbType.Int,        4, searcher.SearchResult.URIMember.ClubInUse.PKId),
                    data.MakeInParam("@NetworkId",   SqlDbType.Int,        4, searcher.NetworkSelected.PKId),
                    data.MakeInParam("@NetworkType", SqlDbType.NVarChar,  25, searcher.NetworkType.ToString()),
                    data.MakeInParam("@Keywords",    SqlDbType.NVarChar, 255, searcher.Keywords),
                    data.MakeInParam("@IsForward",   SqlDbType.Bit,        1, iIsForward),
                    data.MakeInParam("@StartRow",    SqlDbType.Int,        4, searcher.StartRow),
                    data.MakeInParam("@PageSize",    SqlDbType.Int,        4, searcher.PageSize),
                    data.MakeInParam("@ServiceId",   SqlDbType.Int,        4, searcher.ServiceSelected.ServiceId)
                };
                return(oPrams3);
            }
        }
Esempio n. 4
0
        private async Task <SqlDataReader> GetPageSearch(SqlIOAsync sqlIO, SearchManager searcher)
        {
            SqlDataReader dataReader = null;
            //initialize parameters for general query
            //returns Web.ViewDataHelper records at a time
            bool   bIsPageSearch = true;
            string sQry          = GetQry(searcher.SearchResult, bIsPageSearch);

            if (sQry != string.Empty && sQry != null)
            {
                SqlParameter[] oPrams = GetPageSearchParams(searcher, sqlIO);
                dataReader = await sqlIO.RunProcAsync(sQry, oPrams);

                if (dataReader != null)
                {
                    searcher.RowCount = dataReader.RecordsAffected;
                }
            }
            return(dataReader);
        }
Esempio n. 5
0
        private async Task <SqlDataReader> GetAdminPageSearch(SqlIOAsync sqlIO, SearchManager searcher)
        {
            SqlDataReader dataReader = null;
            //initialize parameters for general query
            //uint iIsForward = 1;
            //if (searcher.IsForward == "0") iIsForward = 0;
            //returns pkid, name record list (children of the parent displayed at top of list)
            string sQry          = string.Empty;
            bool   bIsPageSearch = true;

            sQry = GetQry(searcher.SearchResult, bIsPageSearch);
            if (sQry != string.Empty && sQry != null)
            {
                SqlParameter[] oPrams = GetPageSearchParams(searcher, sqlIO);
                dataReader = await sqlIO.RunProcAsync(sQry, oPrams);

                if (dataReader != null)
                {
                    searcher.RowCount = dataReader.RecordsAffected;
                }
            }
            return(dataReader);
        }