//########################################################################################## //# Class Functions //########################################################################################## ///############################################################ /// <summary> /// Initializes the class. /// </summary> /// <param name="oSettings">Cn.Web.Settings.Current instance representing the current enviroment.</param> /// <param name="sTableName">String representing the required table name.</param> /// <param name="sIDColumn">String representing the name of the primary key column (this column will not be included in the generated SQL statements).<para/>NOTE: Pass in a null-string if there is no ID column.</param> ///############################################################ /// <LastUpdated>May 30, 2007</LastUpdated> public TableForm(Settings.Current oSettings, string sTableName, string sIDColumn) : base(oSettings) { MultiArray oTable; //#### If the caller passed in a known sTableName/sIDColumn pair if (Web.Settings.MetaData.Exists(sTableName, sIDColumn)) { //#### Collect the oTable for the passed sTableName, reset g_iColumnCount, dimension ga_sInputAliases and determine sIDColumn's .Length oTable = Web.Settings.MetaData.Table(sTableName); //#### Pass the call off to .Initilize to do the actual work Initilize(oTable, sIDColumn); } //#### Else the passed sTableName/sIDColumn pair was unreconized, so raise the error else { //! } }
///############################################################ /// <summary> /// Initializes the class. /// </summary> /// <param name="oSettings">Cn.Web.Settings.Current instance representing the current enviroment.</param> /// <param name="oTable">MultiArray representing the table metadata to render.<para/>NOTE: Column definitions can be from more then one table.</param> /// <param name="sIDColumn">String representing the name of the primary key column (this column will not be included in the generated SQL statements).<para/>NOTE: Pass in a null-string if there is no ID column.</param> ///############################################################ /// <LastUpdated>May 30, 2007</LastUpdated> public TableForm(Settings.Current oSettings, MultiArray oTable, string sIDColumn) : base(oSettings) { //#### Pass the call off to .Initilize to do the actual work Initilize(oTable, sIDColumn); }
///############################################################ /// <summary> /// Initializes the class. /// </summary> /// <param name="oSettings">Cn.Web.Settings.Current instance representing the current enviroment.</param> /// <seealso cref="Cn.Web.Renderer.List.Reset(Web.Settings.Current)"/> ///############################################################ /// <LastUpdated>November 6, 2009</LastUpdated> public List(Settings.Current oSettings) : base(enumRendererObjectTypes.cnList, g_cClassName) { //#### Call our .Reset to init the class vars Reset(oSettings); }
//#### Declare the required private constants //private const string g_cClassName = "Cn.Web.Inputs.Tools"; //########################################################################################## //# Public Static Functions //########################################################################################## ///############################################################ /// <summary> /// Formats the provided date. /// </summary> /// <remarks> /// If the passed <paramref>sInputSpecificFormat</paramref> is a null-string, its value is modified by reference to indicate the default date format as defined within <c>Renderer</c>'s loaded <c>Settings</c> (per the passed <paramref>eInputType</paramref>) that the <paramref>sDateToFormat</paramref> was formatted with. /// </remarks> /// <param name="sDateToFormat">String representing the date to format.</param> /// <param name="sInputSpecificFormat">Reference to a string representing the required date format.</param> /// <param name="eInputType">Enumeration representing the type of input to render.</param> /// <param name="oSettings">Cn.Web.Settings.Current instance representing the current enviroment.</param> /// <returns>String representing the formatted <paramref>sDateToFormat</paramref>.</returns> ///############################################################ /// <LastUpdated>November 13, 2009</LastUpdated> public static string FormatDateTime(string sDateToFormat, ref string sInputSpecificFormat, enumInputTypes eInputType, Settings.Current oSettings) { string sEndUserMessagesLanguageCode = oSettings.EndUserMessagesLanguageCode; string sReturn; Dates.enumWeekOfYearCalculations eWeekOfYearCalculation; //#### If the developer didn't pass in a sInputSpecificFormat if (sInputSpecificFormat.Length == 0) { //#### Determine the passed eInputType, resetting the sInputSpecificFormat to the related default value from .Settings switch (eInputType) { case enumInputTypes.cnDate: { sInputSpecificFormat = Settings.Internationalization.Value(Internationalization.enumInternationalizationValues.cnLocalization_Date_DateFormat, sEndUserMessagesLanguageCode); break; } case enumInputTypes.cnDateTime: { sInputSpecificFormat = Settings.Internationalization.Value(Internationalization.enumInternationalizationValues.cnLocalization_Date_DateTimeFormat, sEndUserMessagesLanguageCode); break; } case enumInputTypes.cnTime: { sInputSpecificFormat = Settings.Internationalization.Value(Internationalization.enumInternationalizationValues.cnLocalization_Date_TimeFormat, sEndUserMessagesLanguageCode); break; } } } //#### Collect the eWeekOfYearCalculation eWeekOfYearCalculation = Data.Tools.MakeEnum(Settings.Internationalization.Value(Internationalization.enumInternationalizationValues.cnLocalization_Date_WeekOfYearCalculationEnum, sEndUserMessagesLanguageCode), Dates.enumWeekOfYearCalculations.cnDefault); //#### If a sInputSpecificFormat was passed in (or successfully determined above) if (sInputSpecificFormat.Length > 0) { //#### Set the return value to the formatted sDateToFormat on the above determined sInputSpecificFormat //#### NOTE: The sInputSpecificFormat is defaulted to the localized default date/time format by the callers, it's not done here because we don't have access to the related oSettings object sReturn = Dates.Tools.FormatDateTime(sDateToFormat, sInputSpecificFormat, Settings.Internationalization, eWeekOfYearCalculation); } //#### Else a sInputSpecificFormat was not successfully determined above, so simply return the passed sDateToFormat as is else { sReturn = sDateToFormat; } //#### Return the above determined sReturn value to the caller return sReturn; }