Exemplo n.º 1
0
        /// <summary>
        /// Executes if the User is EDITING a note and chose to send an Email.
        /// </summary>
        private void SendEditEmail()
        {
            TrinityClassLibrary_BL.Medic   currentMedic   = (TrinityClassLibrary_BL.Medic)Session["CurrentMedic"];
            TrinityClassLibrary_BL.Patient currentPatient = (TrinityClassLibrary_BL.Patient)Session["Patient"];
            string server         = ConfigurationManager.AppSettings["EmailServer"].ToString();
            string emailSender    = currentMedic.EmailAddress.ToString();
            string emailRecipient = ConfigurationManager.AppSettings["MedicAppEmailRecipient"].ToString();

            StringBuilder emailBody  = new StringBuilder();
            MailMessage   mailMsg    = new MailMessage(emailSender, emailRecipient);
            SmtpClient    mailClient = new SmtpClient();

            mailClient.Host = server;

            string emailSubject = "On Call Note EDITED for Rig: " + Session["PatientInfo"].ToString();

            emailSubject = emailSubject.Replace(":", " -");

            mailMsg.Subject = emailSubject;
            emailBody.Append(Session["PatientInfo"].ToString() + "\n\n");
            emailBody.Append("Chief Complaint: " + currentPatient.ChiefComplaint + "\n\n");
            emailBody.Append("Physician Username: "******"\n\n");
            emailBody.Append("Note Entered: " + Convert.ToDateTime(DateTime.Now.ToShortDateString()) + "\n\n");
            emailBody.Append("Physician Note: " + Session["NoteToSave"].ToString() + "\n\n");
            emailBody.Append("This note may now be viewed both online and via the Trinity Medical Manager.\n\n");
            mailMsg.Body = emailBody.ToString();

            mailClient.Send(mailMsg);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Executes the following code if a User clicked the ADD NOTE button on the Notes page.
        /// </summary>
        protected void EditFalse()
        {
            string medicName = HttpContext.Current.User.Identity.Name.ToString();

            TrinityClassLibrary_BL.Medic currentMedic = MedicProvider.Fetch(medicName);

            // Gets the selected Patient from Session that was stored in the Patient page.
            TrinityClassLibrary_BL.Patient currentPatient = (TrinityClassLibrary_BL.Patient)Session["Patient"];

            TrinityClassLibrary_BL.Rig currentPatientRig = RigProvider.Fetch(Convert.ToInt32(currentPatient.RigID));

            // Stores the current Medic and Patients Rig to session for use in the Save/Email methods.
            Session["CurrentMedic"]      = currentMedic;
            Session["CurrentPatientRig"] = currentPatientRig;

            // Gets the current Medics security level.
            this.MedicSecurityLevelView( );

            // Calls IsNull to check the patient variables for nulls before placing into literal.
            ArrayList patientInfo = new ArrayList();

            this.IsNull(patientInfo);

            // Populates the Patient Info literal.
            this.litPatientInfo.Text = patientInfo[0].ToString() + ": " + patientInfo[1].ToString() + ", " + patientInfo[2].ToString() + " (" + patientInfo[3].ToString() + ")";

            // Stores PatientInfo to session for use in the Email method.
            Session["PatientInfo"] = this.litEditPatientInfo.Text;

            // Shows the Add form - Ensures Edit Form is hidden.
            this.pnlEditNote.Visible = false;
            this.pnlAddNote.Visible  = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Executes the following code if a User clicked on an Additonal Note to EDIT on the Notes page.
        /// </summary>
        protected void EditTrue()
        {
            string medicName = HttpContext.Current.User.Identity.Name.ToString();

            TrinityClassLibrary_BL.Medic currentMedic = MedicProvider.Fetch(medicName);
            AdditionalPatientNote        currentNote  = AdditionalPatientNoteProvider.Fetch(Convert.ToInt32(Session["NoteID"]));

            Session["CurrentNoteToSave"] = currentNote;

            // Gets the current Patient stored in Session from the Patient page.
            TrinityClassLibrary_BL.Patient currentPatient = (TrinityClassLibrary_BL.Patient)Session["Patient"];

            TrinityClassLibrary_BL.Rig currentPatientRig = RigProvider.Fetch(Convert.ToInt32(currentPatient.RigID));

            // Stores the current Medic and Patients Rig to session for use in the Save/Email methods.
            Session["CurrentMedic"]      = currentMedic;
            Session["CurrentPatientRig"] = currentPatientRig;

            // Gets the current Notes Security Level.
            this.NoteSecurityLevel(currentNote.SecurityLevel);

            // Populates textbox with the current note attached to Patient (if any).
            if (string.IsNullOrEmpty(currentNote.Notes))
            {
                this.txtAdminEditNote.Text = "";
            }
            else
            {
                this.txtAdminEditNote.Text = currentNote.Notes.ToString(); this.lblEditCharCount.Text = "Message Length: " + this.txtAdminEditNote.Text.Length.ToString();
            }

            // Calls IsNull to check the patient variables for nulls before placing into literal.
            ArrayList patientInfo = new ArrayList();

            this.IsNull(patientInfo);

            this.litEditPatientInfo.Text = patientInfo[0].ToString() + ": " + patientInfo[1].ToString() + ", " + patientInfo[2].ToString() + " (" + patientInfo[3].ToString() + ")";

            // Stores PatientInfo to session for use in the Email method.
            Session["PatientInfo"] = this.litEditPatientInfo.Text;

            // Shows the Edit Form - Ensures Add Form is hidden.
            this.pnlEditNote.Visible = true;
            this.pnlAddNote.Visible  = false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the EDITED note to the database and sends email if checked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSaveEdit_Click(object sender, EventArgs e)
        {
            // Gets selected Patient/current User from session and creates a new Note to be saved.
            TrinityClassLibrary_BL.Patient currentPatient = (TrinityClassLibrary_BL.Patient)Session["Patient"];
            TrinityClassLibrary_BL.Medic   currentMedic   = (TrinityClassLibrary_BL.Medic)Session["CurrentMedic"];
            AdditionalPatientNote          noteToSave     = (AdditionalPatientNote)Session["CurrentNoteToSave"];

            Session.Remove("CurrentNoteToSave");
            string note            = null;
            int    securityLevelID = 0;
            string errMsg          = null;

            // Sets current PatientID.
            noteToSave.PatientID = currentPatient.PatientID;

            // Ensures the textbox has a value before saving to the note.
            if (this.txtAdminEditNote.Text.Trim().Length > 0)
            {
                note = this.txtAdminEditNote.Text;
            }
            if (string.IsNullOrEmpty(note))
            {
                errMsg = "You must enter a note.";
            }
            else
            {
                noteToSave.Notes = note;
            }

            // Stores the note to session for use in the Email.
            Session["NoteToSave"] = note;

            // Checks to see which radio button is checked to set SecurityLevelID.
            if (this.rdoEditAdmin.Checked)
            {
                securityLevelID = (int)AdditionalPatientNote.SecurityLevels.AdminOnly;
            }
            if (this.rdoEditPhysicians.Checked)
            {
                securityLevelID = (int)AdditionalPatientNote.SecurityLevels.AdminAndPhysiciansOnly;
            }
            if (this.rdoEditAllUsers.Checked)
            {
                securityLevelID = (int)AdditionalPatientNote.SecurityLevels.AllUsers;
            }
            if (securityLevelID == 0)
            {
                errMsg += "/nYou must select a Security Level.";
            }
            else
            {
                noteToSave.SecurityLevelID = securityLevelID;
            }

            // Created by current users MedicID.
            noteToSave.CreatedByUserID = currentMedic.MedicID;

            // Sets created date to today.
            noteToSave.DateCreated = DateTime.Now;

            // The following are null and false since this is a new note.
            noteToSave.LastModifiedByUserID = null;
            noteToSave.DateLastModified     = null;
            noteToSave.Reviewed             = false;
            noteToSave.IsDeleted            = false;
            noteToSave.TempNoteID           = null; // TempID is not used by this App.

            if (string.IsNullOrEmpty(errMsg))
            {
                ClientScript.RegisterStartupScript(GetType(), "Close", "<script>var oWindow = null; if (window.radWindow) oWindow = window.radWindow; else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; oWindow.Close();oWindow.BrowserWindow.GetNotesPanel().AjaxRequest();</script>");

                // Saves note to the database.
                AdditionalPatientNoteProvider.Save(noteToSave);

                // Saves the encounter to the DB and sends an email(if checked).
                if (this.chkAdminEditEmail.Checked)
                {
                    this.SendEditEmail();

                    if (chkCustomerNotification.Checked)
                    {
                        SendCustomerEmail();
                    }
                    Response.Write("<script language='javascript'>alert('Your note has been saved and emailed.');</script>");
                }
                else
                {
                    Response.Write("<script language='javascript'>alert('Your note has been saved.');</script>");
                }

                // Removes the session variables that will no longer be needed after save.
                Session.Remove("CurrentMedic");
                Session.Remove("CurrentPatientRig");
                Session.Remove("PatientInfo");
                Session.Remove("NoteToSave");
            }
            else
            {
                Response.Write("<script language='javascript'>alert('" + errMsg + "');</script>");
            }
        }