public ActionResult Support(PracticeAdminSupportViewModel viewM) { PracticeAdminSupportViewModel returnM = new PracticeAdminSupportViewModel(); returnM.Reasons = viewM.Reasons; returnM.Body = viewM.Body; returnM.Reason = viewM.Reason; returnM.Subject = viewM.Subject; List <SelectListItem> reasons = new List <SelectListItem>(); reasons.Add(new SelectListItem { Text = "", Value = "" }); reasons.Add(new SelectListItem { Text = "Data is not right", Value = "Data is not right" }); reasons.Add(new SelectListItem { Text = "Help/Question", Value = "Help/Question" }); reasons.Add(new SelectListItem { Text = "Problem", Value = "Problem" }); reasons.Add(new SelectListItem { Text = "Other", Value = "Other" }); returnM.Reasons = new SelectList(reasons, "Value", "Text"); if (viewM.ReturnEmail == "" || viewM.ReturnEmail == null) { returnM.ErrorMessage = "You must provide an email that we can contact you with."; return(View(returnM)); } else { GenerateComms comm = new GenerateComms(); comm.SendMail(returnM.ReturnEmail, "*****@*****.**", returnM.Subject, returnM.Body, "", "fax", "aimsfx2345", null); returnM.MessageSent = true; returnM.ErrorMessage = null; return(View(returnM)); } }
private void sendCommunications(string ids) { List <int> listofID = new List <int>(); string[] splitList; splitList = ids.Split(new char[] { ',' }); foreach (string i in splitList) { int theID = Convert.ToInt32(i); //Query patient record PatientLog pat = db.PatientLogs.Find(theID); //Determine fax type from table string faxType = (from f in db.FaxServiceTypes where f.Service == pat.ServiceType select f.FaxType).Single() + "Notice"; //Break apart PCP name string[] splitName; splitName = pat.PCP_Practice.Split(new char[] { ',' }); string pcpName = splitName[1] + " " + splitName[0]; string firstname = splitName[1].Trim(); //LINQ doesn't like arrays, throws error string lastname = splitName[0].Trim(); string pcpID = (from u in db.Users where u.FirstName == firstname && u.LastName == lastname select u.UserID).Single(); //Get practice info of PCP, default to AIMS otherwise ReferringPractice prac = new ReferringPractice(); try { prac = (from p in db.ReferringPractices join r in db.RefPracUsers on p.PracID equals r.PracID where r.UserID == pcpID select p).Single(); } catch { prac.Fax = "248-354-4807"; prac.FaxNotification = true; } //Create new reportviewer object and set parameters ReportViewer report = new ReportViewer(); report.ProcessingMode = ProcessingMode.Local; report.LocalReport.ReportPath = Server.MapPath("~") + "AdDisNotice\\" + faxType + pat.Hospital + ".rdlc"; //Cannot perform ToShortDateString on pat.ServiceDate because of DateTime? type DateTime thed = new DateTime(); thed = Convert.ToDateTime(pat.ServiceDate); DateTime birth = new DateTime(); //Null values will cause the reportviewer control to error out try { birth = Convert.ToDateTime(pat.DOB); } catch { birth = DateTime.Parse("1/1/1900"); } if (pat.PatientName == null) { pat.PatientName = ""; } if (pat.Comments == null) { pat.Comments = ""; } if (pat.MRN_FIN == null) { pat.MRN_FIN = ""; } ReportParameter dateparam = new ReportParameter("Date", thed.ToShortDateString()); ReportParameter faxparam = new ReportParameter("Fax", prac.Fax); ReportParameter faxtoparam = new ReportParameter("FaxTo", pcpName); ReportParameter dischargeparam = new ReportParameter("DischargeDate", thed.ToShortDateString()); ReportParameter patientparam = new ReportParameter("Patient", pat.PatientName); ReportParameter treatmentparam = new ReportParameter("Treatment", pat.Comments); ReportParameter mrnparam = new ReportParameter("MRN", pat.MRN_FIN); ReportParameter physicianparam = new ReportParameter("Physician", HubSecurity.getLoggedInDisplayName()); ReportParameter dobparam = new ReportParameter("DOB", birth.ToShortDateString()); ReportParameterCollection theparams = new ReportParameterCollection() { dateparam, faxparam, faxtoparam, dischargeparam, patientparam, treatmentparam, mrnparam, physicianparam, dobparam }; report.LocalReport.SetParameters(theparams); report.LocalReport.Refresh(); string notificationTypes = ""; if (prac.FaxNotification == true) { notificationTypes += "Fax;"; } if (prac.EmailNotification == true) { notificationTypes += "Email;"; } GenerateComms gcomm = new GenerateComms(); gcomm.SendFax(faxType, report, FAX_FOLDER, prac.Fax, pat.Hospital, HubSecurity.getLoggedInUserID(), pcpID, pcpName, pat.ID, pat.PatientName, pat.Comments, "", notificationTypes, birth.ToShortDateString(), prac.PDFPassword, pat.Hospital + faxType, prac.Email, ""); } }
protected void btnFax_Clicked(object sender, EventArgs e) { GenerateComms gcomm = new GenerateComms(); //gcomm.SendFax() }