Exemplo n.º 1
0
        public static List <SavedSearch> GetSavedSearch(string searchId, int userId)
        {
            if (string.IsNullOrEmpty(searchId) ||
                userId <= 0)
            {
                log.Warn("This method must be used for a specific control and user");
                return(null);
            }

            List <SavedSearch> theList = new List <SavedSearch>();

            SavedSearchDSTableAdapters.GetSavedSearchTableAdapter adapter =
                new SavedSearchDSTableAdapters.GetSavedSearchTableAdapter();

            try
            {
                SavedSearchDS.GetSavedSearchDataTable table = adapter.GetSavedSearch(searchId, userId);

                if (table != null && table.Rows.Count > 0)
                {
                    foreach (SavedSearchDS.GetSavedSearchRow row in table.Rows)
                    {
                        SavedSearch obj = FillRecord(row);
                        theList.Add(obj);
                    }
                }
            }
            catch (Exception x)
            {
                log.Error("An error was ocurred while getting the saved searches", x);
                return(null);
            }
            return(theList);
        }
Exemplo n.º 2
0
        public static List <SavedSearch> GetSavedSearch(string searchId, int userId, string name)
        {
            List <SavedSearch> theList = new List <SavedSearch>();

            SavedSearchDSTableAdapters.GetSavedSearchTableAdapter adapter =
                new SavedSearchDSTableAdapters.GetSavedSearchTableAdapter();

            try
            {
                SavedSearchDS.GetSavedSearchDataTable table =
                    adapter.GetSavedSearchBySearchName(searchId, userId, name);

                if (table != null && table.Rows.Count == 1)
                {
                    SavedSearch obj = FillRecord(table[0]);
                    theList.Add(obj);
                }
                else
                {
                    log.Error("No record found with arguments: " +
                              searchId + "," + userId.ToString() + "," + name);
                }
            }
            catch (Exception x)
            {
                log.Error("An error was ocurred while getting the saved searches", x);
                return(null);
            }
            return(theList);
        }