public static void SubmitForm(List <FormSubmitValues> submitValues) { FormsDAL.SubmitForm(submitValues); List <Form_Emails> emails = GetFormEmails(submitValues[0].FormId); string emailHtml = GenerateEmail(submitValues); string emailSubject = GenerateEmailSubject(submitValues[0].FormId); foreach (var email in emails) { EmailHelper.SendEmail(email.Email, emailHtml, emailSubject); } }
/// <summary> /// Inserta una entidad. /// </summary> public static void Eliminar(Forms entidad) { try { FormsDAL.Eliminar(entidad); } catch (Exception ex) { bool err = ExceptionPolicy.HandleException(ex, POLITICA); if (err) { throw; } throw new Exception(ex.Message); } }
public static Forms ObtenerPorId(string parametro) { try { return(FormsDAL.Obtener(parametro)); } catch (Exception ex) { bool err = ExceptionPolicy.HandleException(ex, POLITICA); if (err) { throw; } throw new Exception(ex.Message); } }
public static List <Forms> ObtenerTodos() { try { return(FormsDAL.ObtenerTodos()); } catch (Exception ex) { bool err = ExceptionPolicy.HandleException(ex, POLITICA); if (err) { throw; } throw new Exception(ex.Message); } }
public static void SubmitExternalForm(List <FormExternalSubmitValues> submitValues) { string batch = Guid.NewGuid().ToString(); submitValues.ForEach(s => s.Batch = batch); FormsDAL.SubmitExternalForm(submitValues); Form form = FormsDAL.GetExternalForm(submitValues[0].FormId); List <Form_Emails> emails = form.Form_Emails.ToList(); string emailHtml = GenerateExternalEmail(submitValues); string emailSubject = GenerateEmailSubject(submitValues[0].FormId); try { foreach (var email in emails) { EmailHelper.SendEmail(email.Email, emailHtml, emailSubject); } if (form.SendThanksMail) { int formFieldId = FormsAdminBLL.GetExternalSubmitFormFieldId(form.Id, form.EmailFieldName); string email = submitValues.FirstOrDefault(s => s.FormFieldId == formFieldId).Value; HandleFormEmail(form, emailHtml); if (!string.IsNullOrEmpty(email)) { EmailHelper.SendEmail(email, form.EmailHtml, form.Name); } else { LogHelper.LogWarn(string.Format("Couldn't send Email for submission {0}, form: {1}", batch, form.Name), new Exception(), form.ClubId); } } } catch (Exception ex) { LogHelper.LogError("Error sending email for external form submit", ex, form.ClubId); } }
private static List <Form_Emails> GetFormEmails(int formId) { return(FormsDAL.GetFormEmails(formId)); }
private static Form GetExternalForm(int formId) { return(FormsDAL.GetExternalForm(formId)); }
public static Form GetForm(int clubId, int formId) { return(FormsDAL.GetForm(clubId, formId)); }
public static List <Form> GetUnansweredForms(int clubId, int accountId, int count) { return(FormsDAL.GetUnansweredForms(clubId, accountId, count)); }
public static Form GetForm(string clubShortName, string formName) { return(FormsDAL.GetForm(clubShortName, formName)); }