Пример #1
0
    public FriendlyLinkCateInfo GetFriendlyLinkCateInfoByID(int CateID)
    {
        FriendlyLinkCateInfo entity = mylinkcate.GetFriendlyLinkCateByID(CateID, pub.CreateUserPrivilege("0a9f21bd-88cb-4121-94b8-f865a9de2c3b"));

        if (entity == null)
        {
            QueryInfo Query = new QueryInfo();
            Query.PageSize    = 0;
            Query.CurrentPage = 1;
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkCateInfo.FriendlyLink_Cate_Site", "=", "CN"));
            Query.OrderInfos.Add(new OrderInfo("FriendlyLinkCateInfo.FriendlyLink_Cate_Sort", "ASC"));
            IList <FriendlyLinkCateInfo> entitys = mylinkcate.GetFriendlyLinkCates(Query, pub.CreateUserPrivilege("0a9f21bd-88cb-4121-94b8-f865a9de2c3b"));
            if (entitys != null)
            {
                entity = entitys[0];
            }
        }
        return(entity);
    }
Пример #2
0
    public string GetFriendlyLinks()
    {
        FriendlyLinkCateInfo cateEntity;
        string    keyword = tools.CheckStr(Request["keyword"]);
        int       CateID  = tools.CheckInt(Request["CateID"]);
        QueryInfo Query   = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        if (CateID > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkInfo.FriendlyLink_CateID", "=", CateID.ToString()));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkInfo.FriendlyLink_Name", "like", keyword));
        }
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkInfo.FriendlyLink_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));

        PageInfo pageinfo = MyBLL.GetPageInfo(Query, Public.GetUserPrivilege());

        IList <FriendlyLinkInfo> entitys = MyBLL.GetFriendlyLinks(Query, Public.GetUserPrivilege());

        if (entitys != null)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\"");
            jsonBuilder.Append(":[");
            foreach (FriendlyLinkInfo entity in entitys)
            {
                jsonBuilder.Append("{\"FriendlyLinkInfo.FriendlyLink_ID\":" + entity.FriendlyLink_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.FriendlyLink_ID);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.FriendlyLink_Name));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                cateEntity = MyCBLL.GetFriendlyLinkCateByID(entity.FriendlyLink_CateID, Public.GetUserPrivilege());
                if (cateEntity != null)
                {
                    jsonBuilder.Append(Public.JsonStr(cateEntity.FriendlyLink_Cate_Name));
                }
                else
                {
                    jsonBuilder.Append(entity.FriendlyLink_ID);
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.FriendlyLink_Sort);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (Public.CheckPrivilege("363bfb90-0d0b-42ae-af25-54004fd061e3"))
                {
                    jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\" alt=\\\"修改\\\"> <a href=\\\"friendlylink_edit.aspx?friendlylink_id=" + entity.FriendlyLink_ID + "\\\" title=\\\"修改\\\">修改</a>");
                }

                if (Public.CheckPrivilege("be7c3360-d8c7-4343-8171-4a54a85ca5a5"))
                {
                    jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"  alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('friendlylink_do.aspx?action=move&friendlylink_id=" + entity.FriendlyLink_ID + "')\\\" title=\\\"删除\\\">删除</a>");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("]},");
            }
            jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            jsonBuilder.Append("]");
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
        else
        {
            return(null);
        }
    }
Пример #3
0
 public FriendlyLinkCateInfo GetFriendlyLinkCateByID(int cate_id)
 {
     return(MyBLL.GetFriendlyLinkCateByID(cate_id, Public.GetUserPrivilege()));
 }