// ================================================================================= /// <summary> /// This method initialises the class with values. /// </summary> /// <param name="DataId">String: A field data identifier</param> /// <param name="Title">String: A field title.</param> /// <param name="DataType">EvDataTypes: A field data type object</param> /// <param name="Value">String: A data value</param> // --------------------------------------------------------------------------------- public Field ( String DataId, String Title, Evado.Model.EvDataTypes DataType, String Value ) { this._Id = Guid.NewGuid ( ); this._FieldId = DataId; this._Title = Title; this._Type = DataType; this._Value = Value; }
// ================================================================================= /// <summary> /// This method initialises the class with values. /// </summary> /// <param name="DataId">String: A field data identifier</param> /// <param name="Title">String: A field title.</param> /// <param name="DataType">EvDataTypes: A field data type object</param> // --------------------------------------------------------------------------------- public Field ( String DataId, String Title, Evado.Model.EvDataTypes DataType ) { this._Id = Guid.NewGuid ( ); this._FieldId = DataId; this._Title = Title; this._Type = DataType; if ( DataType == Evado.Model.EvDataTypes.Table || DataType == Evado.Model.EvDataTypes.Special_Matrix ) { this.Table = new Table ( ); } }
// ===================================================================================== /// <summary> /// This method returns the Option list for the item. /// /// Written by: Ross Anderson /// Date: 24/08/2005 /// </summary> /// <returns>List of Evado.Model.EvOptions</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize a return list /// /// 2. Add a null option as first item for a selection list. /// /// 3. Add items from option object to the return list. /// </remarks> // ------------------------------------------------------------------------------------- public static List <Evado.Model.EvOption> getTypeList(Evado.Model.EvDataTypes Datatype) { // // Initialize a return list // List <Evado.Model.EvOption> List = new List <Evado.Model.EvOption> ( ); // // Add a null option as first item for a selection list. // Evado.Model.EvOption Option = new Evado.Model.EvOption(); List.Add(Option); // // Add items from option object to the return list. // Option = new Evado.Model.EvOption("YN", "Boolean Column"); List.Add(Option); Option = new Evado.Model.EvOption("TXT", "Text Column"); List.Add(Option); Option = new Evado.Model.EvOption("NUM", "Numeric Column"); List.Add(Option); Option = new Evado.Model.EvOption("DT", "Date Column"); List.Add(Option); Option = new Evado.Model.EvOption("RBL", "Radio Button Column"); List.Add(Option); Option = new Evado.Model.EvOption("SL", "Selection List Column"); List.Add(Option); if (Datatype == Evado.Model.EvDataTypes.Special_Matrix) { Option = new Evado.Model.EvOption("RO", "Read Only"); List.Add(Option); } // //Return the completed Array List. // return(List); }//END getTypeList method
}//END getOptionList method #endregion #region public class methods // ===================================================================================== /// <summary> /// This class sets the value on the object. All of the proper validations should be done here. /// </summary> /// <param name="FieldName">FormFieldClassFieldNames: field of the object to be updated</param> /// <param name="Value">String: a string value to be setted</param> /// <returns> Evado.Model.EvEventCodes: indicating the successful update of the property value</returns> /// <remarks> /// This class consists of the following steps: /// /// 1. Initialize the internal variables. /// /// 2. Switch FieldName and update value for the property defined by form field class field name. /// </remarks> // ------------------------------------------------------------------------------------- public Evado.Model.EvEventCodes setValue(ClassFieldNames FieldName, String Value) { // // Initialise the internal variables // DateTime date = EvcStatics.CONST_DATE_NULL; float fltValue = 0; int intValue = 0; bool boolValue = false; // // The switch determines the item to be updated. // switch (FieldName) { case ClassFieldNames.FieldId: { this.FieldId = Value; break; } case ClassFieldNames.TypeId: { Evado.Model.EvDataTypes type = Evado.Model.EvDataTypes.Null; if (Evado.Model.EvStatics.tryParseEnumValue <Evado.Model.EvDataTypes> (Value, out type) == false) { return(Evado.Model.EvEventCodes.Data_Enumeration_Casting_Error); } this.Design.TypeId = type; break; } case ClassFieldNames.Order: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Order = intValue; break; } case ClassFieldNames.Subject: { this.Design.Title = Value; break; } case ClassFieldNames.Instructions: { this.Design.Instructions = Value; break; } case ClassFieldNames.Reference: { this.Design.HttpReference = Value; break; } case ClassFieldNames.Html_Link: { this.Design.HttpReference = Value; break; } case ClassFieldNames.Unit: { this.Design.Unit = Value; break; } case ClassFieldNames.ValidationLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.ValidationLowerLimit = fltValue; break; } case ClassFieldNames.DefaultNumericValue: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.DefaultValue = fltValue.ToString( ); break; } case ClassFieldNames.ValidationUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.ValidationUpperLimit = fltValue; break; } case ClassFieldNames.AlertUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.AlertUpperLimit = fltValue; break; } case ClassFieldNames.AlertLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.AlertLowerLimit = fltValue; break; } case ClassFieldNames.NormalRangeUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.NormalRangeUpperLimit = fltValue; break; } case ClassFieldNames.NormalRangeLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.NormalRangeLowerLimit = fltValue; break; } case ClassFieldNames.Selection_Options: { this._Design.Options = Value.Replace("\r\n", String.Empty); break; } case ClassFieldNames.FieldCategory: { this._Design.FieldCategory = Value; break; } case ClassFieldNames.FormSection: { this._Design.SectionNo = Evado.Model.EvStatics.getInteger(Value); break; } case ClassFieldNames.ExSelectionListId: { this._Design.ExSelectionListId = Value; break; } case ClassFieldNames.ExSelectionListCategory: { this._Design.ExSelectionListCategory = Value; break; } case ClassFieldNames.AnalogueLegendStart: { this._Design.AnalogueLegendStart = Value; break; } case ClassFieldNames.AnalogueLegendFinish: { this._Design.AnalogueLegendFinish = Value; break; } case ClassFieldNames.Summary_Field: { this._Design.IsSummaryField = EvcStatics.getBool(Value); break; } case ClassFieldNames.Mandatory: { this._Design.Mandatory = EvcStatics.getBool(Value); break; } case ClassFieldNames.AI_Data_Point: { this._Design.AiDataPoint = EvcStatics.getBool(Value); break; } case ClassFieldNames.Hide_Field: { this._Design.HideField = EvcStatics.getBool(Value); break; } case ClassFieldNames.Java_Script: { this._Design.JavaScript = Value; break; } case ClassFieldNames.Unit_Scaling: { this._Design.UnitScaling = Value; break; } case ClassFieldNames.Field_Layout: { this._Design.FieldLayout = Value; break; } case ClassFieldNames.FieldWidth: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Design.FieldWidth = intValue; break; } case ClassFieldNames.FieldHeight: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Design.FieldHeight = intValue; break; } case ClassFieldNames.Media_Url: { this.RecordMedia.Url = Value; break; } case ClassFieldNames.Media_Title: { this.RecordMedia.Title = Value; break; } case ClassFieldNames.Media_Width: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.RecordMedia.Width = intValue; break; } case ClassFieldNames.Media_Height: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.RecordMedia.Height = intValue; break; } }//End switch return(0); }// End setvalue method.