Example #1
0
        public IList <IndexModulesEntity> GetIndexModules(IndexModuleType type, int top)
        {
            string sql = @"SELECT TOP ({0}) [Id]
      ,[Key]
      ,[Title]
      ,[SubTitle1]
      ,[SubTitle2]
      ,[ImagePath]
      ,[LinkUrl]
      ,[CreateTime]
      ,[Description]
      ,[RefId]
      ,[Sort]
      ,[Status]
  FROM [IndexModules]
WHERE [Key]=@key and status=1
   ORDER BY [Sort]";

            var db         = DbSFO2OMain;
            var parameters = db.CreateParameterCollection();

            parameters.Append("key", type.As(0));
            sql = string.Format(sql, top);
            return(db.ExecuteSqlList <IndexModulesEntity>(sql, parameters));
        }
Example #2
0
 private IList <IndexModulesEntity> GetIndexModules(IndexModuleType type, int top, IList <IndexModulesEntity> modules)
 {
     if (modules == null || modules.Count == 0)
     {
         return(new List <IndexModulesEntity>());
     }
     return(modules.Where(n => n.Key == type.As(0)).Take(top).ToList());
 }