Пример #1
0
        public ExecResult Del(FriendlyLinkQuery query)
        {
            ExecResult           execResult = new ExecResult();
            IFriendlyLinkService service    = ServiceContainer.Instance.Container.Resolve <IFriendlyLinkService>();

            Int64[] LinkIDs = query.LinkIDs;
            if (LinkIDs == null)
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "没有删除任何数据!";
                return(execResult);
            }
            string msg    = string.Empty;
            bool   result = service.BatchDeleteFriendlyLink(LinkIDs);

            if (result)
            {
                execResult.result = EnumJsonResult.success.ToString();
                execResult.msg    = "删除友情链接成功!";
            }
            else
            {
                execResult.result = EnumJsonResult.failure.ToString();
                execResult.msg    = "删除友情链接失败!";
            }
            return(execResult);
        }
Пример #2
0
        public FriendlyLinkEntity GetModel(FriendlyLinkQuery query)
        {
            IFriendlyLinkService service = ServiceContainer.Instance.Container.Resolve <IFriendlyLinkService>();
            FriendlyLinkEntity   model   = service.GetFriendlyLinkModel(query.LinkID);

            return(model);
        }
Пример #3
0
        public IList <FriendlyLinkEntity> GetList(FriendlyLinkQuery query)
        {
            IFriendlyLinkService       service = ServiceContainer.Instance.Container.Resolve <IFriendlyLinkService>();
            IList <FriendlyLinkEntity> list    = service.GetFriendlyLinkList(query);

            return(list);
        }
Пример #4
0
        public Pager <FriendlyLinkEntity> GetPageList(FriendlyLinkQuery query)
        {
            IFriendlyLinkService       service = ServiceContainer.Instance.Container.Resolve <IFriendlyLinkService>();
            Pager <FriendlyLinkEntity> pager   = service.GetFriendlyLinkPageList(query);

            return(pager);
        }
Пример #5
0
        public ActionResult GetList(FriendlyLinkQuery query)
        {
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();

            query.JournalID = CurAuthor.JournalID;
            IList <FriendlyLinkEntity> list = service.GetFriendlyLinkList(query);

            return(Json(new { list }));
        }
Пример #6
0
        public ActionResult Delete(Int64[] LinkIDs)
        {
            ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
            FriendlyLinkQuery        query   = new FriendlyLinkQuery();

            query.JournalID = CurAuthor.JournalID;
            query.LinkIDs   = LinkIDs;
            ExecResult result = service.DelFriendlyLink(query);

            return(Json(new { result = result.result, msg = result.msg }));
        }
Пример #7
0
        public ActionResult GetPageList(FriendlyLinkQuery 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 <FriendlyLinkEntity> pager = service.GetFriendlyLinkPageList(query);

            return(Json(new { Rows = pager.ItemList, Total = pager.TotalRecords }));
        }
Пример #8
0
        /// <summary>
        /// 获取友情链接数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public IList <FriendlyLinkEntity> GetFriendlyLinkList(FriendlyLinkQuery query)
        {
            string strSql   = "SELECT LinkID,JournalID,ChannelID,SiteName,SiteUrl,LogoUrl,LinkType,SortID,AddDate FROM dbo.FriendlyLink with(nolock)";
            string whereSQL = GetFriendlyLinkFilter(query);

            if (!string.IsNullOrWhiteSpace(whereSQL))
            {
                strSql += " WHERE " + whereSQL;
            }
            strSql += " order by SortID";
            return(db.GetList <FriendlyLinkEntity>(strSql, MakeFriendlyLinkList));
        }
Пример #9
0
        /// <summary>
        /// 获取条件
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        private string GetFriendlyLinkFilter(FriendlyLinkQuery query)
        {
            StringBuilder strFilter = new StringBuilder();

            strFilter.Append(" 1=1");
            if (query.JournalID > 0)
            {
                strFilter.AppendFormat(" and JournalID={0}", query.JournalID);
            }
            if (query.ChannelID > 0)
            {
                strFilter.AppendFormat(" and ChannelID={0}", query.ChannelID);
            }
            return(strFilter.ToString());
        }
Пример #10
0
        private FriendlyLinkEntity GetModel(Int64 LinkID)
        {
            FriendlyLinkEntity model = null;

            if (LinkID > 0)
            {
                FriendlyLinkQuery query = new FriendlyLinkQuery();
                query.JournalID = CurAuthor.JournalID;
                query.LinkID    = LinkID;
                ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>();
                model = service.GetFriendlyLinkModel(query);
            }
            if (model == null)
            {
                model = new FriendlyLinkEntity();
            }
            return(model);
        }
Пример #11
0
        /// <summary>
        /// 获取友情链接分页数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager <FriendlyLinkEntity> GetFriendlyLinkPageList(FriendlyLinkQuery query)
        {
            string strSql   = "SELECT LinkID,JournalID,ChannelID,SiteName,SiteUrl,LogoUrl,LinkType,SortID,AddDate,ROW_NUMBER() OVER(ORDER BY LinkID DESC) AS ROW_ID FROM dbo.FriendlyLink with(nolock)",
                   sumStr   = "SELECT RecordCount=COUNT(1) FROM dbo.FriendlyLink with(nolock)";
            string whereSQL = GetFriendlyLinkFilter(query);

            if (!string.IsNullOrWhiteSpace(whereSQL))
            {
                strSql += " WHERE " + whereSQL;
                sumStr += " WHERE " + whereSQL;
            }
            return(db.GetPageList <FriendlyLinkEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex)
                                                       , sumStr
                                                       , query.CurrentPage, query.PageSize
                                                       , (dr, pager) =>
            {
                pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]);
            }
                                                       , MakeFriendlyLinkList));
        }
Пример #12
0
 /// <summary>
 /// 获取友情链接数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList <FriendlyLinkEntity> GetFriendlyLinkList(FriendlyLinkQuery query)
 {
     return(FriendlyLinkBusProvider.GetFriendlyLinkList(query));
 }
Пример #13
0
 /// <summary>
 /// 获取友情链接分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager <FriendlyLinkEntity> GetFriendlyLinkPageList(FriendlyLinkQuery query)
 {
     return(FriendlyLinkBusProvider.GetFriendlyLinkPageList(query));
 }
Пример #14
0
 /// <summary>
 /// 获取友情链接数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList <FriendlyLinkEntity> GetFriendlyLinkList(FriendlyLinkQuery query)
 {
     return(FriendlyLinkDataAccess.Instance.GetFriendlyLinkList(query));
 }