Example #1
0
 public static List <FE_Category> GetTop(int num)
 {
     try
     {
         IDbConnection dbConn = new OrmliteConnection().openConn();
         var           item   = dbConn.Where <Category>(x => x.isactive == true);
         if (item == null)
         {
             return(new List <FE_Category>());
         }
         item = item.Take(num).ToList();
         return(Mapper.Map <List <FE_Category> >(item));
     }
     catch (Exception ex)
     {
         return(new List <FE_Category>());
     }
 }
Example #2
0
 public static FE_Article GetByArticleType(ArticleType articletype)
 {
     try
     {
         IDbConnection dbConn         = new OrmliteConnection().openConn();
         var           articletypenum = (int)articletype;
         //var item = dbConn.FirstOrDefault<Article>(x => x.isactive == ActiveStatus.Active && x.articletype == articletypenum);
         var items = dbConn.Where <Article>(x => x.isactive == ActiveStatus.Active && x.articletype == articletypenum).OrderByDescending(x => x.entryid).ToList();
         if (items != null && items.Count == 0)
         {
             return(null);
         }
         var mapped = Mapper.Map <FE_Article>(items[0]);
         var result = mapped;
         return(result);
     }
     catch (Exception ex)
     {
         return(new FE_Article());
     }
 }
Example #3
0
        public static HomePage GetById(int entryid)
        {
            var dbConn = new OrmliteConnection().openConn();

            try
            {
                var data = dbConn.Where <HomePage>(x => x.entryid == entryid);
                if (data != null && data.Count > 0)
                {
                    return(data[0]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
            finally { }
        }
Example #4
0
        public static HomePage GetLast()
        {
            var dbConn = new OrmliteConnection().openConn();

            try
            {
                var data = dbConn.Where <HomePage>(x => x.isactive == true);
                if (data != null && data.Count > 0)
                {
                    return(data[0]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
            finally { }
        }