C# 返回一个JSON数据
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json
免费下载资源
·
前端
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="yujkc.aspx.cs" Inherits="NetWing.BPM.Admin.psi.yujkc" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data.Sql" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>预警产品</title>
<script src="../scripts/jquery-1.10.2.min.js"></script>
<link href="../../layUI/src/css/layui.css" rel="stylesheet" />
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">预警产品</div>
<div class="layui-card-body">
<table class="layui-hide" id="test-table-checkbox"></table>
</div>
</div>
</div>
</div>
</div>
<script src="../scripts/layui/layui.all.js"></script>
<script>
layui.use(['table'], function () {
var table = layui.table;
table.render({
elem: '#test-table-checkbox'
, cols: [[
{ field: 'id', title: '序号', type: 'numbers' }
, { field: 'KeyId', title: 'ID', sort: true }
, { field: 'goodsNo', title: '商品编码' }
, { field: 'goodsName', title: '商品名称' }
, { field: 'goodsShortName', title: '商品简称' }
, { field: 'goodsClassName', title: '商品分类名称' }
, { field: 'specs', title: '规格' }
, { field: 'unit', title: '单位' }
, { field: 'buyPrice', title: '进价' }
, { field: 'up_time', title: '最后更新时间' }
]]
, data: [<%=sDateJson%>]
});
});
</script>
</body>
</html>
后台
using NetWing.Common.Data.SqlServer;
using System;
using System.Data;
namespace NetWing.BPM.Admin.psi
{
public partial class yujkc : System.Web.UI.Page
{
protected string sDateJson;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DateTime dtnow = DateTime.Now;
DataTable dttable = SqlEasy.ExecuteDataTable("select * from Psi_Goods");
foreach (DataRow dr in dttable.Rows)
{
DateTime dttime = Convert.ToDateTime(dr["up_time"].ToString());
if (dtnow.AddMonths(-4) > dttime)
{
sDateJson += "{\"KeyId\":" + dr["KeyId"].ToString() + ",\"goodsNo\":\"" + dr["goodsNo"].ToString() + "\",\"goodsName\":\"" + dr["goodsName"].ToString() + "\",\"goodsShortName\":\"" + dr["goodsShortName"].ToString() + "\",\"goodsClassName\":\"" + dr["goodsClassName"].ToString() + "\",\"specs\":\"" + dr["specs"].ToString() + "\",\"unit\":\"" + dr["unit"].ToString() + "\",\"stock\":\"" + dr["stock"].ToString() + "\",\"buyPrice\":\"" + dr["buyPrice"].ToString() + "\",\"up_time\":\"" + dr["up_time"].ToString() + "\"},";
}
//if (!string.IsNullOrEmpty(sDateJson))
//{
// sDateJson = sDateJson.Substring(0, sDateJson.Length - 1);
//}
}
}
}
}
}
GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 个月前 )
960b763e
4 个月前
8c391e04
7 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)