Author: bendewey Date: Sun Jul 19 03:09:19 2009 New Revision: 795469 URL: http://svn.apache.org/viewvc?rev=795469&view=rev Log: STONEHENGE-84 part2, forgot to add new files
Added: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs Added: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx?rev=795469&view=auto ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx (added) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx Sun Jul 19 03:09:19 2009 @@ -0,0 +1,102 @@ +<%@ Page Title="Apache Stonehenge - .NET StockTrader - Config" Language="C#" MasterPageFile="~/Site.Master" + AutoEventWireup="true" CodeFile="ConfigurationAdd.aspx.cs" Inherits="Trade.Web.ConfigurationAdd" %> + +<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> + <% /* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ %> +</asp:Content> +<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> + <div class="main-title"> + <h1> + Configuration</h1> + + <script type="text/javascript"> + var thisdate = new Date(); + document.writeln(thisdate.toLocaleString()); + </script> + + </div> + <table border="0" cellspacing="0" cellpadding="6" align="center" style="font-size: small"> + <tr> + <td style="width:50%"> + <asp:Label runat="server" ID="ServiceTypeLabel" Text="Service Type" AssociatedControlID="ServiceType" /> + <asp:RequiredFieldValidator runat="server" ID="ServiceTypeRequired" Text="*" + ErrorMessage="Please select a Service Type" ControlToValidate="ServiceType" /> + </td> + <td style="width:50%"> + <asp:RadioButtonList runat="server" ID="ServiceType"> + <asp:ListItem Value="BS">Business Service</asp:ListItem> + <asp:ListItem Value="OPS">Order Processing Service</asp:ListItem> + </asp:RadioButtonList> + </td> + </tr> + <tr> + <td> + <asp:Label runat="server" ID="ServiceNameLabel" Text="Service Name" AssociatedControlID="ServiceName" /> + <asp:RequiredFieldValidator runat="server" ID="ServiceNameRequired" Text="*" + ErrorMessage="Please enter a Service Name" + ForeColor="Red" ControlToValidate="ServiceName" Font-Size="X-Small" /> + <asp:CustomValidator ID="ServiceNameValidator" runat="server" + Text="*" + ErrorMessage="Must end in _BS or _OPS" Font-Size="X-Small" + OnServerValidate="ServiceNameValidator_ServerValidate"></asp:CustomValidator> + </td> + <td> + <asp:TextBox ID="ServiceName" runat="server" Width="290px" /> + </td> + </tr> + <tr> + <td> + <asp:Label runat="server" ID="NewURLLabel" Text="Service URL" AssociatedControlID="NewURL" /> + <asp:RequiredFieldValidator runat="server" ID="NewURLRequired" Text="*" + ErrorMessage="Please enter a Service URL" + ControlToValidate="NewURL" ForeColor="Red" Font-Size="X-Small" /> + <asp:RegularExpressionValidator ID="UrlExpressionValidator" runat="server" + ValidationExpression="http(s)?://([\w-\.]+|(\d{1-3}\.?){4})*(:\d*)?(/.*)?" + ControlToValidate="NewURL" Text="*" ErrorMessage="Invalid URL specified please use (http://...)" + Font-Size="X-Small" /> + </td> + <td> + <asp:TextBox ID="NewURL" runat="server" Width="290px" /> + </td> + </tr> + <tr style="height:50px;"> + <td> + + </td> + <td valign="top"> + <asp:CheckBox ID="IsSec" runat="server" Text="Uses secure messaging" /> + </td> + </tr> + <tr> + <td colspan="2" class="validator"> + <asp:ValidationSummary runat="server" Id="ValidationSummary1" + Font-Size="X-Small" /> + </td> + </tr> + <tr> + <td style="text-align: right;"> + <asp:Button ID="AddButton" runat="server" Text=" Add " CssClass="button" + OnClick="AddButton_Click" /> + </td> + <td> + <asp:Button ID="CancelButton" runat="server" Text="Cancel" + CssClass="button" OnClick="CancelButton_Click" ValidationGroup="CancelGroup" /> + </td> + </tr> + </table> +</asp:Content> Added: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs?rev=795469&view=auto ============================================================================== --- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs (added) +++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/ConfigurationAdd.aspx.cs Sun Jul 19 03:09:19 2009 @@ -0,0 +1,77 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using System; +using System.Web.UI.WebControls; +using Trade.ConfigClient; +using Trade.ConfigServiceDataContract; +using Trade.StockTraderWebApplicationSettings; + +namespace Trade.Web +{ + public partial class ConfigurationAdd : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + this.ServiceType.SelectedValue = Request.QueryString["type"]; + } + } + + protected void AddButton_Click(object sender, EventArgs e) + { + Page.Validate(); + if (Page.IsValid) + { + ConfigServiceClient configClient = new ConfigServiceClient(); + + ServiceLocation newOps = new ServiceLocation(); + newOps.ServiceName = this.ServiceName.Text; + newOps.ServiceURL = this.NewURL.Text; + newOps.Sec = this.IsSec.Checked; + + //update the service location + configClient.SetServiceLocation(newOps); + + Response.Redirect(Settings.PAGE_CONFIGURATION_ADVANCED); + } + } + + protected void ServiceNameValidator_ServerValidate(object source, ServerValidateEventArgs e) + { + string validEnding = ""; + if (this.ServiceType.SelectedValue == "BS") + validEnding = "_BS"; + else + validEnding = "_OPS"; + validEnding += this.IsSec.Checked ? "SEC" : ""; + + // Validate Ending + if (!this.ServiceName.Text.EndsWith(validEnding)) + { + this.ServiceNameValidator.ErrorMessage = "Must end in " + validEnding; + e.IsValid = false; + } + } + + protected void CancelButton_Click(object sender, EventArgs e) + { + Response.Redirect(Settings.PAGE_CONFIGURATION_ADVANCED, true); + } + } +}