示例#1
0
        // put these in FormBuilder
        private FieldControl getFieldControl(Field f, bool isDisplayControl)
        {
            FieldTypeInfo fti = FormBuilder.GetFieldTypeInfo(f.FieldTypeID);
            string        s   = (isDisplayControl) ? fti.DisplaySrc : fti.EditSrc;
            FieldControl  fc  = (FieldControl)Page.LoadControl("~/nodeTemplates/formBuilder/" + s);

            fc.FormField = f;
            fc.Mode      = "Display";       //(Request.QueryString["action"] != null) ? Request.QueryString["action"] : "";
            return(fc);
        }
示例#2
0
        public static bool ProcessForm(Form f, ControlCollection cc)
        {
            bool formDone     = false;
            bool hasResponder = formHasResponder(f);

            Responder res = FormBuilder.GetResponder();

            if (hasResponder)
            {
                displayFieldResponderRegistration reg = getResponderControl(cc);
                res.FormID     = f.FormID;
                res.Email      = reg.email.Text;
                res.Firstname  = reg.firstname.Text;
                res.Lastname   = reg.lastname.Text;
                res.Address1   = reg.address1.Text;
                res.Address2   = reg.address2.Text;
                res.City       = reg.city.Text;
                res.State      = reg.stateprov.SelectedValue;
                res.Postalcode = reg.postcode.Text;
                //r.Country = reg.
                //r.Username;
                //r.Password;
                res.DateCreated = DateTime.Now;
                SaveResponder(res);
            }
            else
            {
                res.Firstname   = "anonymous";
                res.DateCreated = DateTime.Now;
                res.FormID      = f.FormID;
                SaveResponder(res);
            }

            foreach (Control c in cc)
            {
                if (c.GetType().BaseType.BaseType == typeof(FieldControl))
                {
                    Response     r  = GetResponse();
                    FieldControl fc = (FieldControl)c;
                    r.FieldID     = fc.FormField.FieldID;
                    r.ResponderID = r.ResponderID;
                    r.Value       = fc.GetValue();
                    r.DateCreated = DateTime.Now;
                    //if (hasResponder)
                    r.ResponderID = res.ResponderID;
                    SaveResponse(r);
                }
                formDone = true;
            }

            return(formDone);
        }
示例#3
0
 private static displayFieldResponderRegistration getResponderControl(ControlCollection cc)
 {
     foreach (Control c in cc)
     {
         if (c.GetType().BaseType.BaseType == typeof(FieldControl))
         {
             FieldControl fc = (FieldControl)c;
             if (fc.FormField.FieldTypeID == 8)
             {
                 return((displayFieldResponderRegistration)fc);
             }
         }
     }
     return(null);
 }