前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="querenjiaofei.aspx.cs" Inherits="WebSite1_querenjiaofei" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看客户</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="pageAll">
<div class="page ">
<div>
<table id="Table1" border="1" cellpadding="1" cellspacing="1" width="98%">
<tr>
<td colspan="1" style="height: 39px; background-color: #cccccc">
<p>
<strong>客户信息</strong></p>
</td>
</tr>
<tr>
<td style="width: 100%" valign="top">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
DataKeyNames="id" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand"
OnClick="Button1_Click" Width="1432px">
<Columns>
<asp:BoundField DataField="id" HeaderText="订单编号" ReadOnly="True" SortExpression="id" />
<asp:BoundField DataField="name" HeaderText="订单名称" SortExpression="name" />
<asp:BoundField DataField="projecttype" HeaderText="项目类型" SortExpression="projecttype" />
<asp:BoundField DataField="shuliang" HeaderText="数量" SortExpression="shuliang" />
<asp:BoundField DataField="kehuid" HeaderText="客户编号" SortExpression="kehuid" />
<asp:BoundField DataField="price" HeaderText="单价" SortExpression="price" />
<asp:BoundField DataField="allprice" HeaderText="总金额" SortExpression="allprice" />
<asp:ButtonField ButtonType="Button" CommandName="Mod1" HeaderText="操作" Text="确认缴费">
<ItemStyle Width="30px" />
</asp:ButtonField>
</Columns>
</asp:GridView>
已缴费的订单共
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>条数据
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:yinshuaqiyeConnectionString8 %>"
SelectCommand="SELECT * FROM [dingdan] WHERE (([zhixingzhuangtai] = @zhixingzhuangtai) AND ([beizhu] = @beizhu))"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:Parameter DefaultValue="信用审核通过" Name="zhixingzhuangtai" Type="String" />
<asp:Parameter DefaultValue="未缴费" Name="beizhu" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
后台代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Timers;
public partial class WebSite1_querenjiaofei : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
string date = System.DateTime.Now.Date.ToString();
string Key = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();
SqlConnection mcon = new SqlConnection("Data Source=.;database=yinshuaqiye;user id=sa;password=;");
mcon.Open();
SqlCommand b = new SqlCommand("select * from dingdan where id='" + Key + "'", mcon);
SqlDataReader dr = b.ExecuteReader();
if (dr != null)
{
string a = dr["kehuid"].ToString();
string c = dr["allprice"].ToString();
if (e.CommandName == "Mod1")
{
SqlCommand inscom2 = new SqlCommand("insert into jiaofeitongzhi values('" + Key + "','" + a + "','" + c + "','" + date + "')", mcon);
inscom2.ExecuteNonQuery();
}
// Response.Redirect("shenhekehuxinyong.aspx");
mcon.Close();
}
}
}