public int GetFormItemTypeIDByName(string name) { var formItemType = FormItemRepository.GetFormItemTypeByName(name); return((formItemType != null) ? formItemType.FormItemTypeID : 0); }
public List <KeyValuePair <string, string> > SaveFormSubmission(FormCollection values, string recipients, DateTime date, int formID, int formSubmissionID = 0) { Dictionary <string, string> dictValues = values.AllKeys.ToDictionary(k => k, v => values[v]); string stringValues = String.Empty; foreach (var item in dictValues) { if (item.Key.Contains("recaptcha") || item.Key.Contains("FormID") || item.Key.Contains("RecipientEmail") || item.Key.Contains("subscribe")) { continue; } if (item.Key.Contains("radio")) { var itemID = int.Parse(item.Key.Replace("radio", "")); var contactItem = FormItemRepository.GetByID(itemID); var value = contactItem.tbl_FormItemValues.FirstOrDefault(fiv => fiv.FIV_Value == int.Parse(item.Value)); stringValues += String.Format("{0}:{1}###", contactItem.FI_Text, value.FIV_Text); continue; } if (item.Key.Contains("select")) { var itemID = int.Parse(item.Key.Replace("select", "")); var contactItem = FormItemRepository.GetByID(itemID); var value = contactItem.tbl_FormItemValues.FirstOrDefault(fiv => fiv.FIV_Value == int.Parse(item.Value)); stringValues += String.Format("{0}:{1}###", contactItem.FI_Text, value.FIV_Text); continue; } if (item.Key.Contains("checkbox")) { var itemID = int.Parse(item.Key.Replace("checkbox", "")); var contactItem = FormItemRepository.GetByID(itemID); foreach (var key in item.Value.Split(',')) { var value = contactItem.tbl_FormItemValues.FirstOrDefault(fiv => fiv.FIV_Value == int.Parse(key)); stringValues += String.Format("{0}:{1}###", contactItem.FI_Text, value.FIV_Text); } continue; } stringValues += String.Format("{0}:{1}###", item.Key, item.Value); } stringValues.TrimEnd('#'); List <KeyValuePair <string, string> > listValues = stringValues.Split(new[] { "###" }, StringSplitOptions.RemoveEmptyEntries).Select(s => new KeyValuePair <string, string>(s.Substring(0, s.IndexOf(':')), s.Substring(s.IndexOf(':') + 1))).ToList(); FormSubmissionRepository.SaveFormSubmission(stringValues, recipients, date, formID, formSubmissionID); return(listValues); }
public bool SaveFormItemsOrder(int[] orderedFormItemIDs) { return(FormItemRepository.SaveOrder(orderedFormItemIDs)); }
public tbl_FormItem SaveFormItemVisibility(int formItemID) { return((formItemID == 0) ? null: FormItemRepository.SaveVisibility(formItemID)); }
public tbl_FormItem SaveFormItem(string name, string text, int itemTypeID, bool required, int formID, int formItemID, string placeholder) { return((String.IsNullOrEmpty(name)) ? null: FormItemRepository.SaveFormItem(name, text, itemTypeID, required, formID, formItemID, placeholder)); }
public SelectList GetAllFormItemTypes() { return(new SelectList(FormItemRepository.GetAllFormItemTypes(), "FormItemTypeID", "FIT_Name")); }
public List <tbl_FormItem> GetAllFormItemsLiveByFormID(int formID) { return(FormItemRepository.GetAllLiveByFormID(formID).ToList()); }
public List <tbl_FormItem> GetAllFormItems() { return(FormItemRepository.GetAll().ToList()); }
public bool DeleteFormItem(int formItemID) { return(FormItemRepository.DeleteByID(formItemID)); }
public tbl_FormItem GetFormItemByID(int formItemID) { return(FormItemRepository.GetByID(formItemID)); }