Esempio n. 1
0
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region public methods.


        //  ================================================================================
        /// <summary>
        /// Sets the value of this activity class field name. Validate the format of the
        /// value.
        /// </summary>
        /// <param name="fieldName">ActivityClassFieldNames: Name of the field to be setted.</param>
        /// <param name="value">String: value to be setted</param>
        /// <returns> Evado.Model.EvEventCodes: indicating the successful update of the property value.</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Switch the fieldName and update value for the property defined by the activity field names
        ///
        /// 2. Return casting error, if field name type is empty
        /// </remarks>
        //  --------------------------------------------------------------------------------
        public Evado.Model.EvEventCodes setValue(ClassFieldNames fieldName, String value)
        {
            //
            // Switch the FieldName based on the activity field names
            //
            switch (fieldName)
            {
            case ClassFieldNames.Introductory_Email_Title:
            {
                this.IntroductoryEmail_Title = value;
                break;
            }

            case ClassFieldNames.Introductory_Email_Body:
            {
                this.IntroductoryEmail_Body = value;
                break;
            }

            case ClassFieldNames.Reset_Password_Email_Title:
            {
                this.ResetPasswordEmail_Title = value;
                break;
            }

            case ClassFieldNames.Reset_Password_Email_Body:
            {
                this.ResetPasswordEmail_Body = value;
                break;
            }

            case ClassFieldNames.Update_Password_Email_Title:
            {
                this.UpdatePasswordEmail_Title = value;
                break;
            }

            case ClassFieldNames.Update_Password_Email_Body:
            {
                this.UpdatePasswordEmail_Body = value;
                break;
            }

            case ClassFieldNames.Password_Confirmation_Email_Title:
            {
                this.PasswordConfirmationEmail_Title = value;
                break;
            }

            case ClassFieldNames.Password_Confirmation_Email_Body:
            {
                this.PasswordConfirmationEmail_Body = value;
                break;
            }

            case ClassFieldNames.DemoRegistrationInstuctions:
            {
                this.DemoRegistrationInstuctions = value;
                break;
            }

            case ClassFieldNames.DemoRegistrationConfirmation:
            {
                this.DemoRegistrationConfirmation = value;
                break;
            }

            case ClassFieldNames.DemoRegistrationError:
            {
                this.DemoRegistrationError = value;
                break;
            }
            }// End switch field name

            return(Evado.Model.EvEventCodes.Ok);
        }//End setValue method.
Esempio n. 2
0
        }//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.