Exemplo n.º 1
0
        public Medecin SupprimerPatient(int IDpatient, int IDMedecin)
        {
            PatientDAO patientDAO = new PatientDAO();
            MedecinDAO medecinDAO = new MedecinDAO();

            if (!patientDAO.IsPatient(IDpatient))
            {
                throw new PatientIncorrecteException("Ce compte n'est pas un compte Patient", medecinDAO.VoirMedecin(IDMedecin));
            }
            if (!medecinDAO.IsMedecin(IDMedecin))
            {
                throw new MedecinIncorrecteException("Ce compte n'est pas un compte Medcin", medecinDAO.VoirMedecin(IDMedecin));
            }
            Medecin medecin = medecinDAO.VoirMedecin(IDMedecin);
            Patient patient = patientDAO.VoirPatient(IDpatient);

            if (patient.MesMedecin.SingleOrDefault(elt => elt.IDMedecin == IDMedecin) == null) //S'il n'y a pas de médecin pour patient
            {
                medecin.Erreur = "Le patient " + patient.Nom + " " + patient.Prenom + " " + patient.Identifiant + " vous est déjà attribué";
                throw new PatientNonPresentException("Impossible de supprimer le patient du Médecin car attribution pas présente", medecin);
            }
            else
            {
                patientDAO.SupprMedecinDuPatient(patient, medecin);
            }

            return(medecinDAO.VoirMedecin(medecin.IDMedecin));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                user = Session["User"].ToString();
                if (user == "admin")
                {
                    ddlDoctor.Visible = true;
                    lblDoctor.Visible = true;
                    DataSet dsDoctor = new DoctorDAO().getDocs();
                    ddlDoctor.DataSource     = dsDoctor;
                    ddlDoctor.DataTextField  = "name";
                    ddlDoctor.DataValueField = "docID";
                    ddlDoctor.DataBind();
                }
                else
                {
                    ddlDoctor.Visible = false;
                    lblDoctor.Visible = false;
                }

                DataSet dsPatient = new PatientDAO().getPatients();
                ddlPatient.DataSource     = dsPatient;
                ddlPatient.DataTextField  = "Name";
                ddlPatient.DataValueField = "ID";
                ddlPatient.DataBind();

                DataSet dsTreatment = new TreatmentDAO().getAllTreatments();
                ddlTreatment.DataSource     = dsTreatment;
                ddlTreatment.DataTextField  = "Name";
                ddlTreatment.DataValueField = "Name";
                ddlTreatment.DataBind();
                ddlTreatment.Items.Insert(0, "Please select a treatment");
            }
        }
Exemplo n.º 3
0
        public Medecin AttributionPatient(int IDpatient, int IDMedecin)
        {
            PatientDAO patientDAO = new PatientDAO();
            MedecinDAO medecinDAO = new MedecinDAO();

            if (!patientDAO.IsPatient(IDpatient))
            {
                throw new PatientIncorrecteException("Ce compte n'est pas un compte Patient", medecinDAO.VoirMedecin(IDMedecin));
            }
            if (!medecinDAO.IsMedecin(IDMedecin))
            {
                throw new MedecinIncorrecteException("Ce compte n'est pas un compte Medecin", medecinDAO.VoirMedecin(IDMedecin));
            }
            Medecin medecin = medecinDAO.VoirMedecin(IDMedecin);
            Patient patient = patientDAO.VoirPatient(IDpatient);

            if (patient.MesMedecin.SingleOrDefault(elt => elt.IDMedecin == IDMedecin) != null)
            {
                medecin.Erreur = "Le patient " + patient.Nom + " " + patient.Prenom + " " + patient.Identifiant + " vous est déjà attribué";
                throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", medecin);
            }

            patientDAO.AttributionMedecin(patient, medecinDAO.VoirMedecinSimple(IDMedecin));
            return(medecinDAO.VoirMedecin(IDMedecin));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         con = Request.QueryString["con"];
         DataSet D = new DataSet();
         D  = new PatientDAO().getPatient(con);
         id = Convert.ToInt32(D.Tables[0].Rows[0][0]);
         if (D.Tables[0].Rows.Count > 0)
         {
             tbName.Text          = D.Tables[0].Rows[0][1].ToString();
             tbAddress.Text       = D.Tables[0].Rows[0][2].ToString();
             tbContactNo.Text     = D.Tables[0].Rows[0][3].ToString();
             tbAge.Text           = D.Tables[0].Rows[0][4].ToString();
             tbSex.Text           = D.Tables[0].Rows[0][5].ToString();
             tbMaritalStatus.Text = D.Tables[0].Rows[0][6].ToString();
             tbOccupation.Text    = D.Tables[0].Rows[0][7].ToString();
             MedInfo.InnerText    = D.Tables[0].Rows[0][8].ToString();
         }
         else
         {
             MessageBox.Show("No match found!");
             Response.Redirect("SearchAddPatient.aspx");
         }
     }
 }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                emailPatient = Session["searchEmail"].ToString();
                DataSet D = new DataSet();
                D = new PatientDAO().getPatient(emailPatient);

                if (D.Tables[0].Rows.Count > 0)
                {
                    id                   = Convert.ToInt32(D.Tables[0].Rows[0]["id"]);
                    tbID.Text            = D.Tables[0].Rows[0]["id"].ToString();
                    tbName.Text          = D.Tables[0].Rows[0]["name"].ToString();
                    tbEmail.Text         = D.Tables[0].Rows[0]["email"].ToString();
                    tbDOB.Text           = Convert.ToDateTime(D.Tables[0].Rows[0]["dob"]).ToString("dd/MM/yyyy");
                    tbAddress.Text       = D.Tables[0].Rows[0]["address"].ToString();
                    tbContactNo.Text     = D.Tables[0].Rows[0]["contactNo"].ToString();
                    tbAge.Text           = D.Tables[0].Rows[0]["age"].ToString();
                    tbSex.Text           = D.Tables[0].Rows[0]["sex"].ToString();
                    tbMaritalStatus.Text = D.Tables[0].Rows[0]["maritalStatus"].ToString();
                    tbOccupation.Text    = D.Tables[0].Rows[0]["occupation"].ToString();
                    MedInfo.InnerText    = D.Tables[0].Rows[0]["medInfo"].ToString();
                }
            }
        }
    protected void Update_Click(object sender, EventArgs e)
    {
        con = Request.QueryString["con"];
        DataSet D = new DataSet();

        D  = new PatientDAO().getPatient(con);
        id = Convert.ToInt32(D.Tables[0].Rows[0][0]);
        string name      = tbName.Text;
        string address   = tbAddress.Text;
        string contactNo = tbContactNo.Text;
        int    age       = Convert.ToInt32(tbAge.Text);
        string sex       = tbSex.Text;
        string mStatus   = tbMaritalStatus.Text;
        string occ       = tbOccupation.Text;
        string medInfo   = MedInfo.InnerText;

        if (new PatientDAO().updatePatient(id, new PatientDTO(name, address, contactNo, age, sex, mStatus, occ, medInfo)))
        {
            Response.Redirect("SearchAddPatient.aspx");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('Update Error!! Please try again!!!');</script>");
        }
    }
Exemplo n.º 7
0
        protected void History_Click(object sender, EventArgs e)
        {
            emailPatient = Session["searchEmail"].ToString();
            DataSet D = new DataSet();

            D  = new PatientDAO().getPatient(emailPatient);
            id = Convert.ToInt32(D.Tables[0].Rows[0][0]);
            Response.Redirect("DentalHistory.aspx?id=" + id);
        }
    protected void History_Click(object sender, EventArgs e)
    {
        con = Request.QueryString["con"];
        DataSet D = new DataSet();

        D  = new PatientDAO().getPatient(con);
        id = Convert.ToInt32(D.Tables[0].Rows[0][0]);
        Response.Redirect("DentalHistory.aspx?id=" + id);
    }
Exemplo n.º 9
0
        private void FillTabPatients()
        {
            List <Patient> patients = new PatientDAO(connection).Select(null);

            foreach (Patient pt in patients)
            {
                this.AddRowTabPatients(pt);
            }
        }
Exemplo n.º 10
0
 private void CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1 && e.RowIndex + 1 != tabPatients.Rows.Count)
     {
         String        nom     = tabPatients.SelectedCells[0].Value.ToString();
         Patient       pt      = new PatientDAO(connection).Select("WHERE nom = '" + nom + "'").First();
         List <Config> configs = new ConfigDAO(connection).Select("WHERE patient = '" + pt.Id + "'");
         this.DrawCmp(configs);
     }
 }
Exemplo n.º 11
0
        private void BindGrid()
        {
            List <TheCancerProject.Core.Patient> patientList = new List <TheCancerProject.Core.Patient>();

            patientList = PatientDAO.RetrieveAll().ToList();
            //if (patient != null && patient.TheBiodata != null && !string.IsNullOrWhiteSpace(patient.TheBiodata.HospitalNumber))
            //{
            //    investigationHistoryForPatient = new InvestigationDAO().RetrieveByPatientHospitalNumber(patient.TheBiodata.HospitalNumber);
            //}
            GridView1.DataSource = patientList;
            GridView1.DataBind();
        }
Exemplo n.º 12
0
        public Patient SupprMedicamentAPatient(int IdPatient, int IdMedicament)
        {
            PatientDAO patientDAO = new PatientDAO();

            if (!patientDAO.IsPatient(IdPatient))
            {
                throw new PatientIncorrecteException("Ce compte n'est pas un compte Patient", patientDAO.VoirPatient(IdPatient));
            }
            Patient patient = new MedicamentDAO().SupprMedicamentDuPatient(IdMedicament, IdPatient);

            return(patient);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataSet dsPatient = new PatientDAO().getPatients();
         ddlPatient.DataSource     = dsPatient;
         ddlPatient.DataTextField  = "name";
         ddlPatient.DataValueField = "id";
         ddlPatient.DataBind();
         ddlPatient.Items.Insert(0, "Please select a patient");
         txtMedInfo.Visible = false;
     }
 }
Exemplo n.º 14
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try {
         Patient    patient = new Patient("", DateTime.Now, this.GetNom(), this.GetGender(), this.GetAge());
         PatientDAO ptdao   = new PatientDAO(connection);
         ptdao.Insert(patient);
         List <Config> cfs   = this.GetConfigs(patient);
         ConfigDAO     cfdao = new ConfigDAO(connection);
         cfdao.InsertAll(cfs);
         this.AddRowTabPatients(patient);
     } catch (Exception ex) {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 15
0
    public void Login()
    {
        GameObject input = GameObject.Find("Input ID Text");
        string     id    = input.GetComponent <Text>().text;

        patient   = PatientDAO.ConsultPatient(id);
        therapist = TherapistDAO.ConsultTherapist("123");

        if (patient != null && therapist != null)
        {
            therapySession = new TherapySession(therapist.Id_num, patient.Id_num);
            bool insertion = TherapySessionDAO.InsertTherapySession(therapySession);
        }
    }
Exemplo n.º 16
0
    public string QueryIdPatient()
    {
        PatientDAO patientDAO = new PatientDAO();

        Debug.Log(inputPatientId.text);
        int    idPatient    = patientDAO.GetIdPatient(inputPatientId.text);
        string idPatientStr = idPatient.ToString();

        if (idPatientStr != "0")
        {
            statePatient = true;
            Debug.Log(statePatient);
        }
        return(idPatientStr);
    }
        protected void btnAppointmentPatient_Click(object sender, EventArgs e)
        {
            ddlDoctor1.Visible        = false;
            ddlDate1.Visible          = false;
            ddlPatient1.Visible       = true;
            lblMessage.Text           = "";
            gvAppointments.DataSource = null;
            gvAppointments.DataBind();
            DataSet ds = new PatientDAO().getPatients();

            if (ds.Tables[0].Rows.Count > 0)
            {
                ddlPatient1.DataSource     = ds;
                ddlPatient1.DataTextField  = "Name";
                ddlPatient1.DataValueField = "ID";
                ddlPatient1.DataBind();
                ddlPatient1.Items.Insert(0, "Please select a patient");
            }
        }
        public UtilisateurWeb TelephoneLogin(string Token)
        {
            UtilisateurWeb utilisateurWeb = ServiceSecurite.GetTelephoneSecurite(Token); //teste du compte et du token basic. Si incorrecte passage en catch

            PatientDAO _PatientDAO = new PatientDAO();
            MedecinDAO _MedecinDAO = new MedecinDAO();

            if (_PatientDAO.IsPatient(utilisateurWeb.Identifiant))
            {
                return(Conversion(_PatientDAO.LoginTelephone(utilisateurWeb.Identifiant, utilisateurWeb.MotDePass, utilisateurWeb.TelephonePortable)));
            }
            else if (_MedecinDAO.IsMedecin(utilisateurWeb.Identifiant))
            {
                throw new TypeCompteException(utilisateurWeb, "Ce compte n'est pas celui d'un patient");
            }
            else
            {
                return(null);
            }
        }
        public UtilisateurWeb Login(string Token)
        {
            Compte compte = ServiceSecurite.GetCompteSecurite(Token); //teste du compte et du token basic. Si incorrecte passage en catch

            PatientDAO _PatientDAO = new PatientDAO();
            MedecinDAO _MedecinDAO = new MedecinDAO();

            if (_PatientDAO.IsPatient(compte.Identifiant))
            {
                return(Conversion(_PatientDAO.Login(compte.Identifiant, compte.MotDePass)));
            }
            else if (_MedecinDAO.IsMedecin(compte.Identifiant))
            {
                return(Conversion(_MedecinDAO.Login(compte.Identifiant, compte.MotDePass)));
            }
            else
            {
                return(null);
            }
        }
        public UtilisateurWeb TelephoneLoginToken(string Token)
        {
            UtilisateurWeb utilisateurWeb = ServiceSecurite.VerificationToken(Token);



            PatientDAO _PatientDAO = new PatientDAO();
            MedecinDAO _MedecinDAO = new MedecinDAO();

            if (_PatientDAO.IsPatient(utilisateurWeb.Identifiant))
            {
                return(Conversion(_PatientDAO.LoginTelephoneToken(utilisateurWeb.Identifiant)));
            }
            else if (_MedecinDAO.IsMedecin(utilisateurWeb.Identifiant))
            {
                throw new TypeCompteException(utilisateurWeb, "Ce compte n'est pas celui d'un patient");
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 21
0
        static void GetPatients()
        {
            Console.Clear();


            List <Patient> liste = new PatientDAO().ListAll();

            if (liste.Count > 0)
            {
                Console.WriteLine("------Liste des patients------");
                foreach (Patient p in liste)
                {
                    Console.WriteLine(p);
                    Console.WriteLine("----------------------------");
                }
            }
            else
            {
                Console.WriteLine("Aucun patient trouvé");
            }
            MenuPatient();
        }
Exemplo n.º 22
0
        public Patient AttributionMedecin(int IDpatient, int IDMedecin)
        {
            PatientDAO patientDAO = new PatientDAO();
            MedecinDAO medecinDAO = new MedecinDAO();

            if (!patientDAO.IsPatient(IDpatient))
            {
                throw new PatientIncorrecteException("Ce compte n'est pas un compte Patient", medecinDAO.VoirMedecin(IDMedecin));
            }
            if (!medecinDAO.IsMedecin(IDMedecin))
            {
                throw new MedecinIncorrecteException("Ce compte n'est pas un compte Medcin", medecinDAO.VoirMedecin(IDMedecin));
            }

            Patient patient = patientDAO.VoirPatient(IDpatient);

            if (patient.MesMedecin != null)
            {
                var resultat = patient.MesMedecin.FirstOrDefault(elt => elt.IDMedecin == IDMedecin);
                if (resultat != null)
                {
                    throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", patient);
                }

                //foreach (Medecin element in patient.MesMedecin)
                //{
                //    if (element.IDMedecin == IDMedecin)
                //    {
                //        patient.Erreur = "Le Médecin " + element.Nom + " " + element.Prenom + " fait déjà partit de vos médecin de référence";
                //        throw new DejaMedecinAttribueException("Il y a déjà un médecin attribué à ce Patient", element);
                //    }
                //}
                //return patient;
            }

            Medecin medecin = medecinDAO.VoirMedecinSimple(IDMedecin);

            return(patientDAO.AttributionMedecin(patient, medecin));
        }
Exemplo n.º 23
0
        static void InformationPatient()
        {
            Console.Clear();
            Console.WriteLine("identifiant du patient ?");
            int        idpatient = Int32.Parse(Console.ReadLine());
            Patient    patient   = new Patient();
            PatientDAO _dao      = new PatientDAO();

            patient = _dao.Retrieve(idpatient);
            //if (liste.Count > 0)
            //{
            //    Console.WriteLine("------Informations Patient------");
            //    foreach (Rendez_Vous r in liste)
            //    {
            //        Console.WriteLine(r);
            //        Console.WriteLine("----------------------------");
            //    }
            //}
            //else
            //{
            //    Console.WriteLine("Aucune information");
            //}
            MenuPatient();
        }
Exemplo n.º 24
0
        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);
                }
            }
        }
Exemplo n.º 25
0
        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)
        {
            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 Add_Click(object sender, EventArgs e)
    {
        string sex          = "";
        string marialStatus = "";
        string occupation   = "";
        string medInfo      = "";

        string name      = tbName.Text;
        string address   = tbAdress.Text;
        string contactNo = tbContactNo.Text;
        int    age       = Convert.ToInt32(tbAge.Text);

        if (ddlSex.SelectedIndex == 0)
        {
            sex = "Male";
        }
        else if (ddlSex.SelectedIndex == 1)
        {
            sex = "Female";
        }

        if (ddlMarialStatus.SelectedIndex == 0)
        {
            marialStatus = "Married";
        }
        else if (ddlMarialStatus.SelectedIndex == 1)
        {
            marialStatus = "Unmarried";
        }

        if (ddlOccupation.SelectedIndex == 0)
        {
            occupation = "Job";
        }
        else if (ddlOccupation.SelectedIndex == 1)
        {
            occupation = "Business";
        }
        else if (ddlOccupation.SelectedIndex == 2)
        {
            occupation = "Student";
        }
        else if (ddlOccupation.SelectedIndex == 3)
        {
            occupation = "Housewife";
        }
        else if (ddlOccupation.SelectedIndex == 4)
        {
            occupation = "Retired";
        }

        medInfo += ("Sensitivity To: " + tbSensitivityTo.Text + "\n");

        //checkBox

        if (cbBadCondition.Checked == true)
        {
            medInfo += "Bad Condition\n";
        }

        if (cbGumBleeds.Checked == true)
        {
            medInfo += "Gum Bleeding\n";
        }

        if (cbToothLoose.Checked == true)
        {
            medInfo += "Loose Tooth\n";
        }

        if (cbChestPain.Checked == true)
        {
            medInfo += "Chest Pain\n";
        }
        ;

        if (cbGumDisease.Checked == true)
        {
            medInfo += "Gum Disease\n";
        }

        if (cbBadBreath.Checked == true)
        {
            medInfo += "Bad Breath\n";
        }

        if (cbJawpain.Checked == true)
        {
            medInfo += "Jaw Pain\n";
        }

        if (cbBleedingTend.Checked == true)
        {
            medInfo += "Bleeding Tendency\n";
        }

        if (cbHepatitis.Checked == true)
        {
            medInfo += "Hepatitis\n";
        }

        if (cbHighBP.Checked == true)
        {
            medInfo += "High BP\n";
        }

        if (cbDiabetes.Checked == true)
        {
            medInfo += "Diabetes\n";
        }

        if (cbKidneyDisease.Checked == true)
        {
            medInfo += "Kidney Disease\n";
        }

        if (cbHeartTrouble.Checked == true)
        {
            medInfo += "Heart Trouble\n";
        }

        if (cbLiverDisease.Checked == true)
        {
            medInfo += "Liver Disease\n";
        }

        if (cbLungDisease.Checked == true)
        {
            medInfo += "Lung Disease\n";
        }

        if (cbAsthma.Checked == true)
        {
            medInfo += "Asthma\n";
        }

        if (cbRheumatic.Checked == true)
        {
            medInfo += "Rheumatic Fever\n";
        }

        if (cbAIDS.Checked == true)
        {
            medInfo += "AIDS\n";
        }

        if (cbAnemia.Checked == true)
        {
            medInfo += "Amenia\n";
        }

        if (tbAllergicTo.Text.Length > 0)
        {
            medInfo += "Allergic To: " + tbAllergicTo.Text + "\n";
        }
        if (tbPregnant.Text.Length > 0)
        {
            medInfo += "Pregnant of: " + tbPregnant.Text + "\n";
        }
        if (tbMedicine.Text.Length > 0)
        {
            medInfo += "Taking Medicine: " + tbMedicine.Text + "\n";
        }

        if (new PatientDAO().createPatient(new PatientDTO(name, address, contactNo, age, sex, marialStatus, occupation, medInfo)))
        {
            int id = new PatientDAO().getID(contactNo);
            MessageBox.Show("Your ID is " + id);
            Response.Redirect("Home.aspx");
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", "<script>alert('Error!!!');</script>");
        }
    }
        protected void Add_Click(object sender, EventArgs e)
        {
            string sex           = "";
            string maritalStatus = "";
            string occupation    = "";
            string medInfo       = "";
            string email         = "";
            string dob;

            string name      = tbName.Text;
            string address   = tbAdress.Text;
            string contactNo = tbContactNo.Text;
            int    age       = Convert.ToInt32(tbAge.Value);

            email = tbEmail.Text;
            dob   = Convert.ToDateTime(tbDOB.Value).ToString("yyyy/MM/dd");

            sex           = ddlSex.SelectedValue;
            maritalStatus = ddlMaritalStatus.SelectedValue;
            occupation    = ddlOccupation.SelectedValue;

            if (tbSensitivityTo.Text.Length > 0)
            {
                medInfo += ("Sensitivity To: " + tbSensitivityTo.Text + "\n");
            }
            if (tbAllergicTo.Text.Length > 0)
            {
                medInfo += "Allergic To: " + tbAllergicTo.Text + "\n";
            }
            if (tbMedicine.Text.Length > 0)
            {
                medInfo += "Taking Medicine: " + tbMedicine.Text + "\n";
            }

            //checkBox
            medInfo += "Other Medical Details:" + "\n";
            if (cbBadCondition.Checked == true)
            {
                medInfo += "Bad Condition\n";
            }

            if (cbGumBleeds.Checked == true)
            {
                medInfo += "Gum Bleeding\n";
            }

            if (cbToothLoose.Checked == true)
            {
                medInfo += "Loose Tooth\n";
            }

            if (cbChestPain.Checked == true)
            {
                medInfo += "Chest Pain\n";
            }
            ;

            if (cbGumDisease.Checked == true)
            {
                medInfo += "Gum Disease\n";
            }

            if (cbBadBreath.Checked == true)
            {
                medInfo += "Bad Breath\n";
            }

            if (cbJawpain.Checked == true)
            {
                medInfo += "Jaw Pain\n";
            }

            if (cbBleedingTend.Checked == true)
            {
                medInfo += "Bleeding Tendency\n";
            }

            if (cbHepatitis.Checked == true)
            {
                medInfo += "Hepatitis\n";
            }

            if (cbHighBP.Checked == true)
            {
                medInfo += "High BP\n";
            }

            if (cbDiabetes.Checked == true)
            {
                medInfo += "Diabetes\n";
            }

            if (cbKidneyDisease.Checked == true)
            {
                medInfo += "Kidney Disease\n";
            }

            if (cbHeartTrouble.Checked == true)
            {
                medInfo += "Heart Trouble\n";
            }

            if (cbLiverDisease.Checked == true)
            {
                medInfo += "Liver Disease\n";
            }

            if (cbLungDisease.Checked == true)
            {
                medInfo += "Lung Disease\n";
            }

            if (cbAsthma.Checked == true)
            {
                medInfo += "Asthma\n";
            }

            if (cbRheumatic.Checked == true)
            {
                medInfo += "Rheumatic Fever\n";
            }

            if (cbAIDS.Checked == true)
            {
                medInfo += "AIDS\n";
            }

            if (cbAnemia.Checked == true)
            {
                medInfo += "Amenia\n";
            }
            if (cbPregnant.Checked == true)
            {
                medInfo += "Pregnant\n";
            }

            if (new PatientDAO().createPatient(new PatientDTO(name, address, contactNo, age, sex, maritalStatus, occupation, medInfo, email, dob)))
            {
                int id = new PatientDAO().getID(email);
                lblMessage.Text      = "Patient with Id = " + id + " added";
                lblMessage.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessage.Text      = "Patient not added";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemplo n.º 29
0
        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);
                }
            }
        }
Exemplo n.º 30
0
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            PatientDAO dao = DAOFactory.CreatePatientDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }