Exemplo n.º 1
0
        public static UserFormSubmit MapUserFormSubmit(SW.Forms.DAL.Form form, bool deepLoad = false)
        {
            UserFormSubmit model = new UserFormSubmit()
            {
                FormId    = form.Id,
                FormName  = form.Name,
                FirstName = form.Account.FirstName,
                LastName  = form.Account.LastName,
                UserImage = form.Account.Image
            };

            if (deepLoad)
            {
                foreach (var item in form.FormSubmitValues)
                {
                    model.FormSubmits.Add(new FormSubmitValuesModel()
                    {
                        Id    = item.Id,
                        Name  = item.FormFields.Label,
                        Value = item.Value
                    });
                }
            }

            return(model);
        }
Exemplo n.º 2
0
        //[ObjectChangeFilter(IdentifierProperty = "Id", ChangeType = ChangeType.Save)]
        public HttpResponseMessage SaveForm(FormModel form)
        {
            HttpResponseMessage response     = new HttpResponseMessage(HttpStatusCode.OK);
            UserPrincipal       loggedInUser = (UserPrincipal)HttpContext.Current.User;

            form.ClubId = loggedInUser.AccountSession.ClubId;
            if (form.Id <= 0)
            {
                form.CreatedByUserId = loggedInUser.AccountSession.AccountId;
                form.CreatedDate     = DateTime.Now;
            }

            SW.Forms.DAL.Form f = FormModel.MapModelToForm(form);
            FormsAdminBLL.SaveForm(f);
            return(response);
        }
Exemplo n.º 3
0
        public static ExternalFormSubmit MapExternalFormSubmit(SW.Forms.DAL.Form form)
        {
            ExternalFormSubmit model = new ExternalFormSubmit();

            try
            {
                model.Batch = form.FormExternalSubmitValues.First().Batch;
                foreach (var item in form.FormExternalSubmitValues.OrderBy(f => f.FormFields.Id))
                {
                    model.FormSubmits.Add(new FormSubmitValuesModel()
                    {
                        Id    = item.Id,
                        Name  = item.FormFields.Label,
                        Value = item.Value
                    });
                }
            }
            catch (Exception)
            {
            }

            return(model);
        }