Beispiel #1
0
    public string GetZhongXins()
    {
        QueryInfo Query = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        Query.ParamInfos.Add(new ParamInfo("AND", "int", "ZhongXinInfo.ID", ">", "0"));

        string keyword = tools.CheckStr(Request["keyword"]);

        if (keyword != "")
        {
            Query.ParamInfos.Add(new ParamInfo("AND(", "str", "ZhongXinInfo.CompanyName", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR)", "str", "ZhongXinInfo.ReceiptAccount", "like", keyword));
        }
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));

        PageInfo pageinfo = MyBLL.GetPageInfo(Query);

        IList <ZhongXinInfo> entitys = null;

        if (pageinfo.RecordCount > 0)
        {
            entitys = MyBLL.GetZhongXins(Query);
        }

        SupplierInfo supplier = null;

        if (entitys != null)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\"");
            jsonBuilder.Append(":[");
            foreach (ZhongXinInfo entity in entitys)
            {
                jsonBuilder.Append("{\"id\":" + entity.ID + ",\"cell\":[");

                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.ID);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                supplier = MySupplier.GetSupplierByID(entity.SupplierID, Public.GetUserPrivilege());
                if (supplier != null)
                {
                    jsonBuilder.Append(Public.JsonStr(supplier.Supplier_CompanyName));
                }
                else
                {
                    jsonBuilder.Append(entity.SupplierID);
                }
                jsonBuilder.Append("\",");

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

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

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

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

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

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

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

                jsonBuilder.Append("\"");
                if (entity.Audit == 0)
                {
                    jsonBuilder.Append(Public.JsonStr("未审核"));
                }
                else
                {
                    jsonBuilder.Append(Public.JsonStr("已审核"));
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                if (entity.Register == 0)
                {
                    jsonBuilder.Append(Public.JsonStr("未推送"));
                }
                else
                if (entity.Register == 1)
                {
                    jsonBuilder.Append(Public.JsonStr("已推送未绑定"));
                }
                else
                {
                    jsonBuilder.Append(Public.JsonStr("已推送绑定"));
                }
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");

                if (entity.Audit == 1)//平台已审核
                {
                    if (entity.Register == 0)
                    {
                        jsonBuilder.Append("<img src=\\\"/images/btn_add.gif\\\" alt=\\\"推送数据\\\" align=\\\"absmiddle\\\"> <a  href=\\\"javascript:void(0);\\\" onclick=\\\"window.open('zhongxin_do.aspx?action=tuisong&id=" + entity.ID + "', '_self')\\\">推送数据</a> ");
                    }
                    if (entity.Register == 1)
                    {
                        jsonBuilder.Append("<img src=\\\"/images/btn_add.gif\\\" alt=\\\"绑定出金账号\\\" align=\\\"absmiddle\\\"> <a  href=\\\"javascript:void(0);\\\" onclick=\\\"window.open('zhongxin_do.aspx?action=editRegister&id=" + entity.ID + "', '_self')\\\">绑定</a> ");
                    }
                }

                jsonBuilder.Append("<img src=\\\"/images/btn_add.gif\\\" alt=\\\"修改\\\" align=\\\"absmiddle\\\"> <a href=\\\"zhongxin_edit.aspx?id=" + entity.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);
        }
    }