显示详细信息

来源:互联网 发布:如何分辨中日韩人 知乎 编辑:程序博客网 时间:2024/05/20 19:32

 前台代码:

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Contract_detail.aspx.cs" Inherits="Contract_detail" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head runat="server">
  5.     <title>显示合同详细信息</title>
  6. </head>
  7. <body style="margin-top: 0px; margin-left: 0px; margin-right: 0px;  font-family:宋体; font-size:14px; text-align: center;">
  8.     <form id="form1" runat="server">
  9.     <div>
  10.         <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; heihgt: 100%">
  11.             <tr>
  12.                 <td style="width: 176px; height: 14px" valign="top">
  13.                     <menu1:menu ID="menu1" runat="server" />
  14.                 </td>
  15.                 <td style="height: 14px; width: 777px;" valign="top">
  16.                     <table id="Table1" border="1" cellpadding="1" cellspacing="1" style="width: 539px;
  17.                         height: 248px">
  18.                         <tr>
  19.                             <td style="width: 534px; height: 31px; background-color: #cccccc">
  20.                                 <p>
  21.                                     <strong>合同明细表</strong></p>
  22.                             </td>
  23.                         </tr>
  24.                         <tr>
  25.                             <td style="width: 534px; height: 189px" valign="middle">                            
  26.                                 
  27.                                 <span >
  28.                                     <asp:Repeater ID="Repeater1" runat="server">
  29.                                     <ItemTemplate>
  30.                                         <table style="width: 600px">
  31.                         <tr>
  32.                             <td style="width: 150px">客户名称
  33.                             </td>
  34.                             <td style="width: 150px"><%#Eval("custom_name") %>
  35.                             </td>
  36.                             <td style="width: 150px">产品名称
  37.                             </td>
  38.                             <td style="width: 150px"><%#Eval("product_name") %>
  39.                             </td>
  40.                         </tr>
  41.                         <tr>
  42.                             <td style="width: 150px">订货数量
  43.                             </td>
  44.                             <td style="width: 150px"><%#Eval("product_book") %>
  45.                             </td>
  46.                             <td style="width: 150px">已发货数量
  47.                             </td>
  48.                             <td style="width: 150px"><%#Eval("product_send") %>
  49.                             </td>
  50.                         </tr>
  51.                         <tr>
  52.                             <td style="width: 150px">单价
  53.                             </td>
  54.                             <td style="width: 150px"><%#Eval("product_price") %>
  55.                             </td>
  56.                             <td style="width: 150px">签署日期
  57.                             </td>
  58.                             <td style="width: 150px"><%#Eval("contract_start") %>
  59.                             </td>
  60.                         </tr>
  61.                         <tr>
  62.                             <td style="width: 150px">发货日期
  63.                             </td>
  64.                             <td style="width: 150px"><%#Eval("contract_send") %>
  65.                             </td>
  66.                             <td style="width: 150px">完成日期
  67.                             </td>
  68.                             <td style="width: 150px"><%#Eval("contract_finish") %>
  69.                             </td>
  70.                         </tr>
  71.                         <tr>
  72.                             <td style="width: 150px">经办人
  73.                             </td>
  74.                             <td style="width: 150px"><%#Eval("contract_person") %>
  75.                             </td>
  76.                             <td style="width: 150px">总金额
  77.                             </td>
  78.                             <td style="width: 150px"><%#Eval("contract_price") %>
  79.                             </td>
  80.                         </tr>
  81.                         <tr>
  82.                             <td colspan="4">合同执行状态:<%#Eval("contract_state") %>
  83.                             </td>                            
  84.                         </tr>
  85.                     </table>
  86.                                     </ItemTemplate>
  87.                         
  88.                  </asp:Repeater>
  89.                                     合同状态:0-签署态,1-发货态,2-完成态</span><br />
  90.                             </td>
  91.                         </tr>
  92.                         <tr>
  93.                             <td style="width: 534px; background-color: #cccccc">
  94.                                 <asp:Button ID="Btn_back" runat="server" OnClick="Btn_back_Click" Text="返回" /></td>
  95.                         </tr>
  96.                     </table>
  97.                     
  98.                 </td>
  99.             </tr>
  100.         </table>
  101.     
  102.     </div>
  103.     </form>
  104. </body>
  105. </html>

后台代码:

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.OracleClient;
  12. public partial class Contract_detail : System.Web.UI.Page
  13. {
  14.     string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.             Display();
  19.     }
  20.     public void Display()
  21.     {
  22.         OracleConnection connection = new OracleConnection(connectionString);
  23.         string sqlstr = "select c.*,d.product_book,d.product_send,d.product_price,custom_name,product_name  from contract c,contract_detail d,customer r,product t where c.contract_id=d.contract_id and c.contract_id=:contract_id and r.custom_id=c.custom_id and d.product_id=t.product_id";
  24.         OracleCommand cmd = new OracleCommand(sqlstr, connection);
  25.         cmd.Parameters.Add("contract_id", OracleType.Char).Value = Request.QueryString["contract_id"];
  26.         DataTable dt = new DataTable("细节");
  27.         OracleDataAdapter da = new OracleDataAdapter(cmd);
  28.         da.Fill(dt);
  29.         Repeater1.DataSource = dt;
  30.         Repeater1.DataBind();
  31.     }
  32.     protected void Btn_back_Click(object sender, EventArgs e)
  33.     {
  34.         Response.Redirect("Contract.aspx");
  35.     }
  36. }