汇率转换
1 using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Web; 5 using System.Web.Security; 6 using System.Web.UI; 7 using System.Web.UI.WebControls; 8 using System.Web.UI.WebControls.WebParts; 9 using System.Web.UI.HtmlControls; 10 11 public partial class _Default : System.Web.UI.Page 12 { 13 /// <summary> 14 /// calcalate the Line and return the result 15 /// </summary> 16 /// <param name="tableItem"></param> 17 /// <param name="tableUnit"></param> 18 /// <param name="tableUnitRate"></param> 19 /// <param name="tableVolume"></param> 20 /// <returns></returns> 21 public string calculate(string tableItem, string tableUnit, double tableUnitRate, double tableVolume,int listNo) 22 { 23 double tableAmount = 0.0; 24 tableAmount = tableUnitRate * tableVolume; 25 string tableLine = ""; 26 27 tableLine += "<tr><td>" + tableItem + "</td><td>" + tableUnit + "</td><td>" + tableUnitRate.ToString("C") + "</td><td>" + "<input name='Text" + listNo.ToString() + "' type='text'value='" + tableVolume.ToString() + "' /></td><td>" + tableAmount.ToString("C") + "</td></tr>"; 28 29 return (tableLine); 30 } 31 protected void Page_Load(object sender, EventArgs e) 32 { 33 int listNo = 7; 34 string lblText = ""; 35 for (int i = 0; i < listNo; i++) 36 { 37 lblText =lblText + calculate("100% matched(with review)", "word", 0.250, 0.0,i); 38 } 39 lblLine.Text = lblText; 40 } 41 42 private void calculate() 43 { 44 throw new Exception("The method or operation is not implemented."); 45 } 46 47 protected void Button1_Click(object sender, EventArgs e) 48 { 49 double[]input =new double [8]; 50 for (int i = 0; i < 7; i++) 51 { 52 input[i]= double.Parse(Request.Form[("Text"+i.ToString())].ToString()); 53 } 54 55 lblLine.Text = calculate("100% matched(with review)", "word", 0.250, input[0],0) + 56 calculate("100% matched(no review)", "word", 0.250, input[1],1) + 57 calculate("95%-99% matched(with review)", "word", 0.250, input[2],2) + 58 calculate("85%-94% matched(with review)", "word", 0.250, input[3],3) + 59 calculate("75%-84% matched(with review)", "word", 0.250, input[4],4) + 60 calculate("50%-74% matched(with review)", "word", 0.250, input[5],5) + 61 calculate("No match", "word", 0.250, input[6],6); 62 } 63 }
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!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 runat="server"> <title>test</title> </head> <body> <form id="form1" runat="server"> <table border="1"> <tr> <td> Batch name</td> </tr> <tr> <td> Item</td> <td> Unit</td> <td> CN</td> <td> </td> <td> </td> <td> KR</td> <td> JP</td> <td> Remark</td> <td style="width: 23px"> TC</td> </tr> <tr> <td> </td> <td> </td> <td> Unit Rate</td> <td> Volume</td> <td> Amount</td> </tr> <tr> <td colspan="9"> Translation and Review</td> </tr> <asp:Label ID="lblLine" runat="server" Text="Label"></asp:Label></table> <asp:Button ID="Button1" runat="server" Text="calculate" OnClick="Button1_Click" /> </form> </body> </html>
1 <?xml version="1.0"?> 2 <!-- 3 注意: 除了手动编辑此文件以外,您还可以使用 4 Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的 5 “网站”->“Asp.Net 配置”选项。 6 设置和注释的完整列表在 7 machine.config.comments 中,该文件通常位于 8 \Windows\Microsoft.Net\Framework\v2.x\Config 中 9 --> 10 <configuration> 11 <appSettings/> 12 <connectionStrings/> 13 <system.web> 14 <!-- 15 设置 compilation debug="true" 将调试符号插入 16 已编译的页面中。但由于这会 17 影响性能,因此只在开发过程中将此值 18 设置为 true。 19 --> 20 <compilation debug="true"/> 21 <!-- 22 通过 <authentication> 节可以配置 ASP.NET 使用的 23 安全身份验证模式, 24 以标识传入的用户。 25 --> 26 <authentication mode="Windows"/> 27 <!-- 28 如果在执行请求的过程中出现未处理的错误, 29 则通过 <customErrors> 节可以配置相应的处理步骤。具体说来, 30 开发人员通过该节可以配置 31 要显示的 html 错误页 32 以代替错误堆栈跟踪。 33 34 <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 35 <error statusCode="403" redirect="NoAccess.htm" /> 36 <error statusCode="404" redirect="FileNotFound.htm" /> 37 </customErrors> 38 --> 39 <globalization culture="en-AU" uiCulture="en"/> 40 </system.web> 41 </configuration>