protected void cboEmployer_SelectedIndexChanged(object sender, System.EventArgs e) { if (cboEmployer.SelectedIndex > 0) { //StringBuilder strSQL = new StringBuilder(); //if (AppMode) // clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]); //else // clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]); //strSQL.AppendFormat("SELECT EmployerPhone, EmployerPhoneExt, EmployerEmail, EmployerAddress, Cities.CityName, States.State, EmployerZip "); //strSQL.AppendFormat("FROM Employer INNER JOIN "); //strSQL.AppendFormat(" Cities ON Employer.EmployerCityID = Cities.CityID INNER JOIN "); //strSQL.AppendFormat(" States ON Cities.StateID = States.State "); //strSQL.AppendFormat("WHERE Employer.EmployerID = " + cboEmployer.SelectedValue + ";"); DataTool dbTool = new DataTool(); DataTable dtEmployer = dbTool.getEmployerInfo(Int32.Parse(cboEmployer.SelectedValue)); if (dtEmployer.Rows.Count > 0) { foreach (DataRow drEmployer in dtEmployer.Rows) { txtEmployerPhone.InnerText = Convert.ToString(drEmployer[0].ToString()); txtEmployerPhoneExt.InnerText = Convert.ToString(drEmployer[1].ToString()); txtEmployerEmail.InnerText = Convert.ToString(drEmployer[2].ToString()); txtEmployerAddress.InnerText = Convert.ToString(drEmployer[3].ToString()); txtEmployerCity.InnerText = Convert.ToString(drEmployer[4].ToString()); txtEmployerState.InnerText = Convert.ToString(drEmployer[5].ToString()); txtEmployerZip.InnerText = Convert.ToString(drEmployer[6].ToString()); } } //SqlDataReader rEmployerData = clsUtility.GetDataReader(strSQL.ToString()); //if(rEmployerData.HasRows) //{ // while(rEmployerData.Read()) // { // txtEmployerPhone.InnerText = Convert.ToString(rEmployerData[0]); // txtEmployerPhoneExt.InnerText = Convert.ToString(rEmployerData[1]); // txtEmployerEmail.InnerText = Convert.ToString(rEmployerData[2]); // txtEmployerAddress.InnerText = Convert.ToString(rEmployerData[3]); // txtEmployerCity.InnerText = Convert.ToString(rEmployerData[4]); // txtEmployerState.InnerText = Convert.ToString(rEmployerData[5]); // txtEmployerZip.InnerText = Convert.ToString(rEmployerData[6]); // } //} else { ClearEmployer(); } //rEmployerData.Close(); } else { ClearEmployer(); } }
public void dgMeds_Delete(object sender, DataGridCommandEventArgs e) { DataTool dbTool = new DataTool(); string SelectedRowID = dgMeds.DataKeys[e.Item.ItemIndex].ToString(); dbTool.deleteMedication(Int32.Parse(Session["PatientID"].ToString()), Int32.Parse(SelectedRowID)); //string strSQL = "DELETE FROM PatientMedication WHERE MedicationID = " + SelectedRowID + " AND PatientID = " + Session["PatientID"] + ";"; //clsUtility.ExecuteSQL(strSQL); // refresh the lists setupGrid(); } //Done... Tested
private void initTable_BL() { DataTool dbTool = new DataTool(); DataTable dtAllergy = dbTool.getAllergy(Int32.Parse(Session["PatientID"].ToString())); int rCnt = dtAllergy.Rows.Count; for (int j = 0; j < rCnt; j++) { TableRow r = new TableRow(); for (int i = 0; i < 4; i++) { if (j == rCnt) { break; } DataRow drAllergy = dtAllergy.Rows[j]; TableCell c = new TableCell(); if (c.HasControls()) { c.Controls.Clear(); } HtmlInputCheckBox chk = new HtmlInputCheckBox(); chk.Value = drAllergy["AllergyID"].ToString(); chk.ID = "chkAllergy" + drAllergy["AllergyID"].ToString(); if (Session["mode"] != null) { if (Session["mode"].ToString() == "view") { chk.Disabled = true; } if (!Convert.IsDBNull(drAllergy["PAllergy"])) { chk.Checked = true; } else { chk.Checked = false; } } c.Controls.Add(chk); c.Width = System.Web.UI.WebControls.Unit.Percentage(25); c.Controls.Add(new LiteralControl(" " + drAllergy["AllergyName"].ToString())); r.Cells.Add(c); j++; } tblAll.Rows.Add(r); } }
private void setupGrid() { DataTool dbTool = new DataTool(); DataTable dtMedications = dbTool.getMedications(Int32.Parse(Session["PatientID"].ToString())); initGrid_BL(dgMeds, dtMedications, "MedicationID"); //List<Medications> lMedications = new List<Medications>(); //SQLMedications sqlMedication = new SQLMedications(); //dgMeds.DataSource = sqlMedication.getAllMedications(Int32.Parse(Session["PatientID"].ToString())); //dgMeds.DataBind(); DataTable dtVitals = dbTool.getVitals(Int32.Parse(Session["PatientID"].ToString())); initGrid_BL(dgVitals, dtVitals, "VitalSignID"); }
} //Done... Tested #endregion #region dgVitals_Delete(object sender, DataGridCommandEventArgs e) public void dgVitals_Delete(object sender, DataGridCommandEventArgs e) { DataTool dbTool = new DataTool(); string SelectedRowID = dgVitals.DataKeys[e.Item.ItemIndex].ToString(); //Response.Write("<script>alert('" + SelectedRowID + "');</script>"); dbTool.deleteVitals(Int32.Parse(Session["PatientID"].ToString()), Int32.Parse(SelectedRowID.ToString())); //string strSQL = "DELETE FROM PatientVitalSigns WHERE VitalSignID = " + SelectedRowID + " AND PatientID = " + Session["PatientID"] + ";"; //clsUtility.ExecuteSQL(strSQL); // refresh the lists setupGrid(); } //Done... Tested
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); DataTool dbTool = new DataTool(); Page.Focus(); DataTable dtRigs = dbTool.getRigIDs(); DataTable dtEmployers = dbTool.getEmpolyerIDs(); DataTable dtCompanies = dbTool.getCompanyIDs(); initDropDown_BL(cboRigID, dtRigs, 1); initDropDown_BL(cboEmployer, dtEmployers, 1); initDropDown_BL(cboDrillFor, dtCompanies, 1); initDropDown_BL(cboMedic, dbTool.getAllMedics(), 1); }
} // Done... Tested... private void cboCity_SelectedIndexChanged(object sender, System.EventArgs e) { //if (AppMode) // clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]); //else // clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]); //string strSQL = "SELECT State as Abbrev, State FROM States INNER JOIN Cities ON States.State = Cities.StateID WHERE Cities.CityID = '" + txtCity.Text + "';"; //SqlDataReader rState = clsUtility.GetDataReader(strSQL); DataTool dbTool = new DataTool(); DataTable dtState = dbTool.getStateAbbrev(Int32.Parse(txtCity.Text)); // select the correct state if (dtState.Rows.Count > 0) { txtState.Text = dtState.Rows[0]["Abbrev"].ToString(); } }
private int saveData_BL() { int recCnt = 0; // number of records affected DataTool dbTool = new DataTool(); TrinityBLO.MedicalInfo mInfo = (TrinityBLO.MedicalInfo)Session["NewMedical"]; dbTool.updateMedicalRecord(mInfo); Session.Remove("NewMedical"); // whether or not field is a checkbox, -1 means no // create the update portion of the sql statement foreach (string strFieldObj in Request.Form) { if (strFieldObj.IndexOf("chkAllergy") != -1) { // need to create the new values for the sql string that will update the Patient Allergy table dbTool.newAllergy(Int32.Parse(Request.Form[strFieldObj].ToString())); } } return(recCnt); } //Tested and working
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); rdpEncounterEndDate.DateInput.Attributes.Add("onclick", "TogglePopup('" + rdpEncounterEndDate.ClientID + "')"); rdpEncounterStartDate.DateInput.Attributes.Add("onclick", "TogglePopup('" + rdpEncounterStartDate.ClientID + "')"); Int32 uTypeID = 0; using (TMMModel.TMM_DEPLOYEntities oEntities = new TMMModel.TMM_DEPLOYEntities()) { uTypeID = (from u_i in oEntities.UserInfo where u_i.UserSecurity.Username == User.Identity.Name select u_i.UserType.ID).First(); } //if the usertype is not customer, redirect the user. if (uTypeID != Convert.ToInt32(TMMModel.UserType.Types.Customer)) { Response.Redirect("/Login.aspx"); } DataTool dbTool = new DataTool(); //Page.Focus(); DataTable dtRigs = dbTool.getRigIDs(); if (!Page.IsPostBack) { this.rdpEncounterEndDate.SelectedDate = DateTime.Now.Date; this.rdpEncounterStartDate.SelectedDate = DateTime.Now.Date.AddDays(-30); //Load the drop down list. initDropDown_BL(ddlWorksites, dtRigs, 1); this.rgEncounterResults.Rebind(); } }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); Session["SearchComplete"] = true; if (Session["mode"] == null) { if (Session["PatientID"] == null) { Response.Redirect("SessionTimedOut.aspx"); } } if (!IsPostBack) { LoadTips(); // Get the patient information from session. TrinityClassLibrary_BL.Patient patient = (TrinityClassLibrary_BL.Patient)Session["Patient"]; // Get the patient's rig information from session. TrinityClassLibrary_BL.Rig rig = null; if (patient.RigID.HasValue) { rig = (TrinityClassLibrary_BL.Rig)Session["PatientRig"]; } // Display the patient information to the screen. if (rig != null) { litPatientData.Text = rig.Name + ": "; } litPatientData.Text += patient.LastName + ", " + patient.FirstName + " (" + Convert.ToDateTime(patient.EncounterDate).ToShortDateString() + ")"; // Get all medic records from data. List <TrinityClassLibrary_BL.Medic> allMedics = TrinityClassLibrary_DAL.MedicProvider.FetchList(); // Get all notes for this encounter that are not marked as deleted. List <TrinityClassLibrary_BL.AdditionalPatientNote> notes = TrinityClassLibrary_DAL.AdditionalPatientNoteProvider.FetchList(patient.PatientID, false); // Get the user's medic information. TrinityClassLibrary_BL.Medic currentUser = allMedics.Find(delegate(TrinityClassLibrary_BL.Medic currentMedic) { if (currentMedic.MedicID == Convert.ToInt32(Session["MedicPK"])) { return(true); } return(false); }); //ViewState["CurrentMedicSecurity"] = currentUser.SecurityLevel.Value.ToString(); // Filters out notes the user does not have rights to view. notes = FilterNotes(notes, currentUser); // Displays the additional notes at the bottom of the screen. DisplayNotes(allMedics, notes, currentUser); } //DataUtility clsData = new DataUtility(); //StringBuilder strSQL = new StringBuilder(); if (Session["mode"] != null) { if (Session["mode"].ToString() == "view") { btnContinue.Visible = false; btnReset.Visible = false; DataTool dbTool = new DataTool(); DataTable dtPatientNotes = dbTool.getPatientNotes(Session["PatientID"].ToString()); // add the javascript onload event that will initialize the span tables bodyMain.Attributes.Add("onLoad", "initSpan()"); // disable the input boxes and show the data from the database enterData(); //clsData.doIncompletes(strSQL.ToString(), Page); //Filling Spans with datatable if (dtPatientNotes.Rows.Count > 0) { if (dtPatientNotes.Rows[0][1] != null) { txtImpressionNotes.Text = dtPatientNotes.Rows[0][1].ToString(); } if (dtPatientNotes.Rows[0][3] != null) { txtInstructionNotes.Text = dtPatientNotes.Rows[0][3].ToString(); } if (dtPatientNotes.Rows[0][0] != null) { txtPhysicalNotes.Text = dtPatientNotes.Rows[0][0].ToString(); } if (dtPatientNotes.Rows[0][2] != null) { txtRecommendationNotes.Text = dtPatientNotes.Rows[0][2].ToString(); } if (dtPatientNotes.Rows[0][1] != null) { spantxtImpressionNotes.InnerHtml = dtPatientNotes.Rows[0][1].ToString(); } if (dtPatientNotes.Rows[0][3] != null) { spantxtInstructionNotes.InnerHtml = dtPatientNotes.Rows[0][3].ToString(); } if (dtPatientNotes.Rows[0][0] != null) { spantxtPhysicalNotes.InnerHtml = dtPatientNotes.Rows[0][0].ToString(); } if (dtPatientNotes.Rows[0][2] != null) { spantxtRecommendationNotes.InnerHtml = dtPatientNotes.Rows[0][2].ToString(); } } // Set the visibility of the header panels. pnlAddEditHeader.Visible = false; pnlViewHeader.Visible = true; } else if (Session["mode"].ToString() == "edit") { DataTool dbTool = new DataTool(); DataTable dtPatientNotes = dbTool.getPatientNotes(Session["PatientID"].ToString()); if (!Page.IsPostBack) { if (dtPatientNotes.Rows.Count > 0) { //Filling Textboxes with datatable txtImpressionNotes.Text = dtPatientNotes.Rows[0][1].ToString(); txtInstructionNotes.Text = dtPatientNotes.Rows[0][3].ToString(); txtPhysicalNotes.Text = dtPatientNotes.Rows[0][0].ToString(); txtRecommendationNotes.Text = dtPatientNotes.Rows[0][2].ToString(); spantxtImpressionNotes.InnerHtml = dtPatientNotes.Rows[0][1].ToString(); spantxtInstructionNotes.InnerHtml = dtPatientNotes.Rows[0][3].ToString(); spantxtPhysicalNotes.InnerHtml = dtPatientNotes.Rows[0][0].ToString(); spantxtRecommendationNotes.InnerHtml = dtPatientNotes.Rows[0][2].ToString(); } } // enter the data into the fields // Set the visibility of the header panels. pnlAddEditHeader.Visible = true; pnlViewHeader.Visible = false; } else { } ShowHideEditButtons(); } } // Done... Tested
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); EncodeControls(); // check if the query string has any values, if so set the session variables accordingly if (cboIncomplete.SelectedValue.Length < 1 && Convert.ToBoolean(Request.QueryString.Count)) { if (Request.QueryString["pKey"] != null) { Session["PatientID"] = Request.QueryString["pKey"].ToString(); } if (Request.QueryString["mode"] != null) { Session["mode"] = Request.QueryString["mode"].ToString(); } } // on change event to the birthdate field to calculate the age txtBirthdate.Attributes.Add("onBlur", "calcAge(this.form.elements['txtBirthdate'].value);"); lblSSN.ToolTip = "Social Security #: 123-45-6789\nPassport #: 12345678"; txtSSN.ToolTip = "Social Security #: 123-45-6789\nPassport #: 12345678"; // get the authenticated username and put it in a session variable User authUser = new User(HttpContext.Current.User.Identity.Name); string tmpUser = authUser.ReturnUser(); if (!IsPostBack) { DataTool dbTool = new DataTool(); DataTable medicInfo = dbTool.getMedicInfo(tmpUser); if (medicInfo.Rows.Count > 0) { Session["MedicID"] = medicInfo.Rows[0]["UserName"].ToString(); // Storing the Medic's ID here to fix the search page // Lancelot 7/7/04 Session["MedicPK"] = medicInfo.Rows[0]["MedicID"].ToString(); // 7/23/2004 Scott // if the medic is in the table, but is not assigned to a rig they are considered an admin user // this user can see encounters for all rigs if (Convert.IsDBNull(medicInfo.Rows[0]["RigID"])) { Session["RigID"] = "0"; } else { Session["RigID"] = medicInfo.Rows[0]["RigID"].ToString(); } //Logging program use to IntranetLog //Latham 05/20/2005 dbTool.LogUse(System.Convert.ToInt32(Session["MedicPK"]), 5); DataTable dtIncompletes = new DataTable(); // incomplete sql, if the user has a 0 for their rigid then they can see all encounters if (Session["RigID"].ToString() == "0") { dtIncompletes = dbTool.getAllIncomplete(); } else { dtIncompletes = dbTool.getRigIncomplete(Session["MedicPK"].ToString()); } // load the drop downlists DataTable dtRigs = dbTool.getRigIDs(); DataTable dtEmployers = dbTool.getEmpolyerIDs(); DataTable dtCompanies = dbTool.getCompanyIDs(); DataTable dtRigIDs = new DataTable(); initDropDown_BL(cboIncomplete, dtIncompletes, 1); initDropDown_BL(cboRigID, dtRigs, 1); initDropDown_BL(cboEmployer, dtEmployers, 1); initDropDown_BL(cboDrillFor, dtCompanies, 1); // if there are no incomplete encounters for this rig then do not show this section if (cboIncomplete.Items.Count < 2) { spIncomplete.Visible = false; } // hide the edit button btnEdit.Visible = false; if (Session["mode"] != null && Session["mode"].ToString() == "view") { // if there is no patient key in the querystring then set the form to add mode if (Request.QueryString["pKey"] != null) { // add the javascript initSpan function to the onload of the body bodyMain.Attributes.Add("onLoad", "initSpan()"); // disable the input boxes and show the data from the database enterData(); LoadData(Convert.ToInt32(Request.QueryString["pKey"]), true); // disable the asp.net button btnReset.Visible = false; btnContinue.Visible = false; btnEdit.Visible = true; btnEdit.Attributes.Add("onClick", "location.href='Medical.aspx';"); } } // Shortcut because Lance is a lazy bastard and hates typing all this // crap out every time. if (Environment.MachineName == "HTX5Y21") { FillOutControls(); } } else { // redirect to custom error page and send a parameter user=unauthorized // display a custom error telling them they have to be assigned to a rig to enter the application Response.Redirect("CustError.aspx?user=unauthorized"); } } if (System.Convert.ToBoolean(Session["SearchComplete"]) == true) { if (Session["mode"] != null && Session["mode"].ToString() == "view") { // if there is no patient key in the querystring then set the form to add mode if (Session["PatientID"] != null) { // add the javascript initSpan function to the onload of the body bodyMain.Attributes.Add("onLoad", "initSpan()"); // disable the input boxes and show the data from the database enterData(); SQLPatient sqlPatient = new SQLPatient(); DataTool dbTool = new DataTool(); DataTable dT = dbTool.getPatientInfo(Int32.Parse(Session["PatientID"].ToString())); Patients Patient = new Patients(); sqlPatient.LoadObject(Patient, dT); LoadControls_BL(Patient); // disable the asp.net button btnReset.Visible = false; btnContinue.Visible = false; btnEdit.Visible = true; btnEdit.Attributes.Add("onClick", "location.href='Medical.aspx';"); } } } Session["SearchComplete"] = false; }
protected override void Page_Load(object sender, System.EventArgs e) { base.Page_Load(sender, e); Session["SearchComplete"] = true; // make sure the session is valid if (Session["MedicPK"] == null) { Response.Redirect("SessionTimedOut.aspx"); } if (!IsPostBack) { DataUtility clsData = new DataUtility(); DataTool dbTool = new DataTool(); LoadTips(); btnMedAdd.Attributes.Add("onClick", "btnMedAdd_click"); cboMedic.Items.Add(new ListItem("[Select]", "-1")); foreach (TMMModel.UserInfo ui in GetAllMedics()) { cboMedic.Items.Add(new ListItem(ui.LastName + ", " + ui.FirstName, ui.ID.ToString())); } //Fills in Medication and VitalSigns Table setupGrid(); // Get the patient information from data. // We are getting the session and rig information from data again because the save may have been for a new patient record // and if so the patient in session will be incorrect because it does not contain the correct primary key. This can be // corrected later if this application is every moved to using a single method of data access. TrinityClassLibrary_BL.Patient patient = TrinityClassLibrary_DAL.PatientProvider.Fetch(Convert.ToInt32(Session["PatientID"])); Session.Remove("efPatient"); // Get the patient's rig information from data. TrinityClassLibrary_BL.Rig rig = null; if (patient.RigID.HasValue) { rig = TrinityClassLibrary_DAL.RigProvider.Fetch(patient.RigID.Value); } Session["PatientRig"] = rig; // Display the patient information to the screen. if (rig != null) { litPatientData.Text = rig.Name + ": "; } litPatientData.Text += patient.LastName + ", " + patient.FirstName + " (" + Convert.ToDateTime(patient.EncounterDate).ToShortDateString() + ")"; if (Session["mode"] != null) { if (Session["mode"].ToString() == "view") { btnReset.Visible = false; btnContinue.Visible = false; bodyMain.Attributes.Add("onLoad", "initSpan()"); enterData(); SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo(); MedicalInfo mInfo = new MedicalInfo(); sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo); clsData.doIncompletes_BL(mInfo, Page); pnlAddEditHeader.Visible = false; pnlViewHeader.Visible = true; pnlMeds.Visible = false; pnlVitals.Visible = false; } else if (Session["mode"].ToString() == "edit") { SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo(); MedicalInfo mInfo = new MedicalInfo(); sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo); clsData.doIncompletes_BL(mInfo, Page); pnlAddEditHeader.Visible = true; pnlViewHeader.Visible = false; pnlMeds.Visible = true; pnlVitals.Visible = true; } } else { btnMedAdd.Attributes.Add("onClick", "btnMedAdd_click"); //initDropDown_BL(cboMedic, dbTool.getAllMedics(), 1); setupGrid(); SQLMedicalInfo sqlMedicalInfo = new SQLMedicalInfo(); MedicalInfo mInfo = new MedicalInfo(); sqlMedicalInfo.getMedicalInfo(Int32.Parse(Session["PatientID"].ToString()), mInfo); clsData.doIncompletes_BL(mInfo, Page); pnlMeds.Visible = true; pnlVitals.Visible = true; } } //Build Allergy Table initTable_BL(); //Fills in Medication and VitalSigns Table // Shortcut because Lance is a lazy bastard and hates typing all this // crap out every time. if (Environment.MachineName == "HTX5Y21") { FillOutControls(); } }