Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebObjects.EnumToListBox(typeof(TheCancerProject.Core.PresentedComplaints), ddlPresentingComplaints);
            WebObjects.EnumToListBox(typeof(TheCancerProject.Core.Cause), ddlCause);
            WebObjects.EnumToListBox(typeof(TheCancerProject.Core.Complications), ddlComplications);
            WebObjects.EnumToListBox(typeof(TheCancerProject.Core.Care), ddlCare);

            #region displays the values from DB (including Listbox values)
            long       theID   = 1;
            Complaints theComp = new ComplaintsDAO().Retrieve(theID);
            TxtDuration.Value            = theComp.DurationOfComplaints;
            txtHistoryOfComplaints.Value = theComp.HistoryOfPresentingComplaints;
            WebObjects.displayStoredSelectedListBoxValues(theComp.TheComplaints, ddlPresentingComplaints);
            WebObjects.displayStoredSelectedListBoxValues(theComp.TheComplications, ddlComplications);
            WebObjects.displayStoredSelectedListBoxValues(theComp.TheCause, ddlCause);
            WebObjects.displayStoredSelectedListBoxValues(theComp.TheCare, ddlCare);
            #endregion

            Patient patient = SessionObjects.ThePatient;
            if (patient != null && patient.TheComplaints != null)
            {
                TxtDuration.Value            = patient.TheComplaints.DurationOfComplaints;
                txtHistoryOfComplaints.Value = patient.TheComplaints.HistoryOfPresentingComplaints;
                WebObjects.displayStoredSelectedListBoxValues(patient.TheComplaints.TheComplaints, ddlPresentingComplaints);
                WebObjects.displayStoredSelectedListBoxValues(patient.TheComplaints.TheComplications, ddlComplications);
                WebObjects.displayStoredSelectedListBoxValues(patient.TheComplaints.TheCause, ddlCause);
                WebObjects.displayStoredSelectedListBoxValues(patient.TheComplaints.TheCare, ddlCare);
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }