Exemplo n.º 1
0
 /// <summary>
 /// Create a new Form object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="slug">Initial value of the Slug property.</param>
 /// <param name="confirmationMessage">Initial value of the ConfirmationMessage property.</param>
 public static Form CreateForm(global::System.Int32 id, global::System.String title, global::System.String slug, global::System.String confirmationMessage)
 {
     Form form = new Form();
     form.ID = id;
     form.Title = title;
     form.Slug = slug;
     form.ConfirmationMessage = confirmationMessage;
     return form;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Forms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToForms(Form form)
 {
     base.AddObject("Forms", form);
 }
Exemplo n.º 3
0
        public static FormViewModel CreateFromObject(Form form, Constants.FormFieldMode mode)
        {
            if (form != null)
            {

                var formView = CreateBasicFromObject(form);

                if (form.FormFields.Count() > 0)
                {
                    form.FormFields.OrderBy(o => o.Order).Each((field, index) =>
                    {

                        formView.Fields.Add(FormFieldViewModel.CreateFromObject(field, mode));
                    });
                }

                return formView;
            }
            return FormViewModel.Initialize();
        }
Exemplo n.º 4
0
        public static FormViewModel CreateBasicFromObject(Form form)
        {
            var formView = new FormViewModel
            {
                Title = form.Title,
                Id = form.ID,
                DateAdded = form.DateAdded.Value,
                ConfirmationMessage = form.ConfirmationMessage,
                Fields = Enumerable.Empty<FormFieldViewModel>().ToList(),
                Slug = form.Slug,
                Theme=form.Theme,
                NotificationEmail = form.NotificationEmail,
                Status = (Constants.FormStatus)Enum.Parse(typeof(Constants.FormStatus), form.Status)
            };

            return formView;
        }
Exemplo n.º 5
0
 public static FormViewModel CreateFromObject(Form form)
 {
     return CreateFromObject(form, Constants.FormFieldMode.EDIT);
 }