public ExecResult Del(SiteBlockQuery query)
 {
     ExecResult execResult = new ExecResult();
     ISiteBlockService service = ServiceContainer.Instance.Container.Resolve<ISiteBlockService>();
     Int64[] BlockIDs = query.BlockIDs;
     if (BlockIDs == null)
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "没有删除任何数据!";
         return execResult;
     }
     string msg = string.Empty;
     bool result = service.BatchDeleteSiteBlock(BlockIDs);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "删除内容块成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "删除内容块失败!";
     }
     return execResult;
 }
 public ActionResult GetList(SiteBlockQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     IList<SiteBlockEntity> list = service.GetSiteBlockList(query);
     return Json(new { list });
 }
 public ActionResult GetPageList(SiteBlockQuery query)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     query.CurrentPage = Convert.ToInt32(Request.Params["page"]);
     query.PageSize = Convert.ToInt32(Request.Params["pagesize"]);
     Pager<SiteBlockEntity> pager = service.GetSiteBlockPageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
 public ActionResult Delete(Int64[] BlockIDs)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     SiteBlockQuery query = new SiteBlockQuery();
     query.JournalID = CurAuthor.JournalID;
     query.BlockIDs = BlockIDs;
     ExecResult result = service.DelSiteBlock(query);
     return Json(new { result = result.result, msg = result.msg });
 }
 private SiteBlockEntity GetModel(Int64 BlockID)
 {
     SiteBlockEntity model = null;
     if (BlockID > 0)
     {
         SiteBlockQuery query = new SiteBlockQuery();
         query.JournalID = CurAuthor.JournalID;
         query.BlockID = BlockID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetSiteBlockModel(query);
     }
     if (model == null)
         model = new SiteBlockEntity();
     return model;
 }
 /// <summary>
 /// 获取内容块数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteBlockEntity> GetSiteBlockList(SiteBlockQuery query)
 {
     return SiteBlockDataAccess.Instance.GetSiteBlockList(query);
 }
 /// <summary>
 /// 获取内容块数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteBlockEntity> GetSiteBlockList(SiteBlockQuery query)
 {
     return SiteBlockBusProvider.GetSiteBlockList(query);
 }
 /// <summary>
 /// 获取内容块分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteBlockEntity> GetSiteBlockPageList(SiteBlockQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<SiteBlockEntity> pager = clientHelper.Post<Pager<SiteBlockEntity>, SiteBlockQuery>(GetAPIUrl(APIConstant.SITEBLOCK_GETPAGELIST), query);
     return pager;
 }
 /// <summary>
 /// 获取条件
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 private string GetSiteBlockFilter(SiteBlockQuery query)
 {
     StringBuilder strFilter = new StringBuilder(" JournalID=" + query.JournalID);
     if (query.ChannelID > 0)
         strFilter.AppendFormat(" and ChannelID={0}", query.ChannelID);
     return strFilter.ToString();
 }
 /// <summary>
 /// 获取内容块分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteBlockEntity> GetSiteBlockPageList(SiteBlockQuery query)
 {
     return SiteBlockBusProvider.GetSiteBlockPageList(query);
 }
 /// <summary>
 /// 获取内容块数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteBlockEntity> GetSiteBlockList(SiteBlockQuery query)
 {
     string strSql = "SELECT * FROM dbo.SiteBlock with(nolock)";
     string whereSQL = GetSiteBlockFilter(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
     }
     strSql += " order by BlockID";
     return db.GetList<SiteBlockEntity>(strSql, MakeSiteBlockList);
 }
 /// <summary>
 /// 获取内容块分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteBlockEntity> GetSSiteBlockPageList(SiteBlockQuery query)
 {
     string strSql = "SELECT *,ROW_NUMBER() OVER(ORDER BY BlockID DESC) AS ROW_ID FROM dbo.SiteBlock with(nolock)",
            sumStr = "SELECT RecordCount=COUNT(1) FROM dbo.SiteBlock with(nolock)";
     string whereSQL = GetSiteBlockFilter(query);
     if (!string.IsNullOrWhiteSpace(whereSQL))
     {
         strSql += " WHERE " + whereSQL;
         sumStr += " WHERE " + whereSQL;
     }
     return db.GetPageList<SiteBlockEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
         , sumStr
         , query.CurrentPage, query.PageSize
         , (dr, pager) =>
         {
             pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
         }
         , MakeSiteBlockList);
 }
 /// <summary>
 /// 获取内容块实体
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public SiteBlockEntity GetSiteBlockModel(SiteBlockQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     SiteBlockEntity model = clientHelper.Post<SiteBlockEntity, SiteBlockQuery>(GetAPIUrl(APIConstant.SITEBLOCK_GETMODEL), query);
     return model;
 }
 /// <summary>
 /// 删除内容块
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExecResult DelSiteBlock(SiteBlockQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, SiteBlockQuery>(GetAPIUrl(APIConstant.SITEBLOCK_DEL), query);
     return result;
 }
 public Pager<SiteBlockEntity> GetPageList(SiteBlockQuery query)
 {
     ISiteBlockService service = ServiceContainer.Instance.Container.Resolve<ISiteBlockService>();
     Pager<SiteBlockEntity> pager = service.GetSiteBlockPageList(query);
     return pager;
 }
 public SiteBlockEntity GetModel(SiteBlockQuery query)
 {
     ISiteBlockService service = ServiceContainer.Instance.Container.Resolve<ISiteBlockService>();
     SiteBlockEntity model = service.GetSiteBlockModel(query.BlockID);
     return model;
 }
 public IList<SiteBlockEntity> GetList(SiteBlockQuery query)
 {
     ISiteBlockService service = ServiceContainer.Instance.Container.Resolve<ISiteBlockService>();
     IList<SiteBlockEntity> list = service.GetSiteBlockList(query);
     return list;
 }
 /// <summary>
 /// 获取内容块分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<SiteBlockEntity> GetSiteBlockPageList(SiteBlockQuery query)
 {
     return SiteBlockDataAccess.Instance.GetSSiteBlockPageList(query);
 }
 /// <summary>
 /// 获取内容块数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteBlockEntity> GetSiteBlockList(SiteBlockQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<SiteBlockEntity> list = clientHelper.Post<IList<SiteBlockEntity>, SiteBlockQuery>(GetAPIUrl(APIConstant.SITEBLOCK_GETLIST), query);
     return list;
 }