/// <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;
        }
Exemple #2
0
        private void ValidateWebForm()
        {
            var formItemValidationResult = GeneratedWebFormValidator.Validate(WebFormId);

            Success      = formItemValidationResult.Succes;
            ErrorMessage = formItemValidationResult.Message;
        }
Exemple #3
0
        public GeneratedWebFormService()
        {
            string referrer = null;

            if (HttpContext.Current.Request.UrlReferrer != null)
            {
                referrer = HttpContext.Current.Request.UrlReferrer.AbsoluteUri;
            }
            var validator           = new GeneratedWebFormValidator(referrer, UserConnection);
            var defaultValueManager = new LeadDefaultValueManager();

            Mapper = new FormDataToEntityMapper(validator, defaultValueManager, UserConnection);
        }