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 btnNext_Click(object sender, EventArgs e) { TheCancerProject.Core.Patient thePatient = SessionObjects.ThePatient; TheCancerProject.Core.Patient thePatientToVerify = SessionObjects.ThePatient; TheCancerProject.Core.Biodata theBiodataToReplace = new Core.Biodata(); string uniqueID = string.Empty; if (thePatient == null || string.IsNullOrWhiteSpace(thePatient.UniqueID)) { uniqueID = new PatientDAO().CreateUniqueID(); } else if (thePatient != null && !string.IsNullOrWhiteSpace(thePatient.UniqueID)) { uniqueID = thePatient.UniqueID; } 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/PresentingComplaints.aspx", false); } } if (string.IsNullOrWhiteSpace(dateDateofBirth.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 Date Of Birth" + "', function(){location = '/ThePages/Create/Biodata.aspx';});</script>", false); } } //List<TheCancerProject.Core.Biodata> theBiodataList = new BiodataDAO().RetrieveByHospitalAndHospitalNumber(SessionObjects.TheHospital, SessionObjects.HospitalNumber); TheCancerProject.Core.Biodata theBiodata = new Core.Biodata(); //theBiodata = theBiodataList.First(); theBiodata.DateOfBirth = Convert.ToDateTime(dateDateofBirth.Value); theBiodata.Age = Convert.ToString((DateTime.Now.Year - theBiodata.DateOfBirth.Year)); theBiodata.TheHospital = (SessionObjects.TheHospital != null) ? SessionObjects.TheHospital : null; theBiodata.Address = txtAddress.Value; theBiodata.FirstName = txtFirstName.Value; theBiodata.HospitalNumber = txtHospitalNumber.Value; theBiodata.LastName = txtLastName.Value; theBiodata.NextOfKinName = txtNextOfKinName.Value; theBiodata.NextOfKinPhone = txtNextofKinPhone.Value; theBiodata.Occupation = txtOccupation.Value; theBiodata.PhoneNumber = txtPhone.Value; theBiodata.OtherNames = txtOtherNames.Value; theBiodata.Religion = (Religion)Enum.Parse(typeof(Religion), ddlReligion.SelectedValue, true); theBiodata.Sex = (Sex)Enum.Parse(typeof(Sex), ddlSex.SelectedValue); theBiodata.Title = (Title)Enum.Parse(typeof(Title), ddlTitle.SelectedValue); theBiodata.StateOfResidence = (State)Enum.Parse(typeof(State), ddlStates.SelectedValue); theBiodata.MaritalStatus = (MaritalStatus)Enum.Parse(typeof(MaritalStatus), ddlMaritalStatus.SelectedValue); theBiodata.NextOfKinRelationship = (Relationship)Enum.Parse(typeof(Relationship), ddlRelationship.SelectedValue); theBiodata.DateCreated = DateTime.Now; theBiodata.DateUpdated = DateTime.Now; theBiodata.UniqueID = uniqueID; Patient thePatientToSave = new Patient { TheBiodata = theBiodata, 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 = (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, UniqueID = uniqueID, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; //thePatient.TheBiodata = theBiodata; SessionObjects.TheBiodata = theBiodata; SessionObjects.PatientUniqueID = uniqueID; //thePatient = thePatientToSave; //SessionObjects.ThePatient = thePatient; if (thePatient != null) { thePatient.TheBiodata = theBiodata; } else { thePatient = thePatientToSave; } if (thePatientToVerify == null) //nothing in session { BiodataDAO.Save(theBiodata); PatientDAO.Save(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); SessionObjects.ThePatient = thePatient; Response.Redirect("~/ThePages/Create/PresentingComplaints.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheBiodata != null && thePatientToVerify.TheBiodata.Id <= 0) { BiodataDAO.Save(theBiodata); theBiodataToReplace = new BiodataDAO().RetrieveByUniqueID(uniqueID); // Take newly saved biodata, so that the ID can be available during update query below thePatient.TheBiodata = theBiodataToReplace; PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); SessionObjects.ThePatient = thePatient; Response.Redirect("~/ThePages/Create/PresentingComplaints.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheBiodata != null && thePatientToVerify.TheBiodata.Id > 0 && thePatientToVerify.TheBiodata != theBiodata) { theBiodata.Id = thePatient.TheBiodata.Id; BiodataDAO.Update(theBiodata); theBiodataToReplace = new BiodataDAO().RetrieveByUniqueID(uniqueID); // Take newly saved biodata, so that the ID can be available during update query below thePatient.TheBiodata = theBiodataToReplace; PatientDAO.Update(thePatient); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); SessionObjects.ThePatient = thePatient; Response.Redirect("~/ThePages/Create/PresentingComplaints.aspx", false); } else if (thePatientToVerify.TheBiodata != null && thePatientToVerify.TheBiodata == theBiodata) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/PresentingComplaints.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/Biodata.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) { 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/PresentingComplaints.aspx", false); } } List <TheCancerProject.Core.Biodata> theBiodataList = new BiodataDAO().RetrieveByHospitalAndHospitalNumber(SessionObjects.TheHospital, SessionObjects.HospitalNumber); TheCancerProject.Core.Biodata theBiodata = new Core.Biodata(); //theBiodata = theBiodataList.First(); theBiodata.TheHospital = (SessionObjects.TheHospital != null) ? SessionObjects.TheHospital : null; theBiodata.Address = txtAddress.Value; theBiodata.FirstName = txtFirstName.Value; theBiodata.HospitalNumber = txtHospitalNumber.Value; theBiodata.LastName = txtLastName.Value; theBiodata.NextOfKinName = txtNextOfKinName.Value; theBiodata.NextOfKinPhone = txtNextofKinPhone.Value; theBiodata.Occupation = txtOccupation.Value; theBiodata.PhoneNumber = txtPhone.Value; theBiodata.OtherNames = txtOtherNames.Value; theBiodata.Religion = (Religion)Enum.Parse(typeof(Religion), ddlReligion.SelectedValue, true); theBiodata.Sex = (Sex)Enum.Parse(typeof(Sex), ddlSex.SelectedValue); theBiodata.Title = (Title)Enum.Parse(typeof(Title), ddlTitle.SelectedValue); theBiodata.StateOfResidence = (State)Enum.Parse(typeof(State), ddlStates.SelectedValue); theBiodata.MaritalStatus = (MaritalStatus)Enum.Parse(typeof(MaritalStatus), ddlMaritalStatus.SelectedValue); theBiodata.NextOfKinRelationship = (Relationship)Enum.Parse(typeof(Relationship), ddlRelationship.SelectedValue); theBiodata.DateCreated = DateTime.Now; theBiodata.DateUpdated = DateTime.Now; Patient thePatient = new Patient { TheBiodata = theBiodata, TheHospital = null, TheBreastAndAxillaryExamination = null, TheComplaints = null, TheEventsOnAdmission = null, TheGeneralExamination = null, ThePreliminaryExamination = null, LastUserAdministeringTreatment = null, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }; //thePatient.TheBiodata = theBiodata; SessionObjects.TheBiodata = theBiodata; if (theBiodataList == null || theBiodataList.Count <= 0) { BiodataDAO.Save(theBiodata); PatientDAO.Save(thePatient); Response.Redirect("~/ThePages/Create/PresentingComplaints.aspx", false); } else if (theBiodataList != null && theBiodataList.FirstOrDefault() != theBiodata) { BiodataDAO.Update(theBiodata); PatientDAO.Update(thePatient); Response.Redirect("~/ThePages/Create/PresentingComplaints.aspx", false); } else if (theBiodataList != null && theBiodataList.FirstOrDefault() == theBiodata) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/PresentingComplaints.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.ClinicVisits entityToReplace = new Core.ClinicVisits(); //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/ClinicVisits.aspx", false); } } if (string.IsNullOrWhiteSpace(dateAppointmentDate.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 Date Of Birth" + "', function(){location = '/ThePages/Create/Biodata.aspx';});</script>", false); } } //TheCancerProject.Core.Complaints theComplaintInSession = (thePatient!=null) ?thePatient.TheComplaints : null; TheCancerProject.Core.ClinicVisits theClinicVisits = new Core.ClinicVisits(); theClinicVisits.AppointmentDate = Convert.ToDateTime(dateAppointmentDate.Value); theClinicVisits.MedicalSummaryAfterVisit = txtSummary.Value; theClinicVisits.DateCreated = DateTime.Now; theClinicVisits.DateUpdated = DateTime.Now; theClinicVisits.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 = (thePatient != null) ? thePatient.ThePreliminaryExamination : null, LastUserAdministeringTreatment = (thePatient != null) ? thePatient.LastUserAdministeringTreatment : null, TheClinicVisits = theClinicVisits, 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.TheClinicVisits = theClinicVisits; } else { thePatient = thePatientToSave; } if (thePatientToVerify == null) { ClinicVisitsDAO.Save(theClinicVisits); PatientDAO.Save(thePatientToSave); thePatient = new PatientDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create SessionObjects.ThePatient = thePatient; //HINT:Manually Create Response.Redirect("~/ThePages/Create/ClinicVisits.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheClinicVisits != null && thePatientToVerify.TheClinicVisits.Id <= 0) { ClinicVisitsDAO.Save(theClinicVisits); entityToReplace = new ClinicVisitsDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheClinicVisits = 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/ClinicVisits.aspx", false); } else if (thePatientToVerify != null && thePatientToVerify.Id > 0 && thePatientToVerify.TheClinicVisits != null && thePatientToVerify.TheClinicVisits.Id > 0 && thePatientToVerify.TheClinicVisits != theClinicVisits) //HINT:Manually Create { theClinicVisits.Id = thePatient.TheClinicVisits.Id; //HINT:Manually Create ClinicVisitsDAO.Update(theClinicVisits); entityToReplace = new ClinicVisitsDAO().RetrieveByUniqueID(SessionObjects.PatientUniqueID); //HINT:Manually Create thePatient.TheClinicVisits = 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/ClinicVisits.aspx", false); } else if (thePatientToVerify.TheClinicVisits != null && thePatientToVerify.TheClinicVisits == theClinicVisits) { //If it's the same data, don't save or update, just redirect Response.Redirect("~/ThePages/Create/ClinicVisits.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/Diagnosis.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); } } }