Exemple #1
0
    public string GetProductTags()
    {
        string    keyword      = tools.CheckStr(Request["keyword"]);
        int       tag_isactive = tools.CheckInt(Request["tag_isactive"]);
        QueryInfo Query        = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        if (tag_isactive == 1)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductTagInfo.Product_Tag_IsActive", "=", "1"));
        }
        else if (tag_isactive == 2)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductTagInfo.Product_Tag_IsActive", "=", "0"));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductTagInfo.Product_Tag_Name", "like", keyword));
        }
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductTagInfo.Product_Tag_Site", "=", Public.GetCurrentSite()));
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));
        PageInfo pageinfo = MyBLL.GetPageInfo(Query, Public.GetUserPrivilege());
        IList <ProductTagInfo> entitys = MyBLL.GetProductTags(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 (ProductTagInfo entity in entitys)
            {
                jsonBuilder.Append("{\"ProductTagInfo.Product_Tag_ID\":" + entity.Product_Tag_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Product_Tag_ID);
                jsonBuilder.Append("\",");

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

                jsonBuilder.Append("\"");
                if (entity.Product_Tag_IsActive == 1)
                {
                    jsonBuilder.Append("启用");
                }
                else
                {
                    jsonBuilder.Append("关闭");
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (Public.CheckPrivilege("2fea26b6-bbb2-44d8-9b46-0b1aed1cc47f"))
                {
                    jsonBuilder.Append("<img src=\\\"/images/icon_edit.gif\\\"> <a href=\\\"tag_edit.aspx?product_tag_id=" + entity.Product_Tag_ID + "\\\" title=\\\"修改\\\">修改</a>");
                }
                if (Public.CheckPrivilege("7b8b58e2-e509-4e6c-a68e-0361225cefa6"))
                {
                    jsonBuilder.Append(" <img src=\\\"/images/icon_edit.gif\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('tag_do.aspx?action=move&product_tag_id=" + entity.Product_Tag_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);
        }
    }
Exemple #2
0
    public void GetProductTags()
    {
        string keyword      = tools.CheckStr(Request["keyword"]);
        int    tag_isactive = tools.CheckInt(Request["tag_isactive"]);
        int    i            = 0;
        string Pageurl;
        int    curpage = tools.CheckInt(tools.NullStr(Request["page"]));

        Pageurl = "?action=list";
        if (curpage < 1)
        {
            curpage = 1;
        }
        QueryInfo Query = new QueryInfo();

        Query.PageSize    = 10;
        Query.CurrentPage = curpage;
        if (tag_isactive == 1)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductTagInfo.Product_Tag_IsActive", "=", "1"));
        }
        else if (tag_isactive == 2)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductTagInfo.Product_Tag_IsActive", "=", "0"));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductTagInfo.Product_Tag_Name", "like", keyword));
        }
        //Query.ParamInfos.Add(new ParamInfo("AND", "str", "ProductTagInfo.Product_Tag_Site", "=", pub.GetCurrentSite()));
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ProductTagInfo.Product_Tag_SupplierID", "=", tools.NullInt(Session["supplier_id"]).ToString()));
        Query.OrderInfos.Add(new OrderInfo("ProductTagInfo.Product_Tag_ID", "DESC"));

        //Response.Write("<table class=\"commontable\">");
        //Response.Write("<tr>");
        Response.Write("<table width=\"973\" cellpadding=\"0\" align=\"center\" cellspacing=\"2\" class=\"table02\" >");
        Response.Write("<tr>");
        Response.Write("  <td width=\"300\" class=\"name\">标签名称</td>");
        Response.Write("  <td width=\"223\"  class=\"name\">启用</td>");
        Response.Write("  <td width=\"225\"  class=\"name\">排序</td>");
        Response.Write("  <td width=\"225\"  class=\"name\">操作</td>");
        Response.Write("</tr>");

        IList <ProductTagInfo> entitys = MyBLL.GetProductTags(Query, pub.CreateUserPrivilege("ed87eb87-dade-4fbc-804c-c139c1cbe9c8"));
        PageInfo page = MyBLL.GetPageInfo(Query, pub.CreateUserPrivilege("ed87eb87-dade-4fbc-804c-c139c1cbe9c8"));

        if (entitys != null)
        {
            foreach (ProductTagInfo entity in entitys)
            {
                i++;

                if (i % 2 == 0)
                {
                    Response.Write("<tr class=\"bg\" >");
                }
                else
                {
                    Response.Write("<tr>");
                }

                Response.Write("<td>" + entity.Product_Tag_Name + "</td>");

                Response.Write("<td>");
                if (entity.Product_Tag_IsActive == 1)
                {
                    Response.Write("启用");
                }
                else
                {
                    Response.Write("关闭");
                }
                Response.Write("</td>");

                Response.Write("<td>");
                Response.Write(entity.Product_Tag_Sort);
                Response.Write("</td>");

                Response.Write("<td>");
                Response.Write("<span><a href=\"/supplier/tag_edit.aspx?product_tag_id=" + entity.Product_Tag_ID + "\" class=\"a12\">修改</a></span>");
                Response.Write(" <span><a href=\"/supplier/tag_do.aspx?action=del&product_tag_id=" + entity.Product_Tag_ID + "\">删除</a></span>");
                Response.Write("</td>");
                Response.Write("</tr>");
            }
            Response.Write("</table>");
            pub.Page(page.PageCount, page.CurrentPage, Pageurl, page.PageSize, page.RecordCount);
        }
        else
        {
            Response.Write("<table width=\"973\" cellpadding=\"0\" align=\"center\" cellspacing=\"2\" class=\"table02\" >");
            Response.Write("<tr><td  colspan=\"4\" align=\"center\" >没有记录</td></tr>");
            Response.Write("</table>");
        }
    }