Esempio n. 1
0
        private void ValidateWebForm()
        {
            var formItemValidationResult = GeneratedWebFormValidator.Validate(WebFormId);

            Success      = formItemValidationResult.Succes;
            ErrorMessage = formItemValidationResult.Message;
        }
        /// <summary>
        /// Creates entity from landing.
        /// </summary>
        /// <param name="formData">Data from landing.</param>
        /// <param name="entity">Entity onto which data from landing is mapped.</param>
        public void Map(FormData formData, Entity entity)
        {
            Guid webFormId;

            if (!Guid.TryParse(formData.formId, out webFormId))
            {
                Message = GeneratedWebFormLczUtilities
                          .GetLczStringValue("UnknownWebFormIdentifierMessage", "GeneratedWebFormService", UserConnection);
                Success = false;
                return;
            }
            FormFieldsData[] formFieldsData = formData.formFieldsData;
            var formItemValidationResult    = GeneratedWebFormValidator.Validate(webFormId);

            if (!formItemValidationResult.Succes)
            {
                Message = formItemValidationResult.Message;
                Success = false;
                return;
            }
            entity.SetDefColumnValues();
            Dictionary <string, object> defaultValues = DefaultValueManager.GetValues(webFormId, UserConnection);

            foreach (string columnName in defaultValues.Keys)
            {
                entity.SetColumnValue(columnName, defaultValues[columnName]);
            }
            Message += SetColumnsFromFormFieldsData(formFieldsData, entity);
            Success  = true;
        }