前端
<%@ 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); //} } } } } }
Copyright © 2004-2024 Ynicp.com 版权所有 法律顾问:建纬(昆明)律师事务所 昆明市网翼通科技有限公司 滇ICP备08002592号-4