示例#1
0
 public static bool IsDuplicate(NewsEntry entry)
 {
     using (DAC dac = new DAC())
     {
         string query = string.Format("SELECT Title FROM News WHERE Provider = '{0}' AND Title = '{1}' AND EmailId = '{2}';", entry.Provider, entry.Title, entry.EmailId);
         using (DbDataReader reader = dac.FetchRecords(query))
         {
             return(reader.HasRows);
         }
     }
 }
示例#2
0
        public static List <Recipe> FetchByGroupUid(long groupUid)
        {
            List <Recipe> recipeList = new List <Recipe>();

            using (DAC dac = new DAC())
            {
                using (DbDataReader reader = dac.FetchRecords("SELECT * FROM Recipe WHERE GroupUID = " + groupUid + ";"))
                {
                    while (reader.Read())
                    {
                        recipeList.Add(Fetch(reader));
                    }
                }
            }
            return(recipeList);
        }
示例#3
0
        public static List <Position> FetchAll()
        {
            List <Position> all = new List <Position>();

            using (DAC dac = new DAC())
            {
                using (DbDataReader reader = dac.FetchRecords("SELECT * FROM Location;"))
                {
                    while (reader.Read())
                    {
                        all.Add(Fetch(reader));
                    }
                }
            }
            return(all);
        }
示例#4
0
        public static List <RecipeGroup> FetchAll()
        {
            List <RecipeGroup> all = new List <RecipeGroup>();

            using (DAC dac = new DAC())
            {
                using (DbDataReader reader = dac.FetchRecords("SELECT * FROM RecipeGroup ORDER BY UID;"))
                {
                    while (reader.Read())
                    {
                        all.Add(Fetch(reader));
                    }
                }
            }
            return(all);
        }
示例#5
0
        public static RecipeGroup FetchByUid(int uid)
        {
            RecipeGroup group = null;

            using (DAC dac = new DAC())
            {
                using (DbDataReader reader = dac.FetchRecords("SELECT * FROM RecipeGrou] WHERE UID = " + uid + ";"))
                {
                    if (reader.Read())
                    {
                        group = Fetch(reader);
                    }
                }
            }
            return(group);
        }
示例#6
0
        public static List <NewsEntry> FetchAll()
        {
            List <NewsEntry> all = new List <NewsEntry>();

            using (DAC dac = new DAC())
            {
                using (DbDataReader reader = dac.FetchRecords("SELECT * FROM News;"))
                {
                    while (reader.Read())
                    {
                        all.Add(Fetch(reader));
                    }
                }
            }
            return(all);
        }