protected void btnNext_Click(object sender, EventArgs e) { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } } string generalExam = WebObjects.selectedListBoxValues(ddlGeneralExam); string s = string.Empty; }
//protected void Renderer(HtmlTextWriter writer) //{ // MemoryStream mem = new MemoryStream(); // StreamWriter twr = new StreamWriter(mem); // HtmlTextWriter myWriter = new HtmlTextWriter(twr); // base.Render(myWriter); // myWriter.Flush(); // myWriter.Dispose(); // StreamReader strmRdr = new StreamReader(mem); // strmRdr.BaseStream.Position = 0; // string pageContent = strmRdr.ReadToEnd(); // strmRdr.Dispose(); // mem.Dispose(); // writer.Write(pageContent); // CreatePDFDocument(pageContent); //} //protected override void Render(HtmlTextWriter writer) //{ // MemoryStream mem = new MemoryStream(); // StreamWriter twr = new StreamWriter(mem); // HtmlTextWriter myWriter = new HtmlTextWriter(twr); // base.Render(myWriter); // myWriter.Flush(); // myWriter.Dispose(); // StreamReader strmRdr = new StreamReader(mem); // strmRdr.BaseStream.Position = 0; // string pageContent = strmRdr.ReadToEnd(); // strmRdr.Dispose(); // mem.Dispose(); // writer.Write(pageContent); // CreatePDFDocument(pageContent); //} //public void CreatePDFDocument(string strHtml) //{ // string strFileName = HttpContext.Current.Server.MapPath("test.pdf"); // // step 1: creation of a document-object // Document document = new Document(); // // step 2: // // we create a writer that listens to the document // PdfWriter.GetInstance(document, new FileStream(strFileName, FileMode.Create)); // StringReader se = new StringReader(strHtml); // HTMLWorker obj = new HTMLWorker(document); // document.Open(); // //document.Add(se); // obj.Parse(se); // document.Close(); // ShowPdf(strFileName); //} public void CreatePDFDocument() { // Create a Document object var document = new Document(PageSize.A4, 50, 50, 25, 25); // Create a new PdfWriter object, specifying the output stream var output = new MemoryStream(); var writer = PdfWriter.GetInstance(document, output); // Open the Document for writing document.Open(); //... Step 3: Add elements to the document! ... //... var titleFont = FontFactory.GetFont("Arial", 18, Font.BOLD); var subTitleFont = FontFactory.GetFont("Arial", 14, Font.BOLD); var boldTableFont = FontFactory.GetFont("Arial", 12, Font.BOLD); var endingMessageFont = FontFactory.GetFont("Arial", 10, Font.ITALIC); var bodyFont = FontFactory.GetFont("Arial", 12, Font.NORMAL); var orderInfoTable = new PdfPTable(2); orderInfoTable.HorizontalAlignment = 0; orderInfoTable.SpacingBefore = 10; orderInfoTable.SpacingAfter = 10; orderInfoTable.DefaultCell.Border = 0; orderInfoTable.SetWidths(new int[] { 1, 4 }); string presentedComplaints = WebObjects.selectedListBoxValues(ddlPresentingComplaints); orderInfoTable.AddCell(new Phrase("Complaints:", boldTableFont)); foreach (var item in presentedComplaints.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { orderInfoTable.AddCell(item); } orderInfoTable.AddCell(new Phrase("Duration:", boldTableFont)); orderInfoTable.AddCell((TxtDuration.Value)); document.Add(orderInfoTable); // Close the Document - this saves the document contents to the output stream document.Close(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Receipt-{0}.pdf", DateTime.Now.ToShortDateString())); //Response.Write(output); Response.BinaryWrite(output.ToArray()); //Response.WriteFile(output.ToString()); }
protected void btnNext_Click(object sender, EventArgs e) { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } } string axillaryLymphNodes = WebObjects.selectedListBoxValues(ddlAxillaryLymphNodes); string s = string.Empty; }
protected void btnNext_Click(object sender, EventArgs e) { TheCancerProject.Core.Patient thePatient = SessionObjects.ThePatient; TheCancerProject.Core.Patient thePatientToVerify = SessionObjects.ThePatient; PreliminaryExamination entityToReplace = new PreliminaryExamination(); //HINT:Manually Create try { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/GeneralExamination.aspx", false); } } //if (string.IsNullOrWhiteSpace(dateMenarche.Value)) //{ // if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Please Enter a valid Menarche Date" + "', function(){location = '/ThePages/Create/Biodata.aspx';});</script>", false); // } //} string pastMedicalHistory = WebObjects.selectedListBoxValues(ddlPastMedHistory); //TheCancerProject.Core.PreliminaryExamination thePreliminaryExamInSession = (thePatient != null) ? thePatient.ThePreliminaryExamination : null; TheCancerProject.Core.PreliminaryExamination thePreliminaryExam = new Core.PreliminaryExamination(); //theBiodata = theBiodataList.First(); thePreliminaryExam.AllergicReactions = (string.IsNullOrWhiteSpace(txtAllergicReactions.Value)) ? txtAllergicReactions.Value : txtAllergicReactions.Value.Trim(); thePreliminaryExam.DurationOfMenses = (string.IsNullOrWhiteSpace(txtDurationOfMenses.Value)) ? txtDurationOfMenses.Value : txtDurationOfMenses.Value.Trim(); thePreliminaryExam.LengthOfMestrualCycle = (string.IsNullOrWhiteSpace(txtLengthOfMenstrualCycle.Value)) ? txtLengthOfMenstrualCycle.Value : txtLengthOfMenstrualCycle.Value.Trim(); thePreliminaryExam.Parity = (string.IsNullOrWhiteSpace(txtParity.Value)) ? txtParity.Value : txtParity.Value.Trim(); thePreliminaryExam.PastSurgicalHistory = (string.IsNullOrWhiteSpace(txtPastSurgicalHistory.Value)) ? txtPastSurgicalHistory.Value : txtPastSurgicalHistory.Value.Trim(); thePreliminaryExam.RoutineMedications = (string.IsNullOrWhiteSpace(txtRoutineMedications.Value)) ? txtRoutineMedications.Value : txtRoutineMedications.Value.Trim(); thePreliminaryExam.Menarche = (string.IsNullOrWhiteSpace(txtMenarche.Value)) ? txtMenarche.Value : txtMenarche.Value.Trim(); thePreliminaryExam.MedicalHistory = pastMedicalHistory; //thePreliminaryExam.Menarche = Convert.ToDateTime(dateMenarche.Value); thePreliminaryExam.DateCreated = DateTime.Now; thePreliminaryExam.DateUpdated = DateTime.Now; thePreliminaryExam.UniqueID = SessionObjects.PatientUniqueID; //HINT:Manually Create Patient thePatientToSave = new Patient { TheBiodata = (thePatient != null) ? thePatient.TheBiodata : null, TheHospital = (thePatient != null) ? thePatient.TheHospital : null, TheBreastAndAxillaryExamination = (thePatient != null) ? thePatient.TheBreastAndAxillaryExamination : null, TheComplaints = (thePatient != null) ? thePatient.TheComplaints : null, TheEventsOnAdmission = (thePatient != null) ? thePatient.TheEventsOnAdmission : null, TheGeneralExamination = (thePatient != null) ? thePatient.TheGeneralExamination : null, ThePreliminaryExamination = thePreliminaryExam, LastUserAdministeringTreatment = (thePatient != null) ? thePatient.LastUserAdministeringTreatment : null, TheClinicVisits = (thePatient != null) ? thePatient.TheClinicVisits : null, TheInvestigation = (thePatient != null) ? thePatient.TheInvestigation : null, TheProcedures = (thePatient != null) ? thePatient.TheProcedures : null, TheDiagnoses = (thePatient != null) ? thePatient.TheDiagnoses : null, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; if (thePatient != null) //HINT:Manually Create { thePatient.ThePreliminaryExamination = thePreliminaryExam; } else { thePatient = thePatientToSave; } if (thePatientToVerify == null) { PreliminaryExamDAO.Save(thePreliminaryExam); PatientDAO.Save(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/GeneralExamination.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.ThePreliminaryExamination != null && thePatientToVerify.ThePreliminaryExamination.Id <= 0) { PreliminaryExamDAO.Save(thePreliminaryExam); entityToReplace = new PreliminaryExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.ThePreliminaryExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/GeneralExamination.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.ThePreliminaryExamination != null && thePatientToVerify.ThePreliminaryExamination.Id > 0 && thePatientToVerify.ThePreliminaryExamination != thePreliminaryExam) //HINT:Manually Create { thePreliminaryExam.Id = thePatient.ThePreliminaryExamination.Id; //HINT:Manually Create PreliminaryExamDAO.Update(thePreliminaryExam); entityToReplace = new PreliminaryExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.ThePreliminaryExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/GeneralExamination.aspx", false); } else if (thePatientToVerify.ThePreliminaryExamination != null && thePatientToVerify.ThePreliminaryExamination == thePreliminaryExam) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/GeneralExamination.aspx", false); } else { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Unknown error encountered. Kindly contact admin!!!" + "', function(){location = '/Start/Login.aspx';});</script>", false); } } } catch (Exception ex) { string errorMessage = ex.InnerException == null ? ex.Message : ex.InnerException.Message; if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", @"<script type='text/javascript'>alertify.alert('Message', """ + errorMessage.Replace("\n", "").Replace("\r", "") + @""", function(){});</script>", false); } } }
//protected void txtBMI_Click(object sender, EventArgs e) //{ // int height, weight = 0; // if (!string.IsNullOrWhiteSpace(txtWeight.Value) && int.TryParse(txtWeight.Value, out weight) && !string.IsNullOrWhiteSpace(txtHeight.Value) && int.TryParse(txtHeight.Value, out height)) // { // txtBMI.Value = (weight / height).ToString(); // } //} protected void btnNext_Click(object sender, EventArgs e) { TheCancerProject.Core.Patient thePatient = SessionObjects.ThePatient; TheCancerProject.Core.Patient thePatientToVerify = SessionObjects.ThePatient; float height, weight = 0; Core.GeneralExamination entityToReplace = new Core.GeneralExamination(); //HINT:Manually Create try { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } } string generalExam = WebObjects.selectedListBoxValues(ddlGeneralExam); //string Texture = WebObjects.selectedListBoxValues(ddlTexture); string locationOfLesion = WebObjects.selectedListBoxValues(ddlLocationOfLesion); string quadrantLocated = WebObjects.selectedListBoxValues(ddlQuadrantLocated); //TheCancerProject.Core.Complaints theComplaintInSession = (thePatient!=null) ?thePatient.TheComplaints : null; TheCancerProject.Core.GeneralExamination theGeneralExam = new Core.GeneralExamination(); theGeneralExam.TheGeneralExam = generalExam; //theGeneralExam.TheTexture = Texture; theGeneralExam.TheLocationOfLesion = locationOfLesion; theGeneralExam.QuadrantLocated = quadrantLocated; theGeneralExam.TheSymmetry = (Core.Symmetry)Enum.Parse(typeof(Core.Symmetry), ddlSymmetry.SelectedValue); theGeneralExam.Weight = (string.IsNullOrWhiteSpace(txtWeight.Value)) ? txtWeight.Value : txtWeight.Value.Trim(); theGeneralExam.Height = (string.IsNullOrWhiteSpace(txtHeight.Value)) ? txtHeight.Value : txtHeight.Value.Trim(); if (!string.IsNullOrWhiteSpace(txtWeight.Value) && float.TryParse(txtWeight.Value, out weight) && !string.IsNullOrWhiteSpace(txtHeight.Value) && float.TryParse(txtHeight.Value, out height)) { txtBMI.Value = (weight / height).ToString(); txtBSA.Value = Math.Sqrt(((height * 100) * weight) / 3600).ToString(); } else { txtBMI.Value = string.Empty; txtBSA.Value = string.Empty; } theGeneralExam.BMI = (string.IsNullOrWhiteSpace(txtBMI.Value)) ? txtBMI.Value : txtBMI.Value.Trim(); theGeneralExam.BSA = (string.IsNullOrWhiteSpace(txtBSA.Value)) ? txtBSA.Value : txtBSA.Value.Trim(); theGeneralExam.Temperature = (string.IsNullOrWhiteSpace(txtTemperature.Value)) ? txtTemperature.Value : txtTemperature.Value.Trim(); theGeneralExam.Shape = (string.IsNullOrWhiteSpace(txtShape.Value)) ? txtShape.Value : txtShape.Value.Trim(); theGeneralExam.OtherObservations = (string.IsNullOrWhiteSpace(txtOtherObservations.Value)) ? txtOtherObservations.Value : txtOtherObservations.Value.Trim(); theGeneralExam.ColorOfSkinArea = (string.IsNullOrWhiteSpace(txtColorOfSkinArea.Value)) ? txtColorOfSkinArea.Value : txtColorOfSkinArea.Value.Trim(); theGeneralExam.BloodPressure = (string.IsNullOrWhiteSpace(txtBloodPressure.Value)) ? txtBloodPressure.Value : txtBloodPressure.Value.Trim(); theGeneralExam.RespiratoryRate = (string.IsNullOrWhiteSpace(txtRespiratoryRate.Value)) ? txtRespiratoryRate.Value : txtRespiratoryRate.Value.Trim(); theGeneralExam.HeartSounds = (string.IsNullOrWhiteSpace(txtHeartSounds.Value)) ? txtHeartSounds.Value : txtHeartSounds.Value.Trim(); theGeneralExam.PulseRate = (string.IsNullOrWhiteSpace(txtPulseRRate.Value)) ? txtPulseRRate.Value : txtPulseRRate.Value.Trim(); theGeneralExam.DateCreated = DateTime.Now; theGeneralExam.DateUpdated = DateTime.Now; theGeneralExam.UniqueID = SessionObjects.PatientUniqueID; //HINT:Manually Create Patient thePatientToSave = new Patient { TheBiodata = (thePatient != null) ? thePatient.TheBiodata : null, TheHospital = (thePatient != null) ? thePatient.TheHospital : null, TheBreastAndAxillaryExamination = (thePatient != null) ? thePatient.TheBreastAndAxillaryExamination : null, TheComplaints = (thePatient != null) ? thePatient.TheComplaints : null, TheEventsOnAdmission = (thePatient != null) ? thePatient.TheEventsOnAdmission : null, TheGeneralExamination = theGeneralExam, ThePreliminaryExamination = (thePatient != null) ? thePatient.ThePreliminaryExamination : null, LastUserAdministeringTreatment = (thePatient != null) ? thePatient.LastUserAdministeringTreatment : null, TheClinicVisits = (thePatient != null) ? thePatient.TheClinicVisits : null, TheInvestigation = (thePatient != null) ? thePatient.TheInvestigation : null, TheProcedures = (thePatient != null) ? thePatient.TheProcedures : null, TheDiagnoses = (thePatient != null) ? thePatient.TheDiagnoses : null, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; if (thePatient != null) //HINT:Manually Create { thePatient.TheGeneralExamination = theGeneralExam; } else { thePatient = thePatientToSave; } if (thePatientToVerify == null) { GeneralExamDAO.Save(theGeneralExam); PatientDAO.Save(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheGeneralExamination != null && thePatientToVerify.TheGeneralExamination.Id <= 0) { GeneralExamDAO.Save(theGeneralExam); entityToReplace = new GeneralExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheGeneralExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheGeneralExamination != null && thePatientToVerify.TheGeneralExamination.Id > 0 && thePatientToVerify.TheGeneralExamination != theGeneralExam) //HINT:Manually Create { theGeneralExam.Id = thePatient.TheGeneralExamination.Id; //HINT:Manually Create GeneralExamDAO.Update(theGeneralExam); entityToReplace = new GeneralExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheGeneralExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } else if (thePatientToVerify.TheGeneralExamination != null && thePatientToVerify.TheGeneralExamination == theGeneralExam) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/BreastAndAxillaryExamination.aspx", false); } else { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Unknown error encountered. Kindly contact admin!!!" + "', function(){location = '/Start/Login.aspx';});</script>", false); } } } catch (Exception ex) { string errorMessage = ex.InnerException == null ? ex.Message : ex.InnerException.Message; if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", @"<script type='text/javascript'>alertify.alert('Message', """ + errorMessage.Replace("\n", "").Replace("\r", "") + @""", function(){});</script>", false); } } }
protected void btnNext_Click(object sender, EventArgs e) { TheCancerProject.Core.Patient thePatient = SessionObjects.ThePatient; TheCancerProject.Core.Patient thePatientToVerify = SessionObjects.ThePatient; try { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/HistoryAndPreliminaryExamination.aspx", false); } } string presentedComplaints = WebObjects.selectedListBoxValues(ddlPresentingComplaints); string cause = WebObjects.selectedListBoxValues(ddlCause); string complications = WebObjects.selectedListBoxValues(ddlComplications); string care = WebObjects.selectedListBoxValues(ddlCare); //TheCancerProject.Core.Complaints theComplaintInSession = (thePatient!=null) ?thePatient.TheComplaints : null; TheCancerProject.Core.Complaints theComplaint = new Core.Complaints(); //theBiodata = theBiodataList.First(); theComplaint.DurationOfComplaints = (string.IsNullOrWhiteSpace(TxtDuration.Value)) ?TxtDuration.Value : TxtDuration.Value.Trim(); theComplaint.HistoryOfPresentingComplaints = (string.IsNullOrWhiteSpace(txtHistoryOfComplaints.Value)) ? txtHistoryOfComplaints.Value : txtHistoryOfComplaints.Value.Trim(); theComplaint.TheComplaints = presentedComplaints; theComplaint.TheCause = cause; theComplaint.TheComplications = complications; theComplaint.TheCare = care; theComplaint.DateCreated = DateTime.Now; theComplaint.DateUpdated = DateTime.Now; Patient thePatientToSave = new Patient { TheBiodata = (thePatient != null) ? thePatient.TheBiodata :null, TheHospital = (thePatient != null) ? thePatient.TheHospital :null, TheBreastAndAxillaryExamination = (thePatient != null) ?thePatient.TheBreastAndAxillaryExamination :null, TheComplaints = theComplaint, TheEventsOnAdmission = (thePatient != null) ? thePatient.TheEventsOnAdmission :null, TheGeneralExamination = (thePatient != null) ? thePatient.TheGeneralExamination : null, ThePreliminaryExamination = (thePatient != null) ?thePatient.ThePreliminaryExamination : null, LastUserAdministeringTreatment = (thePatient != null) ?thePatient.LastUserAdministeringTreatment : null, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; //thePatient.TheBiodata = theBiodata; //thePatient.TheComplaints = theComplaint; thePatient = thePatientToSave; SessionObjects.ThePatient = thePatient; if (thePatientToVerify.TheComplaints == null) { ComplaintsDAO.Save(theComplaint); PatientDAO.Save(thePatientToSave); Response.Redirect("~/ThePages/Create/HistoryAndPreliminaryExamination.aspx", false); } else if (thePatientToVerify.TheComplaints != null && thePatientToVerify.TheComplaints != theComplaint) { ComplaintsDAO.Save(theComplaint); PatientDAO.Update(thePatientToSave); Response.Redirect("~/ThePages/Create/HistoryAndPreliminaryExamination.aspx", false); } else if (thePatientToVerify.TheComplaints != null && thePatientToVerify.TheComplaints == theComplaint) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/HistoryAndPreliminaryExamination.aspx", false); } //else if (theBiodataList != null && theBiodataList.Count > 1) //{ // if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Multiple Biodata Exists for this patient. Kindly contact admin!!!" + "', function(){location = '/Start/Login.aspx';});</script>", false); // } //} else { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Unknown error encountered. Kindly contact admin!!!" + "', function(){location = '/Start/Login.aspx';});</script>", false); } } //if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Admin Saved Successfully" + "', function(){location = '/Start/Login.aspx';});</script>", false); //} } catch (Exception ex) { string errorMessage = ex.InnerException == null ? ex.Message : ex.InnerException.Message; if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", @"<script type='text/javascript'>alertify.alert('Message', """ + errorMessage.Replace("\n", "").Replace("\r", "") + @""", function(){});</script>", false); } } }
protected void btnNext_Click(object sender, EventArgs e) { TheCancerProject.Core.Patient thePatient = SessionObjects.ThePatient; TheCancerProject.Core.Patient thePatientToVerify = SessionObjects.ThePatient; Core.BreastAndAxillaryExamination entityToReplace = new Core.BreastAndAxillaryExamination(); //HINT:Manually Create try { bool doNotSaveInDB = false; if (System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"] != null && Boolean.TryParse(System.Configuration.ConfigurationManager.AppSettings["DoNotSaveInDB"], out doNotSaveInDB)) { if (doNotSaveInDB) { Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } } string axillaryLymphNodes = WebObjects.selectedListBoxValues(ddlAxillaryLymphNodes); string anteriorChestWallNodules = WebObjects.selectedListBoxValues(ddlSupraClavicularNodes); string supraClavicularNodes = WebObjects.selectedListBoxValues(ddlAnteriorChestWallNodules); string locationOfLesions = WebObjects.selectedListBoxValues(ddlLocationOfLesions); //TheCancerProject.Core.Complaints theComplaintInSession = (thePatient!=null) ?thePatient.TheComplaints : null; TheCancerProject.Core.BreastAndAxillaryExamination theBreastAndAxillaryExamination = new Core.BreastAndAxillaryExamination(); theBreastAndAxillaryExamination.TheAxillaryLymphNodes = axillaryLymphNodes; theBreastAndAxillaryExamination.TheAnteriorChestWallNodules = anteriorChestWallNodules; theBreastAndAxillaryExamination.TheSupraclavicularNodes = supraClavicularNodes; theBreastAndAxillaryExamination.TheLocationOfLesions = locationOfLesions; theBreastAndAxillaryExamination.TheBreastWithLesion = (Core.BreastWithLesion)Enum.Parse(typeof(Core.BreastWithLesion), ddlBreastWithLesion.SelectedValue); theBreastAndAxillaryExamination.TheTemperature = (Core.Temperature)Enum.Parse(typeof(Core.Temperature), ddlTemperature.SelectedValue); theBreastAndAxillaryExamination.Appearance = (Core.Appearance)Enum.Parse(typeof(Core.Appearance), ddlAppearance.SelectedValue); theBreastAndAxillaryExamination.TypeOfDischarge = (Core.TypeOfDischarge)Enum.Parse(typeof(Core.TypeOfDischarge), ddlTypeOfDischarge.SelectedValue); theBreastAndAxillaryExamination.FindingsUnderBreast = (string.IsNullOrWhiteSpace(txtFindingsUnderBreast.Value)) ? txtFindingsUnderBreast.Value : txtFindingsUnderBreast.Value.Trim(); theBreastAndAxillaryExamination.FindingsUnderArms = (string.IsNullOrWhiteSpace(txtFindingsWithArmsOnHips.Value)) ? txtFindingsWithArmsOnHips.Value : txtFindingsWithArmsOnHips.Value.Trim(); theBreastAndAxillaryExamination.NumberOfLesions = (string.IsNullOrWhiteSpace(txtNumberOfLesions.Value)) ? txtNumberOfLesions.Value : txtNumberOfLesions.Value.Trim(); theBreastAndAxillaryExamination.Size = (string.IsNullOrWhiteSpace(txtSize.Value)) ? txtSize.Value : txtSize.Value.Trim(); theBreastAndAxillaryExamination.AreolaColor = (string.IsNullOrWhiteSpace(txtAreolaColour.Value)) ? txtAreolaColour.Value : txtAreolaColour.Value.Trim(); theBreastAndAxillaryExamination.Surface = (string.IsNullOrWhiteSpace(txtSurface.Value)) ? txtSurface.Value : txtSurface.Value.Trim(); theBreastAndAxillaryExamination.Elevated = chkElevated.Checked; theBreastAndAxillaryExamination.Deviated = chkDeviated.Checked; theBreastAndAxillaryExamination.Cracks = chkCracks.Checked; theBreastAndAxillaryExamination.Fissure = chkFissure.Checked; theBreastAndAxillaryExamination.Ulcer = chkUlcer.Checked; theBreastAndAxillaryExamination.Scale = chkScales.Checked; theBreastAndAxillaryExamination.Discharge = chkDischarge.Checked; theBreastAndAxillaryExamination.DateCreated = DateTime.Now; theBreastAndAxillaryExamination.DateUpdated = DateTime.Now; theBreastAndAxillaryExamination.UniqueID = SessionObjects.PatientUniqueID; //HINT:Manually Create Patient thePatientToSave = new Patient { TheBiodata = (thePatient != null) ? thePatient.TheBiodata : null, TheHospital = (thePatient != null) ? thePatient.TheHospital : null, TheBreastAndAxillaryExamination = theBreastAndAxillaryExamination, TheComplaints = (thePatient != null) ? thePatient.TheComplaints : null, TheEventsOnAdmission = (thePatient != null) ? thePatient.TheEventsOnAdmission : null, TheGeneralExamination = (thePatient != null) ? thePatient.TheGeneralExamination : null, ThePreliminaryExamination = (thePatient != null) ? thePatient.ThePreliminaryExamination : null, LastUserAdministeringTreatment = (thePatient != null) ? thePatient.LastUserAdministeringTreatment : null, TheClinicVisits = (thePatient != null) ? thePatient.TheClinicVisits : null, TheInvestigation = (thePatient != null) ? thePatient.TheInvestigation : null, TheProcedures = (thePatient != null) ? thePatient.TheProcedures : null, TheDiagnoses = (thePatient != null) ? thePatient.TheDiagnoses : null, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; if (thePatient != null) //HINT:Manually Create { thePatient.TheBreastAndAxillaryExamination = theBreastAndAxillaryExamination; } else { thePatient = thePatientToSave; } if (thePatientToVerify == null) //nothing in session { B_And_A_ExamDAO.Save(theBreastAndAxillaryExamination); PatientDAO.Save(thePatientToSave); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheBreastAndAxillaryExamination != null && thePatientToVerify.TheBreastAndAxillaryExamination.Id <= 0) { B_And_A_ExamDAO.Save(theBreastAndAxillaryExamination); entityToReplace = new B_And_A_ExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheBreastAndAxillaryExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheBreastAndAxillaryExamination != null && thePatientToVerify.TheBreastAndAxillaryExamination.Id > 0 && thePatientToVerify.TheBreastAndAxillaryExamination != theBreastAndAxillaryExamination) //HINT:Manually Create { theBreastAndAxillaryExamination.Id = thePatient.TheBreastAndAxillaryExamination.Id; //HINT:Manually Create B_And_A_ExamDAO.Update(theBreastAndAxillaryExamination); entityToReplace = new B_And_A_ExamDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheBreastAndAxillaryExamination = entityToReplace; //HINT:Manually Create PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } else if (thePatientToVerify.TheBreastAndAxillaryExamination != null && thePatientToVerify.TheBreastAndAxillaryExamination == theBreastAndAxillaryExamination) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/EventsOnAdmission.aspx", false); } else { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script type='text/javascript'>alertify.alert('Message', '" + "Unknown error encountered. Kindly contact admin!!!" + "', function(){location = '/ThePages/Create/BreastAndAxillaryExamination.aspx';});</script>", false); } } } catch (Exception ex) { string errorMessage = ex.InnerException == null ? ex.Message : ex.InnerException.Message; if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "message")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", @"<script type='text/javascript'>alertify.alert('Message', """ + errorMessage.Replace("\n", "").Replace("\r", "") + @""", function(){});</script>", false); } } }