diff --git a/Site/Automation/Formatting.aspx.cs b/Site/Automation/Formatting.aspx.cs index 352f7db6..c35ebaa6 100644 --- a/Site/Automation/Formatting.aspx.cs +++ b/Site/Automation/Formatting.aspx.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Security.Cryptography.X509Certificates; using System.Web; using System.Web.Services; using System.Web.UI; @@ -40,6 +41,7 @@ namespace Swarmops.Frontend.Automation return input.ToString("N2"); } + [WebMethod] public static AjaxInputCallResult FormatCurrencyString(string input) { @@ -57,5 +59,33 @@ namespace Swarmops.Frontend.Automation return new AjaxInputCallResult {Success = true, NewValue = (cents / 100.0).ToString("N2")}; } + + + public class AjaxDateValidationResult: AjaxInputCallResult + { + public string InterpretedDate { get; set; } + public string PresentedDate { get; set; } + } + + [WebMethod] + public static AjaxDateValidationResult InterpretDateString(string input) + { + GetAuthenticationDataAndCulture(); + + DateTime interpretedDate = DateTime.MinValue; + bool success = DateTime.TryParse(input, out interpretedDate); + + if (!success) + { + return new AjaxDateValidationResult() {Success = false}; + } + + return new AjaxDateValidationResult() + { + Success = true, + InterpretedDate = interpretedDate.ToString(CultureInfo.InvariantCulture), + PresentedDate = interpretedDate.ToString("yyyy MMM dd") + }; + } } } \ No newline at end of file diff --git a/Site/Controls/v5/Base/DateTextBox.ascx b/Site/Controls/v5/Base/DateTextBox.ascx new file mode 100644 index 00000000..7b1debaf --- /dev/null +++ b/Site/Controls/v5/Base/DateTextBox.ascx @@ -0,0 +1,59 @@ +<%@ Control Language="C#" AutoEventWireup="true" Inherits="Swarmops.Frontend.Controls.Base.DateTextBox" Codebehind="DateTextBox.ascx.cs" %> +<%@ Import Namespace="Swarmops.Common.Enums" %> + + + + <% if (this.Layout == LayoutDirection.Vertical) { %>