⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardetail.aspx

📁 ASP.NET Web Forms Techniques
💻 ASPX
📖 第 1 页 / 共 3 页
字号:
    sqlComm.Parameters.Add("@ColorName", sColorName);
    sqlComm.Parameters.Add("@BasePrice", dBasePrice);
    sqlComm.Parameters.Add("@Interest", dInterest);
    sqlComm.Parameters.Add("@TotalPrice", dTotalPrice);
    sqlComm.Parameters.Add("@PaymentMonths", iPaymentMonths);
    sqlComm.Parameters.Add("@PaymentAmount", dPaymentAmount);
    sqlComm.Parameters.Add("@QuoteOrderID", 0);
    sqlComm.Parameters["@QuoteOrderID"].Direction = ParameterDirection.Output;

    // execute the stored procedure
    if (sqlComm.ExecuteNonQuery() != 1) {
      // throw an Exception to display error message
      throw new Exception("* Could not insert new Quote into database.");
    }

    // get value of new quote ID from parameters
    long iQuoteID = (long)sqlComm.Parameters["@QuoteOrderID"].Value;

    // change stored procedure name for updating Extras table
    sqlComm.CommandText = sSaveExtraLine;

    // clear parameters colection and add parameters for Extras table
    sqlComm.Parameters.Clear();
    sqlComm.Parameters.Add("@QuoteOrderID", iQuoteID);
    sqlComm.Parameters.Add("@ExtraID", 0);
    sqlComm.Parameters.Add("@ExtraName", "");
    sqlComm.Parameters.Add("@ExtraPrice", 0);

    // get reference to tblOptionExtra in DataSet
    DataTable oDTExtras = oCarsDS.Tables["CarExtras"];

    // iterate through the Extras selected in page seeing
    // if each one is selected
    foreach (ListItem oItem in chkExtras.Items) {
      if (oItem.Selected) {

        // get a refernce to the matching row in the DataSet
        sFilter = "DisplayText = '" + oItem.Text + "'";
        aRows =  oDTExtras.Select(sFilter, "");

        // set value of last three parameters
        sqlComm.Parameters["@ExtraID"].Value = aRows[0]["ExtraID"];
        sqlComm.Parameters["@ExtraName"].Value = aRows[0]["ExtraText"];
        sqlComm.Parameters["@ExtraPrice"].Value = aRows[0]["ExtraPrice"];

        // execute the stored procedure
        if (sqlComm.ExecuteNonQuery() != 1) {
          // throw an Exception to display error message
          throw new Exception("* Could not insert new Optional Extra row into database.");
        }
      }
    }

    // no errors, so commit all the updates
    oTransaction.Commit();

  }
  catch (Exception e) {

    // error encountered so roll back all the updates
    oTransaction.Rollback();

    // display error details
    lblMessage.Text = "* Error while inserting Quote. "
                    + e.Message;
    return;  // and stop execution
  }
  finally {
    sqlConn.Close();
  }

  // display "OK" message and link to MyCars page
  Char sQUOT = (Char)34;
  lblMessage.Text = "Your quotation has been saved.<br />Go to the <a href="
    + sQUOT + "javascript:mainWindowPage('secure/mycars.aspx', true)"
    + sQUOT + "><font color=" + sQUOT + "#b50055" + sQUOT
    + ">My Cars</font></a> page to view it and place an order.";

  // hide the Save button
  btnSave.Visible = false;
}

// -------------------------------------------------------------------
</script>

<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<basefont size="2" face="Tahoma,Arial,Helvetica,sans-serif">
<link rel="stylesheet" type="text/css"
      href="stylesheets/wcc<% = sStyleSize %>.css" />
<title id="elmTitle" runat="server" />
</head>
<body bgcolor="#ffffff" class="body-text">

<div style="position:absolute;height:0px;"><font size="1" color=#ffffff">
<!-- skip link for aural page readers -->
<layer visibility="hidden">
<a href="#content" style="color:#ffffff;font-size:1px;text-decoration:none"><img width="1" height="1" hspace="0" vspace="0" src="images/_blnk.gif" border="0" alt="Skip to Content" /></a>
</layer>
</font></div>

<form runat="server">

<!-- model description and image -->
<table border="0" cellspacing="5" cellpadding="0">
<tr>
<td valign="top"><font face="Arial,Helvetica,sans-serif" size="1">
  <asp:Label class="fixed-small-text" id="lblPrecis" runat="server" />
  </font></td>
<td rowspan="2" id="tclColor" bgcolor="White" nowrap="true" runat="server">
  <asp:Image id="imgCar" runat="server" /></td>
</tr><tr>
<td><font face="Arial,Helvetica,sans-serif" size="3" color="#b50055"><b>
  Price of vehicle: $<asp:Label id="lblPrice" CssClass="large-red-text" runat="server" /></b>
  </font><font face="Arial,Helvetica,sans-serif" size="2"><br />
  <b><asp:Label id="lblTerms" CssClass="body-text" Text="&nbsp;" runat="server" /></b>
  </font></td>
</tr>
</table>
<p />

<a name="content" />

<!-- tab strip and model details multipage control -->
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr><td>
<ie:TabStrip id="tsCarDetail" runat="server"
  style="width:100%"
  TargetID="mpCarDetail"
  TabDefaultStyle="background-color:#cccccc; border-width:1px;
                   border-style:solid; border-color:#666666;
                   font-weight:bold; text-align:center;
                   font-family:Arial,Helvetica,sans-serif;
                   font-size:11px; height:21; width:79;"
  TabHoverStyle="color:#ff0000; text-decoration:underline;
                   background-color:#cccccc;"
  TabSelectedStyle="background-color:#ffffff; border-bottom:none"
  SepDefaultStyle="background-color:#ffffff; border-top:none;
                   border-left:none; border-right:none">
  <ie:Tab Text="Colors"/>
  <ie:Tab Text="Engine"/>
  <ie:Tab Text="Extras"/>
  <ie:Tab Text="Details"/>
  <ie:Tab Text="Finance"/>
</ie:TabStrip></td>

</tr><tr>

<td nowrap="nowrap">
  <ie:MultiPage id="mpCarDetail" runat="server"
                style="border-width:1px; border-style:solid;
                       border-color:#666666; border-top:none">

  <ie:PageView id="mpColors">
  <!-- section for "Colors" tab -->
    <table border="0" cellpadding="6">
      <tr>
        <td><img src="images/_blnk.gif" border="0" width="1" height="170" alt="" /></td>
        <td><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text"><b>Select a Color:</b></span><br />
          <asp:RadioButtonList id="optColorType" OnSelectedIndexChanged="SelectColorType"
               Font-Name="Tahoma,Arial,Helvetica,sans-serif" Font-Size="10"
               AutoPostBack="True" CssClass="body-text" runat="server">
            <asp:ListItem Text="Standard Colors" Value="optColStandard" Selected="True" />
            <asp:ListItem Text="Metallic Colors" Value="optColMetallic" />
          </asp:RadioButtonList></font></td>
        <td><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
        <asp:DataList id="dlsColors" runat="server" CellSpacing="5"
             RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="6">
          <ItemTemplate>
            <input type="image" id="imgColor" runat="server" OnServerClick="SelectColor"
                 Src='<%# DataBinder.Eval(Container.DataItem, "Color", "images/colors/{0}.gif") %>'
                 Alt='<%# DataBinder.Eval(Container.DataItem, "Color") %>' Width="60" Height="30" Border="1"
                 Title='<%# DataBinder.Eval(Container.DataItem, "Color") %>'
                 Style="border-width:1px;border-style:solid;border-color:Black;" />
          </ItemTemplate>
        </asp:DataList></font></td>
      </tr>
    </table>
  </ie:PageView>

  <ie:PageView id="mpEngine">
  <!-- section for "Engine" tab -->
    <table border="0" cellpadding="6">
      <tr>
        <td><img src="images/_blnk.gif" width="1" height="170" alt="" /></td>
        <td><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text"><b>Select an Engine:</b></span><br />
          <asp:RadioButtonList id="optEngine" OnSelectedIndexChanged="SelectEngine"
               Font-Name="Tahoma,Arial,Helvetica,sans-serif" Font-Size="10"
               AutoPostBack="True" CssClass="body-text" runat="server" /></font></td>
        <td><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:DataGrid id="dgrEngine" runat="server" AutoGenerateColumns="False"
               CellPadding="4"
               Font-Size="10"
               Font-Name="Tahoma,Arial,Helvetica,sans-serif"
               HeaderStyle-HorizontalAlign="center"
               HeaderStyle-BackColor="#b50055"
               HeaderStyle-ForeColor="#ffffff"
               HeaderStyle-Font-Bold="True"
               ItemStyle-HorizontalAlign="center"
               SelectedItemStyle-BackColor="#ffffcc">
            <Columns>
              <asp:BoundColumn HeaderText="Capacity" DataField="CubicCapacity"
                   DataFormatString="{0:#,###0cc}" />
              <asp:BoundColumn HeaderText="Fuel Type" DataField="FuelType" />
              <asp:BoundColumn HeaderText="Cyls" DataField="Cylinders" />
              <asp:BoundColumn HeaderText="Turbo" DataField="Turbo" />
              <asp:BoundColumn HeaderText="Max RPM" DataField="MaxRPM"
                   DataFormatString="{0:#,###0}" />
              <asp:BoundColumn HeaderText="BHP" DataField="BHP" />
              <asp:BoundColumn HeaderText="Gears" DataField="Gears" />
              <asp:BoundColumn HeaderText="Auto" DataField="AutoTrans" />
            </Columns>
          </asp:DataGrid></font></td>
      </tr>
    </table>
  </ie:PageView>

  <ie:PageView id="mpExtras">
  <!-- section for "Extras" tab -->
    <table border="0" cellpadding="6">
      <tr>
        <td><img src="images/_blnk.gif" width="1" height="170" alt="" /></td>
        <td valign="top"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <p>&nbsp;</p><span style="body-text"><b>Optional Extras</b><br />
          Select the extras<br />you would like to<br />add to your new<br />
          vehicle:</span></font></td>
        <td nowrap="nowrap"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <asp:CheckBoxList id="chkExtras" OnSelectedIndexChanged="SelectExtras"
               RepeatLayout="Table" RepeatColumns="2" RepeatDirection="Vertical"
               Font-Name="Tahoma,Arial,Helvetica,sans-serif" Font-Size="10"
               CellPadding="3" BackColor="#ffffcc"
               AutoPostBack="True" CssClass="body-text" runat="server">
          </asp:CheckBoxList></font></td>
      </tr>
    </table>
  </ie:PageView>

  <ie:PageView id="mpDetails">
  <!-- section for "Details" tab -->
    <table border="0" cellpadding="6">
      <tr>
        <td><img src="images/_blnk.gif" width="1" height="170" alt="" /></td>
        <td valign="top"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <p>&nbsp;</p><span style="body-text"><b>Vehicle Details</b><br />
          Select any of the<br />categories shown<br />here to see more<br />
          details:</span></font></td>
        <td>&nbsp; &nbsp;</td>
        <td valign="top"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text">
          <ie:TreeView id="tvwDetailsLeft" runat="server" OnExpand="NodeExpanded"
              DefaultStyle="font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:11px;"
              HoverStyle="color:#000000;background:#ffffff;"
              SelectedStyle="color:#000000;background:#ffffff;" />
          </span></font></td>
        <td>&nbsp; &nbsp;</td>
        <td valign="top"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text">
          <ie:TreeView id="tvwDetailsRight" runat="server" OnExpand="NodeExpanded"
              DefaultStyle="font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:11px;"
              HoverStyle="color:#000000;background:#ffffff;"
              SelectedStyle="color:#000000;background:#ffffff;" />
          </span></font></td>
      </tr>
    </table>
  </ie:PageView>

  <ie:PageView id="mpFinance">
  <!-- section for "Finance" tab -->
    <table border="0" cellpadding="6">
      <tr>
        <td><img src="images/_blnk.gif" width="1" height="170" alt="" /></td>
        <td valign="top"><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <p>&nbsp;</p><span style="body-text"><b>Finance Terms&nbsp;</b><br />
          Specify how you<br />would prefer to<br />finance the cost<br />of your new<br />
          vehicle:</span></font></td>
        <td><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text"> &nbsp;
          <asp:RadioButton id="optByMonths" GroupName="optFinanceMethod"
               Checked="True" Text="" CssClass="body-text" runat="server"
               ToolTip="Select payment over a specified number of months" />
          I would like to pay the total cost over
          <asp:DropDownList id="lstFinanceMonths" CssClass="body-text"
               OnChange="setOptionButtons('optByMonths')" runat="server" />
          months.<br /> &nbsp;
          <asp:RadioButton id="optByAmount" GroupName="optFinanceMethod"
               Text="" CssClass="body-text" runat="server"
               ToolTip="Select payment of a specified monthly amount" />
          I am prepared to pay up to $
          <asp:TextBox id="txtMonthPayment" Text="1,000" Columns="4" MaxLength="7"
                CssClass="body-text" runat="server" OnKeyDown="setOptionButtons('optByAmount')"
                ToolTip="Enter the monthly payment amount" />
          each month.<p />
          <asp:Label id="lblFinanceResult" CssClass="body-text" runat="server" /><br />
          </span></font><font face="Tahoma,Arial,Helvetica,sans-serif" size="1">
          <asp:Label id="lblFinanceInfo" CssClass="small-text" runat="server"
               Text="Select the payment options you prefer and click <b>Calculate</b>." />
          <p /></font><font face="Tahoma,Arial,Helvetica,sans-serif" size="2">
          <span style="body-text">
          <asp:Button id="btnCalculate" Text="Calculate" OnClick="ShowFinanceTerms"
               CssClass="body-text" ToolTip="Calculate the options selected above" runat="server" />
          <asp:Button id="btnCancel" Text="Cancel" OnClick="ClearFinanceTerms"
               CssClass="body-text" Enabled="False"
               ToolTip="Cancel existing finance package" runat="server" />
          </span></font></td>
      </tr>
    </table>
  </ie:PageView>

</ie:MultiPage></td>

</tr>
</table>

<br />

<!-- label to display information and error messages -->
<font face="Arial,helvetica,sans-serif" size="3" color="#b50055"><b>
<asp:Label id="lblMessage" EnableViewState="False" class="large-red-text" runat="server" /></b></font>

<!-- "save quote" and "window close" buttons -->
<table border="0" width="100%">
 <tr>
  <td><font face="Arial,helvetica,sans-serif" size="2">
   Select the specification and optional extras you require for your new vehicle,
   and <b>Save</b> this configuration as a quotation. Then you can place an
   order by registering in the
   <a href="javascript:mainWindowPage('secure/mycars.aspx', true)">
     <font color="#000000"><b>MyCars</b></font></a> page.</font></td>
  <td align="right" nowrap="nowrap">
   <input id="btnSave" type="image" src="images/btn_save.gif" Visible="False" runat="server"
          width="100" height="49" border="0" OnServerClick="SaveCarDetails"
          alt="Save this specification as a quote for future reference" />
   <a href="javascript:window.close()"><img src="images/btn_close.gif" border="0"
      width="100" height="49" alt="Close this window" /></a></td>
 </tr></table>
</form>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -