Index: dam clients/DamUI/trunk/src/Dam/Data/DamHelperFunctions.cs =================================================================== diff -u -r268 -r286 --- dam clients/DamUI/trunk/src/Dam/Data/DamHelperFunctions.cs (.../DamHelperFunctions.cs) (revision 268) +++ dam clients/DamUI/trunk/src/Dam/Data/DamHelperFunctions.cs (.../DamHelperFunctions.cs) (revision 286) @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -36,6 +37,44 @@ } /// + /// Convert Date to time stamp as needed by TNO AnySense. + /// + /// The date time. + /// + public static string DateToTimeStamp(DateTime dateTime) + { + // Following 2 lines is an example how to handle customization of this format. + // TNO at the last moment decided they did not need this change so we change it back to + // the default format + // string customFormat = "yyyy-MM-dd_HH-mm-ss"; + // return dateTime.ToString(customFormat); + return dateTime.ToString("s", DateTimeFormatInfo.InvariantInfo); + } + + /// + /// Determine name of Stability project file + /// + internal static string GetProjectFileName(string dikeName, Location location, int? jobCount, MStabModelType? model, string stabilityWorkingPath, DateTime? dateTime) + { + string calculationName = String.Format("Dik({0})_Loc({1})", dikeName, location.Name); + if (jobCount != null) + { + calculationName = calculationName + String.Format("_Stp({0})", jobCount); + } + if (model != null) + { + calculationName = calculationName + String.Format("_Mdl({0})", model); + } + if (dateTime != null) + { + calculationName = calculationName + "_" + DateToTimeStamp(dateTime.Value); + } + calculationName = Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); + // assemble the target project file name + return Path.Combine(stabilityWorkingPath, calculationName + ".sti"); + } + + /// /// Gets the D-GeoStability executable path. /// /// @@ -49,6 +88,5 @@ @"DGeoStability.exe"); } } - } }