public List <V_BG_ActiveFile_Department> GetList(ActiveFileTypeEnum type = ActiveFileTypeEnum.All)
 {
     try
     {
         //数据过大,可能会慢点,变成存储过程
         string            sqlString   = @"
                             SELECT *
                             FROM V_BG_ActiveFile_Department AS A
                             LEFT JOIN 
                             (SELECT DeparementId,COUNT(1) AS 'Count'
                             FROM T_BG_ActiveFile
                             GROUP BY DeparementId) AS B
                             ON A.DeparementId=B.DeparementId
                             WHERE IsDel=0 AND PublicTime<=GETDATE() {0}
                             ORDER BY Lvl DESC,PublicTime DESC
                             ";
         string            whereString = String.Empty;
         DynamicParameters dynParams   = new DynamicParameters();
         if (type != ActiveFileTypeEnum.All)
         {
             whereString = " AND Type=@Type ";
             dynParams.Add("Type", (int)type);
         }
         sqlString = String.Format(sqlString, whereString);
         var list = _activeFileDepartmentRepository.QueryList(sqlString, dynParams, false);
         return(list.ToList());
     }
     catch (Exception)
     {
         return(null);
     }
 }
 public List <V_BG_ActiveFile_Department> GetListForDel(ActiveFileTypeEnum type = ActiveFileTypeEnum.All)
 {
     try
     {
         string            sqlString   = @"
                             SELECT *
                             FROM V_BG_ActiveFile_Department 
                             WHERE IsDel=0 AND PublicTime<=GETDATE() {0}
                             ORDER BY PublicTime DESC
                            ";
         string            whereString = String.Empty;
         DynamicParameters dynParams   = new DynamicParameters();
         if (type != ActiveFileTypeEnum.All)
         {
             whereString = " AND Type=@Type ";
             dynParams.Add("Type", (int)type);
         }
         sqlString = String.Format(sqlString, whereString);
         var list = _activeFileDepartmentRepository.QueryList(sqlString, dynParams, false);
         return(list.ToList());
     }
     catch (Exception)
     {
         return(null);
     }
 }
예제 #3
0
        // GET: ActiveFile
        public ActionResult ActiveFileList()
        {
            int typ = CommonHelper.GetPostValue("typ").ToInt(1);

            ViewBag.typ = typ;
            ActiveFileTypeEnum type = typ == 1 ? ActiveFileTypeEnum.Publish : typ == 2 ? ActiveFileTypeEnum.Office : ActiveFileTypeEnum.Shop;
            List <ActiveFileDepartmentExtend> list = _activeFileDepartmentExtendService.GetList(type);

            return(View(list));
        }
예제 #4
0
 public JsonActiveFileApiGetList GetList()
 {
     int type = CommonHelper.GetPostValue("type").ToInt(0);
     ActiveFileTypeEnum typ = (ActiveFileTypeEnum) type;
     JsonActiveFileApiGetList json = new JsonActiveFileApiGetList
     {
         ErrorCode = "E000",
         ErrorMessage = "Success",
         List = _bgVActiveFileDepartmentService.GetListForDel(typ)
     };
     return json;
 }