public SURVEYS ParseReaderComplete(DataRow row)
        {
            SURVEYS objReturn = ParseReaderCustom(row);

            if (objReturn != null)
            {
                if (objReturn.PATIENT_ID > 0)
                {
                    PATIENTDB pATIENTDB = new PATIENTDB();
                    objReturn.PATIENT = pATIENTDB.ParseReaderCustom(row);
                }

                if (objReturn.STD_SURVEY_TYPE_ID > 0)
                {
                    STD_SURVEY_TYPEDB sTD_SURVEY_TYPEDB = new STD_SURVEY_TYPEDB();
                    objReturn.STD_SURVEY_TYPE = sTD_SURVEY_TYPEDB.ParseReaderCustom(row);
                }

                if (objReturn.PROVIDER_ID > 0)
                {
                    SStaff_SStaffDB sStaff_SStaffDB = new SStaff_SStaffDB();
                    objReturn.SStaff_SStaff = sStaff_SStaffDB.ParseReaderCustom(row);
                }
            }

            return(objReturn);
        }
        public static Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, SURVEYS objSave)
        {
            Int32     objReturn = 0;
            SURVEYSDB objDB     = new SURVEYSDB();

            objReturn = objDB.Save(CURRENT_USER, CURRENT_REGISTRY_ID, objSave);

            return(objReturn);
        }
        public static SURVEYS GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 SURVEYS_ID)
        {
            SURVEYS   objReturn = null;
            SURVEYSDB objDB     = new SURVEYSDB();

            objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, SURVEYS_ID);

            return(objReturn);
        }
Ejemplo n.º 4
0
        private void LoadForm(int id)
        {
            ResetForm();

            listSurveyName.Enabled = false;

            SURVEYS survey = ServiceInterfaceManager.SURVEYS_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);

            if (survey != null)
            {
                hideSurveyId.Value = survey.SURVEYS_ID.ToString();

                //TODO: Patient ID should not be null or 0 here, but may need to add logic
                //here at some point in case it is.
                if (survey.PATIENT_ID != null && survey.PATIENT_ID > 0)
                {
                    PATIENT p = ServiceInterfaceManager.PATIENT_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, survey.PATIENT_ID.Value);
                    if (p != null)
                    {
                        hidePatientId.Value = p.PATIENT_ID.ToString();

                        if (!string.IsNullOrEmpty(p.LAST_NAME) && !string.IsNullOrEmpty(p.FIRST_NAME))
                        {
                            txtPatientName.Text = p.LAST_NAME + ", " + p.FIRST_NAME;
                        }
                        else if (!string.IsNullOrEmpty(p.LAST_NAME))
                        {
                            txtPatientName.Text = p.LAST_NAME;
                        }
                        else if (!string.IsNullOrEmpty(p.FIRST_NAME))
                        {
                            txtPatientName.Text = p.FIRST_NAME;
                        }
                    }
                }

                foreach (ListItem li in listSurveyName.Items)
                {
                    if (li.Value == survey.STD_SURVEY_TYPE_ID.ToString())
                    {
                        li.Selected = true;
                        break;
                    }
                }

                txtSurveyDate.Text = survey.SURVEY_DATE.ToString("MM/dd/yyyy");
            }
        }
Ejemplo n.º 5
0
        public static SURVEYS GetItemForSurvey(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 SURVEYS_ID)
        {
            SURVEYS   objReturn = null;
            SURVEYSDB objDB     = new SURVEYSDB();

            objReturn = objDB.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, SURVEYS_ID);
            if (objReturn != null)
            {
                if (objReturn.STD_SURVEY_TYPE_ID > 0)
                {
                    objReturn.STD_SURVEY_TYPE = STD_SURVEY_TYPEManager.GetItem(CURRENT_USER, CURRENT_REGISTRY_ID, objReturn.STD_SURVEY_TYPE_ID);
                }

                objReturn.SURVEY_RESULTS = SURVEY_RESULTSManager.GetItemsBySurvey(CURRENT_USER, CURRENT_REGISTRY_ID, SURVEYS_ID);
            }

            return(objReturn);
        }
Ejemplo n.º 6
0
        protected void LinkEdit_Click(object sender, EventArgs e)
        {
            ServiceInterfaceManager.LogInformation("POSTBACK_EVENT", String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);

            try
            {
                UserSession.RefreshCommon();

                LinkButton lb = (LinkButton)sender;
                if (lb != null)
                {
                    int id = 0;
                    int.TryParse(lb.CommandArgument, out id);

                    if (id > 0)
                    {
                        SURVEYS s = ServiceInterfaceManager.SURVEYS_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);
                        if (s != null)
                        {
                            UserSession.CurrentSurveyId = s.SURVEYS_ID;

                            if (s.PATIENT_ID != null)
                            {
                                UserSession.CurrentPatientId = s.PATIENT_ID.Value;
                            }

                            if (s.PROVIDER_ID != null)
                            {
                                UserSession.CurrentProviderId = s.PROVIDER_ID.Value;
                            }

                            pnlSurveys.Visible = false;
                            pnlSurvey.Visible  = true;
                            LoadForm(id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceInterfaceManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);
                throw ex;
            }
        }
        public SURVEYS ParseReaderCustom(DataRow row)
        {
            SURVEYS objReturn = new SURVEYS
            {
                AUTHOR_DUZ         = (string)GetNullableObject(row.Field <object>("SURVEYS_AUTHOR_DUZ")),
                AUTHOR_ID          = (Int32?)GetNullableObject(row.Field <object>("SURVEYS_AUTHOR_ID")),
                CREATED            = (DateTime)GetNullableObject(row.Field <object>("SURVEYS_CREATED")),
                CREATEDBY          = (string)GetNullableObject(row.Field <object>("SURVEYS_CREATEDBY")),
                PATIENT_ID         = (Int32?)GetNullableObject(row.Field <object>("SURVEYS_PATIENT_ID")),
                PROVIDER_DUZ       = (string)GetNullableObject(row.Field <object>("SURVEYS_PROVIDER_DUZ")),
                PROVIDER_ID        = (Int32?)GetNullableObject(row.Field <object>("SURVEYS_PROVIDER_ID")),
                STD_SURVEY_TYPE_ID = (Int32)GetNullableObject(row.Field <object>("SURVEYS_STD_SURVEY_TYPE_ID")),
                SURVEY_DATE        = (DateTime)GetNullableObject(row.Field <object>("SURVEYS_SURVEY_DATE")),
                SURVEY_STATUS      = (string)GetNullableObject(row.Field <object>("SURVEYS_SURVEY_STATUS")),
                SURVEYS_ID         = (Int32)GetNullableObject(row.Field <object>("SURVEYS_SURVEYS_ID")),
                UPDATED            = (DateTime)GetNullableObject(row.Field <object>("SURVEYS_UPDATED")),
                UPDATEDBY          = (string)GetNullableObject(row.Field <object>("SURVEYS_UPDATEDBY"))
            };

            return(objReturn);
        }
Ejemplo n.º 8
0
        protected void BtnSaveComplete_Click(object sender, EventArgs e)
        {
            ServiceInterfaceManager.LogInformation("POSTBACK_EVENT", String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);

            try
            {
                if (SaveForm())
                {
                    SURVEYS survey = SURVEY;
                    if (survey != null)
                    {
                        survey.SURVEY_STATUS = "COMPLETE";
                        survey.SURVEYS_ID    = ServiceInterfaceManager.SURVEYS_SAVE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, survey);
                        SURVEY = survey;
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceInterfaceManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId);
                throw ex;
            }
        }
Ejemplo n.º 9
0
        private void SetupForm()
        {
            tblForm.Visible = false;

            viewPatient.LoadForm(UserSession.CurrentPatientId);

            SURVEYS survey = SURVEY;

            if (survey != null)
            {
                tblForm.Visible = true;

                if (survey.STD_SURVEY_TYPE != null)
                {
                    lblPageTitle.Text = survey.STD_SURVEY_TYPE.NAME;
                }

                List <SURVEY_RESULTS> results = RESULTS;
                if (results != null)
                {
                    //Select distinct question ids
                    List <Int32> questionIds = results.Select(data => data.STD_QUESTION_ID).Distinct().ToList();
                    if (questionIds != null && questionIds.Count > 0)
                    {
                        TableCell newCell  = null;
                        TableRow  newRow   = null;
                        int       rowIndex = 0;

                        foreach (Int32 questionId in questionIds)
                        {
                            List <SURVEY_RESULTS> questions = results.Where(data => data.STD_QUESTION_ID == questionId).ToList();
                            if (questions != null && questions.Count > 0)
                            {
                                Label lbl = new Label();

                                //Add question number and text to table
                                STD_QUESTION stdQuestion = questions.First().STD_QUESTION;
                                if (stdQuestion != null)
                                {
                                    lbl.ID = "lbl" + stdQuestion.ID.ToString();
                                    if (!string.IsNullOrEmpty(stdQuestion.QUESTION_NUMBER))
                                    {
                                        lbl.Text = stdQuestion.QUESTION_NUMBER + ") " + stdQuestion.QUESTION_TEXT;
                                    }
                                    else
                                    {
                                        lbl.Text = stdQuestion.QUESTION_TEXT;
                                    }

                                    newCell = new TableCell();
                                    newCell.Controls.Add(lbl);

                                    newRow = new TableRow();
                                    newRow.Cells.Add(newCell);

                                    tblForm.Rows.AddAt(rowIndex, newRow);
                                    rowIndex++;

                                    if (questions.Count > 1)
                                    {
                                        RadioButtonList rbl = new RadioButtonList();
                                        rbl.ID = "rbl" + stdQuestion.ID.ToString();

                                        foreach (SURVEY_RESULTS question in questions)
                                        {
                                            if (question.STD_QUESTION_CHOICE != null)
                                            {
                                                ListItem li = new ListItem(question.STD_QUESTION_CHOICE.CHOICE_TEXT, question.SURVEY_RESULT_ID.ToString());

                                                if (!Page.IsPostBack)
                                                {
                                                    li.Selected = question.SELECTED_FLAG;
                                                }
                                                else
                                                {
                                                    if (Request != null && Request.Form != null && Request.Form["ctl00$MainContent$" + rbl.ID] != null)
                                                    {
                                                        if (Request.Form["ctl00$MainContent$" + rbl.ID].ToString() == li.Value)
                                                        {
                                                            li.Selected = true;
                                                        }
                                                    }
                                                }

                                                rbl.Items.Add(li);
                                            }
                                        }

                                        newCell = new TableCell();
                                        newCell.Controls.Add(rbl);

                                        newRow = new TableRow();
                                        newRow.Cells.Add(newCell);

                                        tblForm.Rows.AddAt(rowIndex, newRow);
                                        rowIndex++;
                                    }
                                    else
                                    {
                                        SURVEY_RESULTS question = questions.First();
                                        if (question != null)
                                        {
                                            TextBox txt = new TextBox();
                                            txt.ID = "txt" + question.SURVEY_RESULT_ID.ToString();
                                            lbl.AssociatedControlID = txt.ID;
                                            txt.ToolTip             = "Enter a value for Question " + stdQuestion.QUESTION_NUMBER;

                                            if (!Page.IsPostBack)
                                            {
                                                txt.Text = question.RESULT_TEXT;
                                            }
                                            else
                                            {
                                                if (Request != null && Request.Form != null && Request.Form["ctl00$MainContent$" + txt.ID] != null)
                                                {
                                                    txt.Text = Request.Form["ctl00$MainContent$" + txt.ID].ToString();
                                                }
                                            }

                                            newCell = new TableCell();
                                            newCell.Controls.Add(txt);

                                            newRow = new TableRow();
                                            newRow.Cells.Add(newCell);

                                            tblForm.Rows.AddAt(rowIndex, newRow);
                                            rowIndex++;
                                        }
                                    }

                                    //Add blank row/cell
                                    newCell      = new TableCell();
                                    newCell.Text = "&nbsp;";

                                    newRow = new TableRow();
                                    newRow.Cells.Add(newCell);

                                    tblForm.Rows.AddAt(rowIndex, newRow);
                                    rowIndex++;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private bool SaveForm(ref string strResult)
        {
            SURVEYS survey = null;

            if (listSurveyName.SelectedIndex > 0)
            {
                if (string.IsNullOrEmpty(txtSurveyDate.Text))
                {
                    strResult = "<ul><li>Survey Date is Required</li></ul>";
                }
                else
                {
                    if (ValidateDates())
                    {
                        int id = 0;
                        if (!string.IsNullOrEmpty(hideSurveyId.Value))
                        {
                            int.TryParse(hideSurveyId.Value, out id);
                        }
                        if (id > 0)
                        {
                            survey = ServiceInterfaceManager.SURVEYS_GET(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, id);
                        }
                        if (survey == null)
                        {
                            survey = new SURVEYS();
                            survey.SURVEY_STATUS = "NEW";
                        }

                        survey.CREATED   = survey.UPDATED = DateTime.Now;
                        survey.CREATEDBY = survey.UPDATEDBY = HttpContext.Current.User.Identity.Name;

                        int patientId = 0;
                        int.TryParse(hidePatientId.Value, out patientId);
                        survey.PATIENT_ID = patientId;

                        int typeId = 0;
                        int.TryParse(listSurveyName.SelectedValue, out typeId);
                        survey.STD_SURVEY_TYPE_ID = typeId;

                        DateTime dtSurvey = DateTime.MinValue;
                        if (DateTime.TryParse(txtSurveyDate.Text, out dtSurvey))
                        {
                            survey.SURVEY_DATE = dtSurvey;
                        }

                        survey.SURVEYS_ID = ServiceInterfaceManager.SURVEYS_SAVE(HttpContext.Current.User.Identity.Name, UserSession.CurrentRegistryId, survey);
                        if (survey.SURVEYS_ID > 0)
                        {
                            hideSurveyId.Value = survey.SURVEYS_ID.ToString();
                            strResult          = "Save successful<br /><br />";
                            return(true);
                        }
                        else
                        {
                            strResult = "Error saving Survey, please try again<br /><br />";
                        }
                    }
                    else
                    {
                        strResult = lblResult.Text + "<br /><br />";
                    }
                }
            }
            else
            {
                strResult = "<ul><li>Please select an available Survey</li></ul>";
            }

            return(false);
        }
 public static Boolean Delete(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, SURVEYS objDelete)
 {
     return(Delete(CURRENT_USER, CURRENT_REGISTRY_ID, objDelete.SURVEYS_ID));
 }
        public SURVEYS GetItem(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, Int32 SURVEYS_ID)
        {
            SURVEYS objReturn = null;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_SURVEYS_getitem", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);
                sCmd.Parameters.AddWithValue("@SURVEYS_ID", SURVEYS_ID);

                objTemp  = new DataSet();
                sAdapter = new SqlDataAdapter(sCmd);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                if (objTemp != null && objTemp.Tables.Count > 0 && objTemp.Tables[0].Rows.Count > 0)
                {
                    objReturn = ParseReader(objTemp.Tables[0].Rows[0]);
                }

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sAdapter != null)
                {
                    sAdapter.Dispose();
                    sAdapter = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }
        public Int32 Save(string CURRENT_USER, Int32 CURRENT_REGISTRY_ID, SURVEYS objSave)
        {
            Int32 objReturn = 0;

            SqlConnection  sConn    = null;
            SqlCommand     sCmd     = null;
            SqlParameter   p        = null;
            SqlDataAdapter sAdapter = null;
            DataSet        objTemp  = null;

            try
            {
                sConn = new SqlConnection(SqlConnectionString);

                sConn.Open();

                sCmd = new SqlCommand("CRS.usp_SURVEYS_save", sConn);
                sCmd.CommandTimeout = SqlCommandTimeout;
                sCmd.CommandType    = CommandType.StoredProcedure;
                sCmd.Parameters.AddWithValue("@CURRENT_USER", CURRENT_USER);
                sCmd.Parameters.AddWithValue("@CURRENT_REGISTRY_ID", CURRENT_REGISTRY_ID);

                p           = new SqlParameter("@AUTHOR_DUZ", SqlDbType.VarChar, 20);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.AUTHOR_DUZ);
                p           = new SqlParameter("@AUTHOR_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.AUTHOR_ID);
                p           = new SqlParameter("@CREATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.CREATED);
                p           = new SqlParameter("@CREATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.CREATEDBY);
                p           = new SqlParameter("@PATIENT_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PATIENT_ID);
                p           = new SqlParameter("@PROVIDER_DUZ", SqlDbType.VarChar, 20);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PROVIDER_DUZ);
                p           = new SqlParameter("@PROVIDER_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.PROVIDER_ID);
                p           = new SqlParameter("@STD_SURVEY_TYPE_ID", SqlDbType.Int, 4);
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.STD_SURVEY_TYPE_ID);
                p           = new SqlParameter("@SURVEY_DATE", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.SURVEY_DATE);
                p           = new SqlParameter("@SURVEY_STATUS", SqlDbType.VarChar, 10);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.SURVEY_STATUS);
                p           = new SqlParameter("@SURVEYS_ID", SqlDbType.Int, 4);
                p.Direction = ParameterDirection.InputOutput;
                p.Precision = 10;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.SURVEYS_ID);
                p           = new SqlParameter("@UPDATED", SqlDbType.DateTime, 8);
                p.Precision = 23;
                p.Scale     = 3;
                AddParameter(ref sCmd, ref p, objSave.UPDATED);
                p           = new SqlParameter("@UPDATEDBY", SqlDbType.VarChar, 30);
                p.Precision = 0;
                p.Scale     = 0;
                AddParameter(ref sCmd, ref p, objSave.UPDATEDBY);

                objTemp  = new DataSet();
                sAdapter = new SqlDataAdapter(sCmd);

                LogDetails logDetails = new LogDetails(String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                //int cnt = sCmd.ExecuteNonQuery();
                sAdapter.Fill(objTemp);
                LogManager.LogTiming(logDetails);
                CheckDataSet(objTemp);

                objReturn = (Int32)sCmd.Parameters["@SURVEYS_ID"].Value;

                sConn.Close();
            }
            catch (Exception ex)
            {
                LogManager.LogError(ex.Message, String.Format("{0}.{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, System.Reflection.MethodBase.GetCurrentMethod().Name), CURRENT_USER, CURRENT_REGISTRY_ID);
                throw ex;
            }
            finally
            {
                if (sAdapter != null)
                {
                    sAdapter.Dispose();
                    sAdapter = null;
                }
                if (sCmd != null)
                {
                    sCmd.Dispose();
                    sCmd = null;
                }
                if (sConn != null)
                {
                    if (sConn.State != ConnectionState.Closed)
                    {
                        sConn.Close();
                    }
                    sConn.Dispose();
                    sConn = null;
                }
            }

            return(objReturn);
        }