Esempio n. 1
0
        // Checks to see if the appointment data in session is in the database
        private string GetAppointmentDateString(string mrn, string physician, DateTime clinicDate)
        {
            string cmdText = "SELECT * FROM Appointments WHERE ApptMRN = @ApptMRN And ApptPhysician = @ApptPhysician And ApptClinicDate = @ApptClinicDate";

            SqlCommand cmd = DataAccessHelper.CreateCommand(cmdText);

            cmd.CommandType = CommandType.Text;

            cmd.Parameters.Add("@ApptMRN", mrn);
            cmd.Parameters.Add("@ApptPhysician", physician);
            cmd.Parameters.Add("@ApptClinicDate", clinicDate);

            DataTable table = new DataTable();

            DataAccessHelper.GetList(cmd, table);

            if (table.Rows.Count > 0)
            {
                DataRow row = table.Rows[0];

                return(clinicDate.ToShortDateString());
            }

            return(null);
        }
Esempio n. 2
0
        // sometimes occures in a transaction with insertion of new patient record
        public void InsertAppointmentRecord(Hashtable appointmentArgs, int patientId, SqlTransaction trans)
        {
            // add our appointment stuff here
            SqlCommand apptcmd = DataAccessHelper.CreateCommand(APPT_SQL, trans);             // use the transaction from above, somehow

            apptcmd.CommandType = CommandType.Text;
            DataAccessHelper.AddIntInputParam(apptcmd, "ApptPatientId", patientId);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptFirstName", (string)appointmentArgs["ApptFirstName"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptLastName", (string)appointmentArgs["ApptLastName"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptMRN", (string)appointmentArgs["ApptMRN"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptPhysician", (string)appointmentArgs["ApptPhysician"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptVisitType", (string)appointmentArgs["ApptVisitType"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptDept", (string)appointmentArgs["ApptDept"]);
            DataAccessHelper.AddStringInputParam(apptcmd, "ApptNotes", (string)appointmentArgs["ApptNotes"]);
            DataAccessHelper.AddDateTimeInputParam(apptcmd, "ApptClinicDate", (DateTime)appointmentArgs["ApptClinicDate"]);
            DataAccessHelper.AddDateTimeInputParam(apptcmd, "ApptTime", (DateTime)appointmentArgs["ApptTime"]);

            SecurityController sc       = new SecurityController();
            string             username = sc.GetUserName();
            DateTime           now      = DateTime.Now;

            DataAccessHelper.AddStringInputParam(apptcmd, "EnteredBy", username);
            DataAccessHelper.AddDateTimeInputParam(apptcmd, "EnteredTime", now);
            DataAccessHelper.AddStringInputParam(apptcmd, "UpdatedBy", username);
            DataAccessHelper.AddDateTimeInputParam(apptcmd, "UpdatedTime", now);

            apptcmd.ExecuteNonQuery();
        }
Esempio n. 3
0
        // Checks to see if the appointment data in session is in the database
        private void AddClinStageDate(string mrn, string physician, DateTime clinicDate)
        {
            string cmdText = "SELECT * FROM Appointments WHERE ApptMRN = @ApptMRN And ApptPhysician = @ApptPhysician And ApptClinicDate = @ApptClinicDate";

            SqlCommand cmd = DataAccessHelper.CreateCommand(cmdText);

            cmd.CommandType = CommandType.Text;

            cmd.Parameters.Add("@ApptMRN", mrn);
            cmd.Parameters.Add("@ApptPhysician", physician);
            cmd.Parameters.Add("@ApptClinicDate", clinicDate);

            DataTable table = new DataTable();

            DataAccessHelper.GetList(cmd, table);

            if (table.Rows.Count > 0)
            {
                DataRow row = table.Rows[0];

                string clinicDateString = clinicDate.ToShortDateString();
                ClinStageDateText.Value = clinicDateString;
                ClinStageDate.Value     = clinicDateString;
                // re-disable ClinStageDate
                ClinStageDate.Disabled = true;
            }
        }
Esempio n. 4
0
        override protected void BuildFamilyHistory()
        {
            if (patientID != 0)
            {
                // Family History
                SqlCommand familyHistoryCom = DataAccessHelper.CreateCommand("spFormListFamilyMemberDiagnosis");
                DataAccessHelper.AddIntInputParam(familyHistoryCom, "patientID", this.patientID);
                DataAccessHelper.AddStringInputParam(familyHistoryCom, "formName", "URONV");
                DataAccessHelper.AddStringInputParam(familyHistoryCom, "formType", "dynamic");

                DataSet familyHistoryDs = DataAccessHelper.GetList(familyHistoryCom);


                if (familyHistoryDs.Tables[0].Rows.Count == 0)
                {
                    DataRow blankFamHistoryRow;
                    blankFamHistoryRow = familyHistoryDs.Tables[0].NewRow();
                    blankFamHistoryRow["FamMemRelation"] = "<br><br><img src=\"../images/shim.gif\" border=\"0\" width=\"12\" height=\"1\">- Cancer:<br><br><br><br><br><img src=\"../images/shim.gif\" border=\"0\" width=\"12\" height=\"1\">- Other:";
                    familyHistoryDs.Tables[0].Rows.Add(blankFamHistoryRow);
                }

                if (familyHistoryDs.Tables[0].Rows.Count > 0)
                {
                    FamilyHistoryFiller.Visible = false;
                    familyHistory.DataSource    = familyHistoryDs.Tables[0].DefaultView;
                    familyHistory.DataBind();
                }
            }
        }
Esempio n. 5
0
        protected void btnHelpSectionSave_Click(object sender, EventArgs e)
        {
            string sid         = lblHelpSectionId.Text;
            string name        = txtHelpSectionName.Text;
            string description = txtHelpSectionDescription.Text;
            int    id;

            if (sid == "New")
            {
                SqlCommand cmd1 = DataAccessHelper.CreateCommand(INSERT_SQL);
                cmd1.CommandType = CommandType.Text;

                AddParameterWithNullCheck(cmd1, "@HelpSectionName", name);
                AddParameterWithNullCheck(cmd1, "@HelpSectionDescription", description);

                DataSet ds = DataAccessHelper.GetList(cmd1);
                id = int.Parse(ds.Tables[0].Rows[0][0].ToString());
            }
            else
            {
                id = Int32.Parse(sid);

                SqlCommand cmd = DataAccessHelper.CreateCommand(UPDATE_SQL);
                cmd.CommandType = CommandType.Text;

                AddParameterWithNullCheck(cmd, "@HelpSectionId", id);
                AddParameterWithNullCheck(cmd, "@HelpSectionName", name);
                AddParameterWithNullCheck(cmd, "@HelpSectionDescription", description);

                DataAccessHelper.ExecuteScalar(cmd);
            }
            PopulateSectionList();
            displayInfo(id);
        }
Esempio n. 6
0
        public static DataSet GetChronoListStatusEntries(int patientId)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spChronoListStatus");

            DataAccessHelper.AddIntInputParam(com, "PatientId", patientId);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Esempio n. 7
0
        public static DataSet GetFirstRadiationTherapy(int patientId)
        {
            // SqlCommand com = DataAccessHelper.CreateCommand("spGetRadiationTherapyFirst");
            SqlCommand com = DataAccessHelper.CreateCommand("spPluginPSAGraphGetRadiationTherapyFirst");

            DataAccessHelper.AddIntInputParam(com, "PatientId", patientId);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Esempio n. 8
0
        /*
         * public static bool areSprocsInstalled()
         * {
         * try
         * {
         * //              SqlCommand com = DataAccessHelper.CreateCommand("if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[spGetBiopsiesFlash]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) SELECT 'true' ELSE Select 'false'");
         * //              return (bool)com.ExecuteScalar();
         * return true;
         * }
         * catch ( SqlException e)
         * {
         * throw new Exception("Could not create the stored procedures necessary for the PSA Graph. Please contact your System Administrator or DBA",e);
         * }
         * }
         *
         * public static void installSprocs(string createSprocsSql)
         * {
         * SqlCommand com = DataAccessHelper.CreateCommand(createSprocsSql);
         * com.ExecuteNonQuery();
         * }
         */


        public static DataSet GetAllBiopsiesFlash(int patientId)
        {
            //SqlCommand com = DataAccessHelper.CreateCommand("spGetBiopsiesFlash");
            SqlCommand com = DataAccessHelper.CreateCommand("spPluginPSAGraphGetBiopsiesFlash");

            DataAccessHelper.AddIntInputParam(com, "PatientId", patientId);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Esempio n. 9
0
        public static string GetPtFullName(int PatientId)
        {
            // SqlCommand com = DataAccessHelper.CreateCommand("spGetPtFullName");
            SqlCommand com = DataAccessHelper.CreateCommand("spGetPatientsRecord");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds.Tables[0].Rows[0]["PtFirstName"].ToString() + " " + ds.Tables[0].Rows[0]["PtMiddleName"].ToString() + " " + ds.Tables[0].Rows[0]["PtLastName"].ToString());
        }
Esempio n. 10
0
        public static DataSet GetAllPSAs(int PatientId)
        {
            // SqlCommand com = DataAccessHelper.CreateCommand("spGetLabTestAllPSAs");
            SqlCommand com = DataAccessHelper.CreateCommand("spPluginPSAGraphGetLabTestAllPSAs");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Esempio n. 11
0
        public static Hashtable GetProstSurgeryRecord(int PatientId)
        {
            SqlCommand com = DataAccessHelper.CreateCommand("spFormGetProcProstatectomyDate");

            DataAccessHelper.AddIntInputParam(com, "PatientId", PatientId);
            DataAccessHelper.AddStringOutputParam(com, "RP_Date");

            Hashtable ht = DataAccessHelper.ExecuteScalar(com);

            return(ht);
        }
Esempio n. 12
0
        public static DataSet GetPSADTVelocity(int patientId, DateTime startDt, DateTime endDt, string PSAThreshold)
        {
            //SqlCommand com = DataAccessHelper.CreateCommand("spGetPSADTVelocity");
            SqlCommand com = DataAccessHelper.CreateCommand("spPluginPSAGraphGetPSADTVelocity");

            DataAccessHelper.AddIntInputParam(com, "PatientId", patientId);
            DataAccessHelper.AddDateTimeInputParam(com, "StartDT", startDt);
            DataAccessHelper.AddDateTimeInputParam(com, "EndDT", endDt);
            DataAccessHelper.AddStringInputParam(com, "PSAThreshold", PSAThreshold);
            DataSet ds = DataAccessHelper.GetList(com);

            return(ds);
        }
Esempio n. 13
0
        protected void btnHelpSectionDelete_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = null;

            cmd             = DataAccessHelper.CreateCommand(DELETE_SQL);
            cmd.CommandType = CommandType.Text;
            string id = lblHelpSectionId.Text;

            AddParameterWithNullCheck(cmd, "@HelpSectionId", Int32.Parse(id));

            DataAccessHelper.ExecuteScalar(cmd);
            PopulateSectionList();
            setViewMode("start");
        }
Esempio n. 14
0
        override protected void BuildSocialHistory()
        {
            if (patientID != 0)
            {
                // Social History
                SqlCommand socialHistoryCom = DataAccessHelper.CreateCommand("spFormGetSocialHistoriesRecord");
                DataAccessHelper.AddIntInputParam(socialHistoryCom, "patientID", this.patientID);
                DataAccessHelper.AddStringInputParam(socialHistoryCom, "formName", "URONV");
                DataAccessHelper.AddStringInputParam(socialHistoryCom, "formType", "dynamic");

                DataSet socialHistoryDs = DataAccessHelper.GetList(socialHistoryCom);
                if (!socialHistoryDs.Tables.Count.Equals(0) && !socialHistoryDs.Tables[0].Rows.Count.Equals(0))
                {
                    socHxOccupation.Text    = socialHistoryDs.Tables[0].Rows[0]["SocHxOccupation"].ToString();
                    socHxMaritalStatus.Text = socialHistoryDs.Tables[0].Rows[0]["SocHxMaritalStatus"].ToString();
                    socHxChildren.Text      = socialHistoryDs.Tables[0].Rows[0]["SocHxChildren"].ToString();


                    //					socHxTobaccoType.Text = socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoType"].ToString();



                    if (socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoPacksPerDay"] != null && socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoPacksPerDay"].ToString() != "")
                    {
                        socHxTobaccoPacksPerDay.Text            = socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoPacksPerDay"].ToString();
                        socHxTobaccoPacksPerDayCheckBox.Checked = true;
                    }
                    if (socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoYears"] != null && socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoYears"].ToString() != "")
                    {
                        socHxTobaccoPacksPerDayCheckBox.Checked = true;
                        socHxTobaccoYears.Text = socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoYears"].ToString();
                    }



                    if (socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoQuitYear"] != null && socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoQuitYear"].ToString() != "")
                    {
                        socHxTobaccoQuitYearCheckbox.Checked = true;
                        socHxTobaccoQuitYear.Text            = socialHistoryDs.Tables[0].Rows[0]["SocHxTobaccoQuitYear"].ToString();
                    }
                    socHxCarcinogen.Text = socialHistoryDs.Tables[0].Rows[0]["SocHxCarcinogen"].ToString();

                    if (socialHistoryDs.Tables[0].Rows[0]["SocHxAlcohol"] != null && socialHistoryDs.Tables[0].Rows[0]["SocHxAlcohol"].ToString().Length > 0)
                    {
                        socHxAlcohol.Text = socialHistoryDs.Tables[0].Rows[0]["SocHxAlcohol"].ToString();
                    }
                }
            }
        }
Esempio n. 15
0
        private DataTable GetDataTable(string sql)
        {
            SqlCommand cmd   = null;
            DataTable  table = null;

            try
            {
                cmd             = DataAccessHelper.CreateCommand(sql);
                cmd.CommandType = CommandType.Text;
                DataSet ds = DataAccessHelper.GetList(cmd);
                table = ds.Tables[0];
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(table);
        }
Esempio n. 16
0
        private DataTable GetHelpSectionDetails(int id)
        {
            SqlCommand cmd   = null;
            DataTable  table = null;

            try
            {
                cmd             = DataAccessHelper.CreateCommand(SECTION_LIST_DETAILS_SQL);
                cmd.CommandType = CommandType.Text;
                AddParameterWithNullCheck(cmd, "@HelpSectionId", id);

                DataSet ds = DataAccessHelper.GetList(cmd);
                table = ds.Tables[0];
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(table);
        }
Esempio n. 17
0
        // TODO: make this less ugly
        protected void MetadataGrid_UpdateCommand(object sender, DataGridCommandEventArgs e)
        {
            // setup the update command
            SqlCommand cmd = null;

            // extract controls from the command args
            // USE TEXTBOXES to Test
            string id          = e.Item.Cells[1].Text;
            string name        = e.Item.Cells[2].Text;
            string description = ((TextBox)e.Item.Cells[4].Controls[0]).Text;
            string label       = ((TextBox)e.Item.Cells[3].Controls[0]).Text;
            // string ctype = ((DropDownList) e.Item.Cells["HelpFieldControlType"].Controls[0]).SelectedValue;

            DropDownList clist = (DropDownList)e.Item.FindControl("ControlTypes");
            string       ctype = null;

            if (!"".Equals(clist.SelectedValue))
            {
                ctype = clist.SelectedValue;
            }

            DropDownList dlist = (DropDownList)e.Item.FindControl("Datatypes");
            string       dtype = null;

            if (!"".Equals(dlist.SelectedValue))
            {
                dtype = dlist.SelectedValue;
            }

            // suppress required for now ...
            // bool required = ((CheckBox) e.Item.Cells["HelpFieldRequired"].Controls[0]).Checked;
            // string required = null;
            // string min = null;
            // string max = null;
            string rowsource = ((TextBox)e.Item.Cells[7].Controls[0]).Text;

            if (rowsource != null && "".Equals(rowsource))
            {
                rowsource = null;
            }
            // string notes = null;


            cmd             = DataAccessHelper.CreateCommand(UPDATE_SQL);
            cmd.CommandType = CommandType.Text;


            AddParameterWithNullCheck(cmd, "@FieldId", Int32.Parse(id));
            AddParameterWithNullCheck(cmd, "@FieldName", name);
            AddParameterWithNullCheck(cmd, "@FieldDescription", description);
            AddParameterWithNullCheck(cmd, "@FieldLabel", label);
            AddParameterWithNullCheck(cmd, "@FieldControlType", ctype);
            AddParameterWithNullCheck(cmd, "@FieldDataType", dtype);
            AddParameterWithNullCheck(cmd, "@FieldRowSource", rowsource);

            // what about null values?
            //DataAccessHelper.AddStringInputParam(cmd, "HelpFieldRequired", required); // HelpFieldRequired is varchar(50)
            //DataAccessHelper.AddStringInputParam(cmd, "HelpFieldMin", min);
            //DataAccessHelper.AddStringInputParam(cmd, "HelpFieldMax", max);
            //DataAccessHelper.AddStringInputParam(cmd, "HelpFieldNotes", notes);

            DataAccessHelper.ExecuteScalar(cmd);             // this handles connections

            // reset the grid to its default mode
            ResetGrid();
        }