Beispiel #1
0
        public static FormFieldViewModel CreateFromObject(FormField field, Constants.FormFieldMode mode)
        {
            if (field != null)
            {

                return new FormFieldViewModel
                {
                    DomId = field.DomId.Value,
                    Id = field.ID,
                    Label = field.Label.IsNullOrEmpty() ? "Click to edit" : field.Label,
                    Text = field.Text,
                    FieldType = (Constants.FieldType)Enum.Parse(typeof(Constants.FieldType), field.FieldType),
                    IsRequired = field.IsRequired.Value,
                    MaxCharacters = field.MaxChars.Value,
                    HoverText = field.HoverText,
                    Hint = field.Hint,
                    SubLabel = field.SubLabel,
                    Size = field.Size,
                    Columns = field.Columns.Value,
                    Rows = field.Rows.Value,
                    Options = field.Options,
                    SelectedOption = field.SelectedOption,
                    HelpText = field.HelpText,
                    Validation = field.Validation,
                    Order = field.Order.Value,
                    MinimumAge = field.MinimumAge,
                    MaximumAge = field.MaximumAge,
                    Mode = mode,
                    MaxFileSize = field.MaxFilesizeInKb ?? field.MaxFilesizeInKb.Value,
                    MinFileSize = field.MinFilesizeInKb ?? field.MinFilesizeInKb.Value,
                    ValidFileExtensions=field.ValidFileExtensions,
                    DateAdded = field.DateAdded
                };
            }

            return FormFieldViewModel.Initialize();
        }
 /// <summary>
 /// Create a new FormField object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="selectedOption">Initial value of the SelectedOption property.</param>
 /// <param name="dateAdded">Initial value of the DateAdded property.</param>
 public static FormField CreateFormField(global::System.Int32 id, global::System.String selectedOption, global::System.DateTime dateAdded)
 {
     FormField formField = new FormField();
     formField.ID = id;
     formField.SelectedOption = selectedOption;
     formField.DateAdded = dateAdded;
     return formField;
 }
Beispiel #3
0
 public static FormFieldViewModel CreateFromObject(FormField field)
 {
     return CreateFromObject(field, Constants.FormFieldMode.EDIT);
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the FormFields EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFormFields(FormField formField)
 {
     base.AddObject("FormFields", formField);
 }