diff --git a/Site5/App_Code/FieldValidation.cs b/Site5/App_Code/FieldValidation.cs
deleted file mode 100644
index 8ea166f2..00000000
--- a/Site5/App_Code/FieldValidation.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System;
-using System.Globalization;
-using System.Web;
-using System.Web.Script.Services;
-using System.Web.Services;
-using Swarmops.Logic.Support;
-
-///
-/// Summary description for FieldValidation
-///
-[WebService (Namespace = "http://tempuri.org/")]
-[WebServiceBinding (ConformsTo = WsiProfiles.BasicProfile1_1)]
-// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
-[ScriptService]
-public class FieldValidation : WebService
-{
- private CultureInfo GetUserCulture()
- {
- // Determine correct culture for parsing
- CultureInfo culture = null;
-
- // Set default culture (English, United States, but that doesn't work so fake it to GB)
- string preferredCulture = "en-US";
-
- // ----------- SET CULTURE ------------
- // Does the user have a culture preference?
-
- if (HttpContext.Current.Request.Cookies["PreferredCulture"] != null)
- {
- // Yes, set it
- preferredCulture = HttpContext.Current.Request.Cookies["PreferredCulture"].Value;
- }
- else
- {
- // No, determine from browser
- string browserPreference = "en-GB";
- if (HttpContext.Current.Request.UserLanguages != null &&
- HttpContext.Current.Request.UserLanguages.Length > 0)
- {
- browserPreference = HttpContext.Current.Request.UserLanguages[0];
- preferredCulture = browserPreference;
- }
- }
-
- // Actually set the culture
-
- try
- {
- culture = CultureInfo.CreateSpecificCulture (preferredCulture);
- }
- catch (Exception)
- {
- culture = CultureInfo.InvariantCulture;
- }
-
- return culture;
- }
-
-
- [WebMethod]
- public bool IsDateValid (string input)
- {
-
- }
-}
\ No newline at end of file
diff --git a/Site5/Automation/FieldValidation.asmx b/Site5/Automation/FieldValidation.asmx
deleted file mode 100644
index ba3c486a..00000000
--- a/Site5/Automation/FieldValidation.asmx
+++ /dev/null
@@ -1 +0,0 @@
-<%@ WebService Language="C#" CodeBehind="~/App_Code/FieldValidation.cs" Class="FieldValidation" %>
diff --git a/Site5/Automation/FieldValidation.aspx.cs b/Site5/Automation/FieldValidation.aspx.cs
index 199d49b2..b3e33bea 100644
--- a/Site5/Automation/FieldValidation.aspx.cs
+++ b/Site5/Automation/FieldValidation.aspx.cs
@@ -32,7 +32,7 @@ namespace Swarmops.Frontend.Automation
[WebMethod]
- public bool IsAmountValid(string amount)
+ public static bool IsAmountValid(string amount)
{
AuthenticationData authData = GetAuthenticationDataAndCulture(); // sets culture
@@ -51,7 +51,7 @@ namespace Swarmops.Frontend.Automation
}
[WebMethod]
- public bool AreDocumentsUploaded(string guidString)
+ public static bool AreDocumentsUploaded(string guidString)
{
Documents documents = Documents.RecentFromDescription(guidString);
diff --git a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs
index 6c8c9322..bb2527f4 100644
--- a/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs
+++ b/Site5/Pages/v5/Financial/FileExpenseClaim.aspx.cs
@@ -111,7 +111,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
EasyUIControlsUsed = EasyUIControl.Tree;
- IncludedControlsUsed = IncludedControl.FileUpload;
+ IncludedControlsUsed = IncludedControl.FileUpload | IncludedControl.JsonParameters;
}
diff --git a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx
index 7ba74aa7..e9d14c1e 100644
--- a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx
+++ b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx
@@ -33,7 +33,7 @@
if (msg.d != true) {
isValid = false;
alertify.error("");
- $('#<%=this.TextAmount.ClientID %>').focus();
+ $('#<%=this.TextAmount.ClientID %>').addClass("entryError").focus();
}
}
});
@@ -44,6 +44,7 @@
function validateTextField (fieldId, message) {
if ($(fieldId).val().length == 0) {
alertify.error(message);
+ $(fieldId).addClass("entryError");
$(fieldId).focus();
return false;
}
diff --git a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs
index 44982fcc..7165d0e4 100644
--- a/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs
+++ b/Site5/Pages/v5/Financial/RequestCashAdvance.aspx.cs
@@ -33,6 +33,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
}
EasyUIControlsUsed = EasyUIControl.Tree;
+ IncludedControlsUsed = IncludedControl.JsonParameters;
}
@@ -47,7 +48,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
this.LabelBankClearing.Text = Resources.Pages.Financial.RequestCashAdvance_BankClearing;
this.LabelBankAccount.Text = Resources.Pages.Financial.RequestCashAdvance_BankAccount;
- this.LiteralErrorAmount.Text = Resources.Pages.Financial.RequestCashAdvance_ValidationError_Amount;
+ this.LiteralErrorAmount.Text = String.Format(Resources.Pages.Financial.RequestCashAdvance_ValidationError_Amount, CurrentOrganization.Currency.DisplayCode);
this.LiteralErrorPurpose.Text = Resources.Pages.Financial.RequestCashAdvance_ValidationError_Purpose;
this.LiteralErrorBudget.Text = Resources.Pages.Financial.RequestCashAdvance_ValidationError_Budget;
this.LiteralErrorBankName.Text = Resources.Pages.Financial.RequestCashAdvance_ValidationError_BankName;
diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx b/Site5/Pages/v5/Swarm/AddPerson.aspx
index 3548bb06..b848f2f2 100644
--- a/Site5/Pages/v5/Swarm/AddPerson.aspx
+++ b/Site5/Pages/v5/Swarm/AddPerson.aspx
@@ -132,33 +132,34 @@
function ValidateFields() {
var isValid = true;
- isValid = ValidateTextField('#<%= TextCity.ClientID %>', "") && isValid;
- isValid = ValidateTextField('#<%= TextStreet1.ClientID %>', "") && isValid;
- isValid = ValidateTextField('#<%= TextMail.ClientID %>', "") && isValid;
- isValid = ValidateTextField('#<%= TextName.ClientID %>', "") && isValid; // TODO: Actually validate geography?
-
var dateFieldContents = $('#<%= TextDateOfBirth.ClientID%>').val();
if (dateFieldContents.length > 0) {
- alert('testing');
+ var jsonData = {};
+ jsonData.input = dateFieldContents;
$.ajax({
type: "POST",
url: "/Automation/FieldValidation.aspx/IsDateValid",
- data: "{'amount': '" + escape($('#<%=this.TextAmount.ClientID %>').val()) + "'}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false, // blocks until function returns - race conditions otherwise
- success: function (msg) {
- if (msg.d != true) {
- isValid = false;
- $('#TextAmount').addClass("entryError");
- alertify.error("");
- $('#<%=this.TextAmount.ClientID %>').focus();
+ data: $.toJSON(jsonData),
+ contentType: "application/json; charset=utf-8",
+ dataType: "json",
+ async: false, // blocks until function returns - race conditions otherwise
+ success: function (msg) {
+ if (msg.d != true) {
+ isValid = false;
+ $('#<%= TextDateOfBirth.ClientID %>').addClass("entryError");
+ alertify.error("");
+ $('#<%=this.TextDateOfBirth.ClientID %>').focus();
+ }
}
- }
- });
- }
+ });
+ }
+
+ isValid = ValidateTextField('#<%= TextCity.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%= TextStreet1.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%= TextMail.ClientID %>', "") && isValid;
+ isValid = ValidateTextField('#<%= TextName.ClientID %>', "") && isValid; // TODO: Actually validate geography?
return isValid;
}
diff --git a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
index e3ea41c8..984bde81 100644
--- a/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
+++ b/Site5/Pages/v5/Swarm/AddPerson.aspx.cs
@@ -9,6 +9,7 @@ using Swarmops.Logic.Communications;
using Swarmops.Logic.Communications.Transmission;
using Swarmops.Logic.Security;
using Swarmops.Logic.Structure;
+using Swarmops.Logic.Support;
using Swarmops.Logic.Swarm;
// ReSharper disable once CheckNamespace
@@ -68,6 +69,7 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
this.LiteralErrorMail.Text = Resources.Pages.Swarm.AddPerson_ErrorMail;
this.LiteralErrorName.Text = Resources.Pages.Swarm.AddPerson_ErrorName;
this.LiteralErrorStreet.Text = Resources.Pages.Swarm.AddPerson_ErrorStreet;
+ this.LiteralErrorDate.Text = Resources.Pages.Swarm.AddPerson_ErrorDate;
this.BoxTitle.Text = PageTitle = String.Format (Resources.Pages.Swarm.AddPerson_Title,
Participant.Localized (CurrentOrganization.RegularLabel));
@@ -100,7 +102,12 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
protected void ButtonSubmit_Click (object sender, EventArgs e)
{
- // TODO: Parse birthdate
+ DateTime dateOfBirth = new DateTime (1800, 1, 1); // null equivalent
+
+ if (this.TextDateOfBirth.Text.Length > 0)
+ {
+ dateOfBirth = DateTime.Parse (this.TextDateOfBirth.Text);
+ }
Person newPerson = Person.Create (this.TextName.Text, this.TextMail.Text, string.Empty, this.TextPhone.Text,
this.TextStreet1.Text + this.TextStreet2.Text,
@@ -111,7 +118,11 @@ namespace Swarmops.Frontend.Pages.v5.Swarm
OutboundComm.CreateMembershipLetter (ParticipantMailType.MemberAddedWelcome, newMembership, CurrentUser);
- // TODO: LOG
+ SwarmopsLogEntry logEntry = SwarmopsLog.CreateEntry (newPerson,
+ new Swarmops.Logic.Support.LogEntries.PersonAddedLogEntry (newMembership, CurrentUser));
+
+ logEntry.CreateAffectedObject (newMembership);
+ logEntry.CreateAffectedObject (CurrentUser);
// Clear form and make way for next person