//protected void UpdateTNCheckList(string State)
        //{
        //    TNEnroll.DisplayPanel(State);
        //}

        protected void SubmitApplication(object sender, EventArgs e)
        {
            List<string> panelsNeeded = new List<string>();
            List<string> To = new List<string>();
            List<string> Bcc = new List<string>();
            List<string> Cc = new List<string>();
            List<string> collegePanels = new List<string>();
            TiffCreator tiff = new TiffCreator();
            Email email = new Email();
            AdditionalDocs additionalDocs = new AdditionalDocs();
            string emailBody;
            IEnumerable<FieldInfo> transcriptFields;

            string mailTo = "[email protected]; [email protected]";


            //mainPanel.ContentTemplateContainer.Controls
            if (Page.IsValid)
            {
                //Start by looping through each control in the Wizard Step
                foreach (Control step in pnlMain.Controls)
                {
                    if(step is Panel)
                    {
                        foreach (Control control in step.Controls)
                        {
                            if(control is UserControl)
                            {
                                foreach (Control currentControl in control.Controls)
                                {
                                    if (currentControl is Panel)
                                    {
                                        formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                                    }
                                }
                            }
                        }

                    }
                    else if(step is UserControl)
                    {
                        foreach (Control currentControl in step.Controls)
                        {
                            if (currentControl is Panel)
                            {
                                formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                            }
                        }
                    }
                }//end foreach loop

                //if (PersonalInfo1.State != "Tennessee")
                //{
                    //var tnPanels = formInfo.Where(tn => tn.panelID == "TNEnrollPanel" || tn.panelID == "TNEnrollPanel2").ToList();

                    //foreach (var record in tnPanels)
                    //{
                    //    //url += record.panelID + ": ";
                    //    //Response.Redirect(url);
                    //    formInfo.Remove(record);
                    //}
                //}
                //else
                //{
                //    string tnFile;

                //    panelsNeeded.Clear();

                //    panelsNeeded.Add("TNEnrollPanel");
                //    panelsNeeded.Add("TNEnrollPanel2");
                //    panelsNeeded.Add("TranscriptPanel");

                //    IEnumerable<FieldInfo> tnFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                    

                //    tnFile = additionalDocs.BuildWordDocXTN(tnFields);

                //    attachments.Add(tnFile);
                //    allAttachments.Add(tnFile);
                //    tnAttachments.Add(tnFile);
                //    studentAttachments.Add(tnFile);
                //}

                for (int i = 0; i <= 9; i++)
                {
                    if (i > SchoolInfo1.collegeValue)
                    {
                        collegePanels.Add("CollegePanel" + i);
                    }
                }

                var colleges = formInfo.Where(c => collegePanels.Contains(c.panelID)).ToList();

                foreach (var college in colleges)
                {
                    formInfo.Remove(college);
                }

                var page = formInfo.Where(c => c.labelID == "pageBreak").ToList();

                if (Enroll.degreeType == "Graduate" || Enroll.degreeType == "POST GRADUATE")
                {
                    var KY = formInfo.Where(f => f.panelID == "KYResidentContainer" || f.panelID == "panelStateResident").ToList();

                    foreach (var res in KY)
                    {
                        formInfo.Remove(res);
                    }
                }
                else if (KYResidentInfo.KYRes == "No")
                {
                    var KY = formInfo.Where(f => f.panelID == "panelStateResident").ToList();

                    foreach (var res in KY)
                    {
                        formInfo.Remove(res);
                    }
                }

                if (PersonalInfo1.State != "California")
                {
                    var state = formInfo.Where(f => f.panelID == "pnlCalifornia").ToList();

                    foreach (var statePanel in state)
                    {
                        formInfo.Remove(statePanel);
                    }
                }

                if (Enroll.degreeType == "POST GRADUATE")
                {
                    var asf = formInfo.Where(f => f.panelID == "pnlASFContainer" || f.panelID == "pnlASF").ToList();

                    foreach (var asfPanel in asf)
                    {
                        formInfo.Remove(asfPanel);
                    }
                }

                if (EnrollAcknowledge.DisplayGradWork == "No")
                {
                    var gradWork = formInfo.Where(r => r.panelID == "pnlGradWork").ToList();

                    foreach (var work in gradWork)
                    {
                        formInfo.Remove(work);
                    }
                }

                if (Enroll.enrollStartDate == "Winter: January 2018")
                {
                    var withdrawPanels = formInfo.Where(f => f.panelID == "pnlWithdraw" || f.panelID == "pnlWithdrawFortKnox").ToList();

                    foreach (var withdrawPanel in withdrawPanels)
                    {
                        formInfo.Remove(withdrawPanel);
                    }
                }
                else
                {
                    var withdrawPanels = formInfo.Where(f => f.panelID == "pnlOldWithdraw").ToList();

                    foreach (var withdrawPanel in withdrawPanels)
                    {
                        formInfo.Remove(withdrawPanel);
                    }

                    if(Enroll.CampusAttending != "Fort Knox")
                    {
                        withdrawPanels.Clear();

                        withdrawPanels = formInfo.Where(f => f.panelID == "pnlWithdrawFortKnox").ToList();

                        foreach (var withdrawPanel in withdrawPanels)
                        {
                            formInfo.Remove(withdrawPanel);
                        }

                    }
                }

                emailBody = email.CreateEmailBody(formInfo);

                //Create transcripts

                // Build HS/ GED Transcript
                panelsNeeded.Add("PersonalInfoPanel");
                panelsNeeded.Add("AcademicHistoryPanel");
                panelsNeeded.Add("highSchoolPanel");
                panelsNeeded.Add("TranscriptPanel");

                transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                HSGedAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "HS-GED", Enroll.CampusAttending));

                foreach (var item in HSGedAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();

                //Build College Transcipts
                for (int i = 1; i <= 9; i++)
                {
                    if (i <= Convert.ToInt16(SchoolInfo1.collegeNumber))
                    {
                        panelsNeeded.Add("PersonalInfoPanel");
                        panelsNeeded.Add("CollegePanel" + i);
                        panelsNeeded.Add("creditPanel" + i);
                        panelsNeeded.Add("degreePanel" + i);
                        panelsNeeded.Add("TranscriptPanel");
                        panelsNeeded.Add("pnlESig");

                        transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                        CollegeAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "College" + i, Enroll.CampusAttending));
                    }
                }

                foreach (var item in CollegeAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();

                //Build ROI
                panelsNeeded.Add("PersonalInfoPanel");
                panelsNeeded.Add("AcademicHistoryPanel");
                panelsNeeded.Add("highSchoolPanel");

                for (int i = 1; i <= 9; i++)
                {
                    if (i <= Convert.ToInt16(SchoolInfo1.collegeNumber))
                    {
                        panelsNeeded.Add("CollegePanel" + i);
                        panelsNeeded.Add("creditPanel" + i);
                        panelsNeeded.Add("degreePanel" + i);
                    }
                }

                panelsNeeded.Add("TranscriptPanel");
                panelsNeeded.Add("pnlESig");

                transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                ROIAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "ROI", Enroll.CampusAttending));

                foreach (var item in ROIAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();



                if (Enroll.CampusAttending == "Louisville")
                {
                    To.Add("*****@*****.**");
                    To.Add("*****@*****.**");

                    try
                    {
                        if (Convert.ToInt16(SchoolInfo1.HSGradYear) >= DateTime.Today.Year)
                            To.Add("*****@*****.**");
                    }
                    catch { }
                }

                else if (Enroll.CampusAttending == "Online" || Enroll.CampusAttending == "Louisa" || Enroll.CampusAttending == "Northern Kentucky" || Enroll.CampusAttending == "CarlisleNicholas" || Enroll.CampusAttending == "Mayfield")
                {
                    To.Add("*****@*****.**");
                    To.Add("*****@*****.**");
                }

                else if (Enroll.CampusAttending == "Lexington")
                {
                    To.Add("*****@*****.**");
                }

                else if (Enroll.CampusAttending == "Fort Knox")
                {
                    To.Add("*****@*****.**");
                }

                if (Enroll.VABenefits == "Yes")
                    To.Add("*****@*****.**");

                //mail.Attachments.Add(new Attachment("C:\\Websites\\secure.sullivan.edu\\Admissions\\PDFs\\TuitionRates.pdf"));


                if (Enroll.CampusAttending != "Fort Knox")
                {
                    attachments.Add("C:\\Websites\\secure.sullivan.edu\\Admissions\\PDFs\\SupplementA.pdf");
                    studentAttachments.Add("C:\\Websites\\secure.sullivan.edu\\Admissions\\PDFs\\SupplementA.pdf");
                }
                else
                {
                    attachments.Add("C:\\Websites\\secure.sullivan.edu\\Admissions\\PDFs\\FortKnoxSupplementA.pdf");
                    studentAttachments.Add("C:\\Websites\\secure.sullivan.edu\\Admissions\\PDFs\\FortKnoxSupplementA.pdf");
                }

                //if (ViewState["DisplayProgramDoc"] != null)
                //{
                //    if ((bool)ViewState["DisplayProgramDoc"] == true)
                //    {
                //        if (Enroll.CampusAttending == "Fort Knox")
                //        {
                //            if (Enroll.enrollStartDate == "Winter: January 2018")
                //            {
                //                Session["ProgramDoc"] = "FortKnoxRates";
                //            }
                //            else
                //            {
                //                Session["ProgramDoc"] = "FortKnoxRates2018";
                //            }

                //        }

                //        if (ViewState["ESigParent"] == null)
                //            tuitionAttatchments = tiff.SignTuitionSheet((string)Session["ESig"], null, PersonalInfo1.StudentName, TranscriptESign1.SigDate);
                //        else
                //            tuitionAttatchments = tiff.SignTuitionSheet((string)ViewState["ESig"], (string)Session["ESigParent"], PersonalInfo1.StudentName, TranscriptESign1.SigDate);
                //    }
                //}

                disclosureAttachment = tiff.SignDisclosure((string)Session["ESig"], PersonalInfo1.StudentName, TranscriptESign1.SigDate);

                attachments.Add(disclosureAttachment);
                studentAttachments.Add(disclosureAttachment);
                allAttachments.Add(disclosureAttachment);

                foreach (string item in tuitionAttatchments)
                {
                    attachments.Add(item);
                    studentAttachments.Add(item);
                    allAttachments.Add(item);
                }

                foreach(string item in SchoolInfo1.GetTranscriptAttachments())
                {
                    attachments.Add(item);
                    ROIAttatchments.Add(item);
                    allAttachments.Add(item);
                }
                

                email.SendHTMLEmail("Enrollment Application - " + PersonalInfo1.StudentName, emailBody, To, Bcc, Cc, "*****@*****.**", attachments);

                //Create Tiffs. Do not move below removing the SSN.
                Tiffer();


                //In case the student enters their email in wrong
                try
                {
                    To.Clear();
                    To.Add(PersonalInfo1.Email);

                    //Send the application to the student if their email address is in the proper format. 
                    var ssn = formInfo.FirstOrDefault(f => f.controlID == "tBoxSocialSecurityNumber");
                    formInfo.Remove(ssn);

                    var dob = formInfo.FirstOrDefault(f => f.controlID == "tbDOB");
                    formInfo.Remove(dob);

                    emailBody = email.CreateEmailBody(formInfo);

                    //Make sure to not include transcript request, or anything with SSN
                    email.SendHTMLEmail("Enrollment Application - " + PersonalInfo1.StudentName, emailBody, To, Bcc, Cc, "*****@*****.**", studentAttachments);

                    if (Enroll.AlumniIncentive == "Yes")
                    {
                        string alumniBody;

                        studentAttachments.Clear();

                        alumniBody = "<html><p>Hello " + PersonalInfo1.StudentName + "</p>"
                        +"<p>IMPORTANT: In order to receive the Alumni Tuition Incentive, the Alumnus must be registered with the Alumni Association prior to completing an enrollment. "
                        + "Visit <a href='http://alumni.sullivan.edu/register/' target='_blank'>http://alumni.sullivan.edu/register/</a> to register for the Alumni Association. If the alumnus is already a member of the Alumni Association, "
                        + "visit <a href='http://alumni.sullivan.edu/register/' target='_blank'>http://alumni.sullivan.edu/register/</a> to verify enrollment. If you are not the alumnus, please note you are responsible for ensuring the "
                        + "Alumnus registers prior to you completing the enrollment process.</p>";

                        //Bcc.Add("*****@*****.**");

                        email.SendHTMLEmail("Sullivan University Alumni Incentive - " + PersonalInfo1.StudentName, alumniBody, To, Bcc, Cc, "*****@*****.**", studentAttachments);

                        To.Clear();

                        To.Add("*****@*****.**");

                        panelsNeeded.Clear();
                        panelsNeeded.Add("PersonalInfoPanel");
                        panelsNeeded.Add("PersonalInfoPanel2");
                        panelsNeeded.Add("EnrollPanel");
                        panelsNeeded.Add("programPanel");
                        panelsNeeded.Add("pnlAlumnusName");

                        IEnumerable<FieldInfo> alumniFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                        alumniBody = additionalDocs.BuildAlumniIncentive(alumniFields);

                        email.SendHTMLEmail("Alumni Incentive - " + PersonalInfo1.StudentName, alumniBody, To, Bcc, Cc, "*****@*****.**", studentAttachments);


                    }


                }
                catch { }


                if (Enroll.CampusAttending != "Online")
                    Session["enrollmentFee"] = "50.00";
                else
                {
                    if(Enroll.degreeType == "POST GRADUATE")
                        Session["enrollmentFee"] = "100.00";
                    else
                        Session["enrollmentFee"] = "0.00";
                }


                Session["Campus"] = Enroll.CampusAttending;
                Session["StudentName"] = PersonalInfo1.StudentName;
                //Session["CampusNumber"] = Enroll.CampusNumber;
                Session["Phone"] = PersonalInfo1.Phone;
                Session["Email"] = PersonalInfo1.Email;
                Session["Housing"] = Enroll.Housing;
                Session["ZipCode"] = PersonalInfo1.ZipCode;
                Session["Military"] = Enroll.MilitaryActive;


                if (SchoolInfo1.collegeNumber != "00" && SchoolInfo1.collegeNumber != "0")
                {
                    Session["Transcript"] = "Yes";
                }
                else
                {
                    Session["Transcript"] = "No";
                }

                Session["AllAttachments"] = allAttachments;

                if (Enroll.additionalForms == "NCHS")
                    Response.Redirect("NCHS.aspx");
                else if (Enroll.additionalForms == "PT")
                    Response.Redirect("pt.aspx");
                else if (Enroll.additionalForms == "MBAAccounting")
                    Response.Redirect("MBAAccounting.aspx");
                else if (Enroll.Housing == "Yes")
                    Response.Redirect("housing.aspx");
                else
                    Response.Redirect("IPED.aspx");

            }
            
        }
Esempio n. 2
0
        protected void SubmitApplication(object sender, EventArgs e)
        {
            List <string>           panelsNeeded  = new List <string>();
            List <string>           To            = new List <string>();
            List <string>           Bcc           = new List <string>();
            List <string>           Cc            = new List <string>();
            List <string>           collegePanels = new List <string>();
            TiffCreator             tiff          = new TiffCreator();
            Email                   email         = new Email();
            string                  emailBody;
            AdditionalDocs          additionalDocs = new AdditionalDocs();
            IEnumerable <FieldInfo> transcriptFields;

            //mainPanel.ContentTemplateContainer.Controls
            if (Page.IsValid)
            {
                //Start by looping through each control in the Wizard Step
                foreach (Control step in pnlMain.Controls)
                {
                    if (step is Panel)
                    {
                        foreach (Control control in step.Controls)
                        {
                            if (control is UserControl)
                            {
                                foreach (Control currentControl in control.Controls)
                                {
                                    if (currentControl is Panel)
                                    {
                                        formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                                    }
                                }
                            }
                        }
                    }
                    else if (step is UserControl)
                    {
                        foreach (Control currentControl in step.Controls)
                        {
                            if (currentControl is Panel)
                            {
                                formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                            }
                        }
                    }
                }//end foreach loop

                for (int i = 0; i <= 9; i++)
                {
                    if (i > SchoolInfo1.collegeValue)
                    {
                        collegePanels.Add("CollegePanel" + i);
                    }
                }

                var colleges = formInfo.Where(c => collegePanels.Contains(c.panelID)).ToList();

                foreach (var college in colleges)
                {
                    formInfo.Remove(college);
                }

                if (Request.QueryString["Tuition"] == "manual")
                {
                    var fees = formInfo.Where(c => c.panelID == "pnlEnrollmentFee" || c.panelID == "pnlPrerequisites").ToList();

                    foreach (var fee in fees)
                    {
                        formInfo.Remove(fee);
                    }
                }

                if (PersonalInfo1.State != "California")
                {
                    var state = formInfo.Where(f => f.panelID == "pnlCalifornia").ToList();

                    foreach (var statePanel in state)
                    {
                        formInfo.Remove(statePanel);
                    }
                }

                emailBody = email.CreateEmailBody(formInfo);

                //Build ROI
                panelsNeeded.Add("PersonalInfoPanel");
                panelsNeeded.Add("AcademicHistoryPanel");
                panelsNeeded.Add("pnlFirstGenCollegeStudent");
                panelsNeeded.Add("highSchoolPanel");

                for (int i = 1; i <= 9; i++)
                {
                    if (i <= Convert.ToInt16(SchoolInfo1.collegeNumber))
                    {
                        panelsNeeded.Add("CollegePanel" + i);
                        panelsNeeded.Add("creditPanel" + i);
                        panelsNeeded.Add("degreePanel" + i);
                    }
                }

                panelsNeeded.Add("pnlESig");

                transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                transcriptAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "ROI", "Louisville"));

                panelsNeeded.Clear();

                foreach (string item in transcriptAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                foreach (string item in SchoolInfo1.GetTranscriptAttachments())
                {
                    attachments.Add(item);
                    transcriptAttatchments.Add(item);
                    allAttachments.Add(item);
                }

                To.Add("*****@*****.**");

                email.SendHTMLEmail("Physician Assistant Enrollment Application - " + PersonalInfo1.StudentName, emailBody, To, Bcc, Cc, "*****@*****.**", attachments);



                //Create and send tiffs
                Tiffer();

                Session["enrollmentFee"]   = "100.00";
                Session["emailRecipients"] = "*****@*****.**";
                Session["Campus"]          = "Louisville";
                Session["Form"]            = "PA";
                Session["CampusNumber"]    = "04";
                Session["StudentName"]     = PersonalInfo1.StudentName;
                Session["Phone"]           = PersonalInfo1.Phone;
                Session["Email"]           = PersonalInfo1.Email;
                Session["ZipCode"]         = PersonalInfo1.ZipCode;
                Session["AllAttachments"]  = allAttachments;

                if ((string)Request["Tuition"] == "manual")
                {
                    Session["Tuition"] = (string)Request["Tuition"];
                }

                ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "TrackSubmission", "TrackSubmission();", true);

                Response.Redirect("IPED.aspx");
            }
        }
Esempio n. 3
0
        protected void SubmitApplication(object sender, EventArgs e)
        {
            List <string>           panelsNeeded   = new List <string>();
            List <string>           To             = new List <string>();
            List <string>           Bcc            = new List <string>();
            List <string>           Cc             = new List <string>();
            List <string>           collegePanels  = new List <string>();
            TiffCreator             tiff           = new TiffCreator();
            AdditionalDocs          additionalDocs = new AdditionalDocs();
            IEnumerable <FieldInfo> transcriptFields;

            Email  email = new Email();
            string emailBody;

            string[] fromAddress;

            if (Enroll.CampusAttending == "Online" || Enroll.CampusAttending == "Louisa" || Enroll.CampusAttending == "Northern Kentucky" || Enroll.CampusAttending == "CarlisleNicholas" || Enroll.CampusAttending == "Mayfield")
            {
                To.Add("*****@*****.**");
            }
            else if (Enroll.CampusAttending == "Lexington")
            {
                To.Add("*****@*****.**");
            }
            else if (Enroll.CampusAttending == "Fort Knox")
            {
                To.Add("*****@*****.**");
                To.Add("*****@*****.**");
            }
            else
            {
                To.Add("*****@*****.**");
            }

            if (Enroll.VABenefits == "Yes")
            {
                To.Add("*****@*****.**");
            }

            fromAddress = PersonalInfo1.StudentName.Split(',');

            //mainPanel.ContentTemplateContainer.Controls
            if (Page.IsValid)
            {
                foreach (Control step in pnlMain.Controls)
                {
                    if (step is Panel)
                    {
                        foreach (Control control in step.Controls)
                        {
                            if (control is UserControl)
                            {
                                foreach (Control currentControl in control.Controls)
                                {
                                    if (currentControl is Panel)
                                    {
                                        formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                                    }
                                }
                            }
                        }
                    }
                    else if (step is UserControl)
                    {
                        foreach (Control currentControl in step.Controls)
                        {
                            if (currentControl is Panel)
                            {
                                formInfo = fieldInfo.CreateFormInfo((Panel)currentControl);
                            }
                        }
                    }
                }//end foreach loop


                for (int i = 0; i <= 9; i++)
                {
                    if (i > SchoolInfo1.collegeValue)
                    {
                        collegePanels.Add("CollegePanel" + i);
                    }
                }

                var colleges = formInfo.Where(c => collegePanels.Contains(c.panelID)).ToList();

                foreach (var college in colleges)
                {
                    formInfo.Remove(college);
                }

                if (Enroll.CompanyReimbursement != "Yes")
                {
                    var companyReimbursement = formInfo.Where(c => c.panelID == "companyDeffermentPanel").ToList();

                    foreach (var company in companyReimbursement)
                    {
                        formInfo.Remove(company);
                    }
                }

                if (Enroll.degreeType == "Graduate" || Enroll.degreeType == "POST GRADUATE")
                {
                    var KY = formInfo.Where(f => f.panelID == "KYResidentContainer" || f.panelID == "panelStateResident").ToList();

                    foreach (var res in KY)
                    {
                        formInfo.Remove(res);
                    }
                }
                else if (KYResidentInfo.KYRes == "No")
                {
                    var KY = formInfo.Where(f => f.panelID == "panelStateResident").ToList();

                    foreach (var res in KY)
                    {
                        formInfo.Remove(res);
                    }
                }

                if (PersonalInfo1.State != "California")
                {
                    var state = formInfo.Where(f => f.panelID == "pnlCalifornia").ToList();

                    foreach (var statePanel in state)
                    {
                        formInfo.Remove(statePanel);
                    }
                }

                if (Enroll.programInfo != null)
                {
                    if (Enroll.programInfo.StartsWith("Baking and Pastry Arts") || Enroll.programInfo.StartsWith("Culinary Arts"))
                    {
                        var program = formInfo.Where(f => f.panelID == "pnlClassRepeat").ToList();

                        foreach (var prog in program)
                        {
                            formInfo.Remove(prog);
                        }
                    }
                }

                if (Enroll.degreeType == "POST GRADUATE")
                {
                    var asf = formInfo.Where(f => f.panelID == "pnlASFContainer" || f.panelID == "pnlASF").ToList();

                    foreach (var asfPanel in asf)
                    {
                        formInfo.Remove(asfPanel);
                    }
                }

                var testInfo = formInfo.Where(r => r.panelID == "TestScorePanel").ToList();

                foreach (var test in testInfo)
                {
                    formInfo.Remove(test);
                }

                if (EnrollAcknowledge.DisplayGradWork == "No")
                {
                    var gradWork = formInfo.Where(r => r.panelID == "pnlGradWork").ToList();

                    foreach (var work in gradWork)
                    {
                        formInfo.Remove(work);
                    }
                }

                if (Enroll.enrollStartDate == "Winter: January 2018")
                {
                    var withdrawPanels = formInfo.Where(f => f.panelID == "pnlWithdraw" || f.panelID == "pnlWithdrawFortKnox").ToList();

                    foreach (var withdrawPanel in withdrawPanels)
                    {
                        formInfo.Remove(withdrawPanel);
                    }
                }
                else
                {
                    var withdrawPanels = formInfo.Where(f => f.panelID == "pnlOldWithdraw").ToList();

                    foreach (var withdrawPanel in withdrawPanels)
                    {
                        formInfo.Remove(withdrawPanel);
                    }

                    if (Enroll.CampusAttending != "Fort Knox")
                    {
                        withdrawPanels.Clear();

                        withdrawPanels = formInfo.Where(f => f.panelID == "pnlWithdrawFortKnox").ToList();

                        foreach (var withdrawPanel in withdrawPanels)
                        {
                            formInfo.Remove(withdrawPanel);
                        }
                    }
                }

                emailBody = email.CreateEmailBody(formInfo);

                //if (ViewState["DisplayProgramDoc"] != null)
                //{
                //    if ((bool)ViewState["DisplayProgramDoc"] == true)
                //    {
                //        if (Enroll.CampusAttending == "Fort Knox")
                //        {
                //            if (Enroll.enrollStartDate == "Winter: January 2018")
                //            {
                //                Session["ProgramDoc"] = "FortKnoxRates";
                //            }
                //            else
                //            {
                //                Session["ProgramDoc"] = "FortKnoxRates2018";
                //            }
                //        }

                //        if (ViewState["ESigParent"] == null)
                //            tuitionAttatchments = tiff.SignTuitionSheet((string)Session["ESig"], null, PersonalInfo1.StudentName, TranscriptESign1.SigDate);
                //        else
                //            tuitionAttatchments = tiff.SignTuitionSheet((string)ViewState["ESig"], (string)Session["ESigParent"], PersonalInfo1.StudentName, TranscriptESign1.SigDate);
                //    }
                //}

                disclosureAttachment = tiff.SignDisclosure((string)Session["ESig"], PersonalInfo1.StudentName, TranscriptESign1.SigDate);

                attachments.Add(disclosureAttachment);
                allAttachments.Add(disclosureAttachment);

                //Create transcripts

                // Build HS/ GED Transcript
                panelsNeeded.Add("PersonalInfoPanel");
                panelsNeeded.Add("AcademicHistoryPanel");
                panelsNeeded.Add("highSchoolPanel");
                panelsNeeded.Add("TranscriptPanel");

                transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                HSGedAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "HS-GED", Enroll.CampusAttending));

                foreach (var item in HSGedAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();

                //Build College Transcipts
                for (int i = 1; i <= 9; i++)
                {
                    if (i <= Convert.ToInt16(SchoolInfo1.collegeNumber))
                    {
                        panelsNeeded.Add("PersonalInfoPanel");
                        panelsNeeded.Add("CollegePanel" + i);
                        panelsNeeded.Add("creditPanel" + i);
                        panelsNeeded.Add("degreePanel" + i);
                        panelsNeeded.Add("TranscriptPanel");
                        panelsNeeded.Add("pnlESig");

                        transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                        CollegeAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "College" + i, Enroll.CampusAttending));
                    }
                }

                foreach (var item in CollegeAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();

                //Build ROI
                panelsNeeded.Add("PersonalInfoPanel");
                panelsNeeded.Add("AcademicHistoryPanel");
                panelsNeeded.Add("highSchoolPanel");

                for (int i = 1; i <= 9; i++)
                {
                    if (i <= Convert.ToInt16(SchoolInfo1.collegeNumber))
                    {
                        panelsNeeded.Add("CollegePanel" + i);
                        panelsNeeded.Add("creditPanel" + i);
                        panelsNeeded.Add("degreePanel" + i);
                    }
                }
                panelsNeeded.Add("TranscriptPanel");
                panelsNeeded.Add("pnlESig");

                transcriptFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                ROIAttatchments.Add(additionalDocs.BuildTranscripts(transcriptFields, (string)Session["ESig"], "ROI", Enroll.CampusAttending));

                foreach (var item in ROIAttatchments)
                {
                    attachments.Add(item);
                    allAttachments.Add(item);
                }

                panelsNeeded.Clear();


                //foreach (string item in tuitionAttatchments)
                //{
                //    attachments.Add(item);
                //}

                foreach (string item in SchoolInfo1.GetTranscriptAttachments())
                {
                    attachments.Add(item);
                    ROIAttatchments.Add(item);
                    allAttachments.Add(item);
                }

                email.SendHTMLEmail("Re-Entry Enrollment Application - " + PersonalInfo1.StudentName, emailBody, To, Bcc, Cc, fromAddress[0] + "@SullivanEnrollment.edu", attachments);

                if (Enroll.CampusAttending == "Louisville")
                {
                    To.Clear();

                    To.Add("*****@*****.**");

                    try
                    {
                        email.SendHTMLEmail("Re-Entry Enrollment Application - " + PersonalInfo1.StudentName, emailBody, To, Bcc, Cc, fromAddress[0] + "@SullivanEnrollment.edu", attachments);
                    }
                    catch (Exception ex)
                    {
                        email.SendErrorEmail("Application Email Error", "Application Email Error", ex);
                    }
                }

                //Session["CampusNumber"] = Enroll.CampusNumber;
                Session["StudentName"] = PersonalInfo1.StudentName;
                Session["Phone"]       = PersonalInfo1.Phone;
                Session["Email"]       = PersonalInfo1.Email;
                Session["ReEntry"]     = "Yes";
                Session["ZipCode"]     = PersonalInfo1.ZipCode;

                //Send and create Tiffs
                Tiffer();

                try
                {
                    To.Clear();
                    To.Add(PersonalInfo1.Email);

                    //Send the application to the student if their email address is in the proper format.
                    var ssn = formInfo.FirstOrDefault(f => f.controlID == "tBoxSocialSecurityNumber");
                    formInfo.Remove(ssn);

                    var dob = formInfo.FirstOrDefault(f => f.controlID == "tbDOB");
                    formInfo.Remove(dob);

                    if (Enroll.AlumniIncentive == "Yes")
                    {
                        string alumniBody;

                        attachments.Clear();

                        alumniBody = "<html><p>Hello " + PersonalInfo1.StudentName + "</p>"
                                     + "<p>IMPORTANT: In order to receive the Alumni Tuition Incentive, the Alumnus must be registered with the Alumni Association prior to completing an enrollment. "
                                     + "Visit <a href='http://alumni.sullivan.edu/register/' target='_blank'>http://alumni.sullivan.edu/register/</a> to register for the Alumni Association. If the alumnus is already a member of the Alumni Association, "
                                     + "visit <a href='http://alumni.sullivan.edu/register/' target='_blank'>http://alumni.sullivan.edu/register/</a> to verify enrollment. If you are not the alumnus, please note you are responsible for ensuring the "
                                     + "Alumnus registers prior to you completing the enrollment process.</p>";

                        //Bcc.Add("*****@*****.**");

                        email.SendHTMLEmail("Sullivan University Alumni Incentive - " + PersonalInfo1.StudentName, alumniBody, To, Bcc, Cc, "*****@*****.**", attachments);

                        To.Clear();

                        To.Add("*****@*****.**");

                        attachments.Clear();

                        panelsNeeded.Clear();
                        panelsNeeded.Add("PersonalInfoPanel");
                        panelsNeeded.Add("PersonalInfoPanel2");
                        panelsNeeded.Add("EnrollPanel");
                        panelsNeeded.Add("programPanel");
                        panelsNeeded.Add("pnlAlumnusName");

                        IEnumerable <FieldInfo> alumniFields = formInfo.Where(f => panelsNeeded.Contains(f.panelID));

                        alumniBody = additionalDocs.BuildAlumniIncentive(alumniFields);

                        email.SendHTMLEmail("Alumni Incentive - " + PersonalInfo1.StudentName, alumniBody, To, Bcc, Cc, "*****@*****.**", attachments);
                    }
                }
                catch { }


                Session["AllAttachments"] = allAttachments;

                ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "TrackSubmission", "TrackSubmission();", true);

                if (Enroll.additionalForms == "MBAAccounting")
                {
                    Response.Redirect("MBAAccounting.aspx");
                }
                else if (Enroll.Housing == "Yes")
                {
                    Response.Redirect("housing.aspx");
                }
                else
                {
                    Response.Redirect("ReEntryConfirmation.aspx");
                }
            }
        }