Exemplo n.º 1
0
    public string CategoryOption(int selectValue)
    {
        string    strHTML = "";
        QueryInfo Query   = new QueryInfo();

        Query.PageSize    = 0;
        Query.CurrentPage = 1;
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkCateInfo.FriendlyLink_Cate_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo("FriendlyLinkCateInfo.FriendlyLink_Cate_ID", "DESC"));
        IList <FriendlyLinkCateInfo> entitys = MyCBLL.GetFriendlyLinkCates(Query, Public.GetUserPrivilege());

        if (entitys != null)
        {
            foreach (FriendlyLinkCateInfo entity in entitys)
            {
                if (entity.FriendlyLink_Cate_ID == selectValue)
                {
                    strHTML += "<option value=\"" + entity.FriendlyLink_Cate_ID + "\" selected=\"selected\">" + entity.FriendlyLink_Cate_Name + "</option>";
                }
                else
                {
                    strHTML += "<option value=\"" + entity.FriendlyLink_Cate_ID + "\">" + entity.FriendlyLink_Cate_Name + "</option>";
                }
            }
        }
        return(strHTML);
    }
Exemplo n.º 2
0
    public string GetFriendlyLinkCates()
    {
        QueryInfo Query = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        string keyword = tools.CheckStr(Request["keyword"]);

        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkCateInfo.FriendlyLink_Cate_Name", "like", keyword));
        }
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FriendlyLinkCateInfo.FriendlyLink_Cate_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));

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

        IList <FriendlyLinkCateInfo> entitys = MyBLL.GetFriendlyLinkCates(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 (FriendlyLinkCateInfo entity in entitys)
            {
                jsonBuilder.Append("{\"FriendlyLinkCateInfo.FriendlyLink_Cate_ID\":" + entity.FriendlyLink_Cate_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.FriendlyLink_Cate_ID);
                jsonBuilder.Append("\",");

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

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

                jsonBuilder.Append("\"");
                jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\" alt=\\\"修改\\\"> <a href=\\\"friendlylink_cate_edit.aspx?friendlylink_cate_id=" + entity.FriendlyLink_Cate_ID + "\\\" title=\\\"修改\\\">修改</a> <img src=\\\"/images/icon_del.gif\\\"  alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('friendlylink_cate_do.aspx?action=move&friendlylink_cate_id=" + entity.FriendlyLink_Cate_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);
        }
    }
Exemplo n.º 3
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);
    }