protected void GVLinks_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("UpdateLinkValue"))
        {
            BLL.QuestionnaireLib oQuestionnaireLib;
            try
            {
                oQuestionnaireLib = new BLL.QuestionnaireLib();
                GridViewRow gvRow = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
                TextBox txtValue = (TextBox)gvRow.FindControl("txtValue");
                if (txtValue != null)
                {
                    if (!txtValue.Text.Equals(string.Empty))
                    {
                        if (oQuestionnaireLib.UpdateGlobalCodesByGlobalCodeId(txtValue.Text, Convert.ToInt32(e.CommandArgument)))
                        {
                            lblMsg.Text = "Record has been updated successfully.";
                            BindGrid();
                        }
                    }
                    else
                    {
                        lblMsg.Text = "Please enter the link value.";
                        return;
                    }
                }
            }
            catch (Exception ex) { lblMsg.Text = ex.Message; }
            finally { oQuestionnaireLib = null; }

        }
    }
 private void BindGrid()
 {
     BLL.QuestionnaireLib oQuestionnaireLib;
     try
     {
         oQuestionnaireLib = new BLL.QuestionnaireLib();
         GVLinks.DataSource = oQuestionnaireLib.GetGlobalCodesByCategoryName("SocialNetworkingLink");
         GVLinks.DataBind();
     }
     catch (Exception ex) { lblMsg.Text = ex.Message; }
     finally { oQuestionnaireLib = null; }
 }
    protected void GVQuestionHeading_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            GridView GVQuestion = (GridView)e.Row.FindControl("GVQuestion");
            if (GVQuestion != null)
            {
                BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
                GVQuestion.DataSource = oQuestionnaireLib.GetAllQuestionnairesByHeading(3, DataBinder.Eval(e.Row.DataItem, "strHeading").ToString());
                GVQuestion.DataBind();

            }
        }
    }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            bool blnIsChecked = false;

            foreach (GridViewRow gvRow in GVQuestionnaire.Rows)
            {
                RadioButtonList rdoListAnswer = (RadioButtonList)gvRow.FindControl("rdoListAnswer");
                if (!blnIsChecked)
                {
                    if (rdoListAnswer != null)
                    {
                        if (rdoListAnswer.SelectedValue.Equals("Yes"))
                        {
                            blnIsChecked = true;
                            break;
                        }
                    }
                }
                else
                {
                    break;
                }
            }

            if (blnIsChecked)
            {
                if (!chkWaiverAgreement.Checked)
                {
                    lblError.Text = "Please accept the waiver agreement";
                    return;
                }
                else
                {
                    List<Entity.QuestionnaireInfo> oListQuestionnaireInfo = new List<Entity.QuestionnaireInfo>();

                    foreach (GridViewRow gvr in GVQuestionnaire.Rows)
                    {
                        Entity.QuestionnaireInfo oQuestionnaireInfo = new Entity.QuestionnaireInfo();
                        oQuestionnaireInfo.DtCreatedDate = DateTime.Now;
                        Label lblQuestionId = (Label)gvr.FindControl("lblQuestionId");
                        Label lblQuestion = (Label)gvr.FindControl("lblQuestion");
                        RadioButtonList rdoListAnswer = (RadioButtonList)gvr.FindControl("rdoListAnswer");

                        if (lblQuestionId != null && lblQuestion != null)
                        {
                            oQuestionnaireInfo.IntQuestionnaireId = Convert.ToInt32(lblQuestionId.Text);
                            oQuestionnaireInfo.StrQuestion = lblQuestion.Text;
                            oQuestionnaireInfo.StrAnswer = rdoListAnswer.SelectedValue;
                        }

                        oListQuestionnaireInfo.Add(oQuestionnaireInfo);
                        oQuestionnaireInfo = null;
                    }

                    BackofficeClass objBackOfficeClass = new BackofficeClass();
                    DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
                    if (DS != null)
                    {
                        if (DS.Tables[0].Rows.Count > 0)
                        {
                            BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
                            oQuestionnaireLib.SaveUserRiskStratificationProcessDetailsPartB(oListQuestionnaireInfo, new Guid(DS.Tables[0].Rows[0]["USER_ID"].ToString()));

                            DS = null;
                            objBackOfficeClass = null;
                            oListQuestionnaireInfo = null;
                            Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep2.aspx?id=" + Request.QueryString["id"].ToString());
                        }
                    }
                }
            }

            else
            {
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep2.aspx?id=" + Request.QueryString["id"].ToString());
            }

        }

        catch (Exception ex) { lblError.Text = ex.Message; }
    }
 private void BindQuestionnaires()
 {
     BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
       GVQuestionnaire.DataSource = oQuestionnaireLib.GetAllQuestionnairesByQuestionnareType(2);
       GVQuestionnaire.DataBind();
       oQuestionnaireLib = null;
 }
    protected void lnkBtnSubmit_Click(object sender, EventArgs e)
    {
        BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
        try
        {

            bool bolIsPositiveRiskFactor = false;
            int intPositiveRiskFactor = 0;
            int intNegativeRiskFactor = 0;
            //Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep3.aspx?id=" + Request.QueryString["id"].ToString());
            foreach (GridViewRow gvr in GVQuestionnaireHeading.Rows)
            {
                Label lblQuestionHeading = (Label)gvr.FindControl("lblQuestionHeading");
                GridView GVQuestion = (GridView)gvr.FindControl("GVQuestion");
                string strQuestHeading = lblQuestionHeading.Text;

                if (lblQuestionHeading != null)
                {
                    if (!strQuestHeading.ToLower().Equals("age"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            Label lblQuestionId = (Label)gvrQuestions.FindControl("lblQuestionId");
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");

                            if (lblQuestionId.Text.Equals("18"))
                            {

                                //18 means 45 old
                            }
                            else if (lblQuestionId.Text.Equals("19"))
                            {
                                //19 means 55 old

                            }
                        }
                    }

                    if (strQuestHeading.ToLower().Equals("positive risk factor"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer != null)
                            {
                                if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                    bolIsPositiveRiskFactor = true;
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("cholesterol"))
                    {
                        bool blnIsAdded = false;
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                if (!blnIsAdded)
                                {
                                    blnIsAdded = true;
                                    intNegativeRiskFactor = intNegativeRiskFactor + 1;
                                }
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("hypertension"))
                    {
                        bool blnIsAdded = false;
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                if (!blnIsAdded)
                                {
                                    blnIsAdded = true;
                                    intNegativeRiskFactor = intNegativeRiskFactor + 1;
                                }
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("smoking"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                            {
                                //Response.Write("smoking=" + intNegativeRiskFactor);
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                            }
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("pre-diabetes"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("weight"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                    else if (strQuestHeading.ToLower().Equals("activity factor"))
                    {
                        foreach (GridViewRow gvrQuestions in GVQuestion.Rows)
                        {
                            RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestions.FindControl("rdoListAnswer");
                            if (rdoListAnswer.SelectedValue.Equals("Yes"))
                                intNegativeRiskFactor = intNegativeRiskFactor + 1;
                        }
                    }
                }
            }

            if (bolIsPositiveRiskFactor)
                intNegativeRiskFactor = intNegativeRiskFactor - 1;

            int intScore = 0;
            int intCategory = 0;

            //intScore = intNegativeRiskFactor - intPositiveRiskFactor;
            intScore = intNegativeRiskFactor;
            objBackOfficeClass = new BackofficeClass();
            string strEmailId = AppLib.Decrypt(Request.QueryString["id"].ToString());

            if (!oQuestionnaireLib.HasUserGivenYesAnswerinFirstRiskStratificationStep(strEmailId))
            {
                oQuestionnaireLib = null;
                DataSet DS = objBackOfficeClass.Mem_GET_UserInfo(strEmailId);
                if (DS != null)
                {
                    if (DS.Tables[0].Rows.Count > 0)
                    {
                        int intCurrentYear = DateTime.Now.Year;
                        int intBirthYear = Convert.ToDateTime(DS.Tables[0].Rows[0]["DATE_BIRTH"]).Year;
                        int intPresentAge = intCurrentYear - intBirthYear;

                        int intGenderCode = Convert.ToInt32(DS.Tables[0].Rows[0]["GENDER_ID"]);
                        if ((intGenderCode.Equals(1) && intPresentAge <= 45) || (intGenderCode.Equals(2) && intPresentAge <= 55))
                        {///1 = male, 2= female
                            if (intScore <= 1)
                            {
                                /*Well category Low Risk*/
                                intCategory = 0;
                                category = "Well";
                            }
                            if (intScore >= 2)
                            {
                                /*Living category Medium Risk*/
                                intCategory = 2;
                                category = "Living";
                            }
                        }
                        else if ((intGenderCode.Equals(1) && intPresentAge > 45) || (intGenderCode.Equals(2) && intPresentAge > 55))
                        {///1 = male, 2= female
                            if (intScore >= 2)
                            {
                                /*Living category Medium Risk*/
                                intCategory = 2;
                                category = "Living";
                            }
                            if (intScore <= 1)
                            {
                                /*Well category Low Risk*/
                                intCategory = 0;
                                category = "Well";
                            }
                        }
                        else
                        {
                            intCategory = 1;
                            category = "Tri";
                            //try and high risk
                            /*if user given any yes answer at the step 1 questions*/
                        }
                    }
                }

                DS = null;
                objBackOfficeClass = null;
            }
            else
            {  //try and high risk
                intCategory = 1;
                category = "Tri";
                /*Means user given any yes answer at the step 1 questions*/

            }

            List<Entity.QuestionnaireInfo> oListQuestionnaireInfo = new List<Entity.QuestionnaireInfo>();

            foreach (GridViewRow gvr in GVQuestionnaireHeading.Rows)
            {
                GridView GVQuestion = (GridView)gvr.FindControl("GVQuestion");
                if (GVQuestion != null)
                {
                    foreach (GridViewRow gvrQuestion in GVQuestion.Rows)
                    {
                        Entity.QuestionnaireInfo oQuestionnaireInfo = new Entity.QuestionnaireInfo();
                        oQuestionnaireInfo.DtCreatedDate = DateTime.Now;
                        Label lblQuestionId = (Label)gvrQuestion.FindControl("lblQuestionId");
                        Label lblQuestion = (Label)gvrQuestion.FindControl("lblQuestion");
                        RadioButtonList rdoListAnswer = (RadioButtonList)gvrQuestion.FindControl("rdoListAnswer");

                        if (lblQuestionId != null && lblQuestion != null)
                        {
                            oQuestionnaireInfo.IntQuestionnaireId = Convert.ToInt32(lblQuestionId.Text);
                            oQuestionnaireInfo.StrQuestion = lblQuestion.Text;
                            oQuestionnaireInfo.StrAnswer = rdoListAnswer.SelectedValue;
                        }

                        oListQuestionnaireInfo.Add(oQuestionnaireInfo);
                        oQuestionnaireInfo = null;
                    }
                }

            }

            objBackOfficeClass = new BackofficeClass();
            DataSet DS1 = objBackOfficeClass.Mem_GET_UserInfo(AppLib.GetLoggedInUserName());
            if (DS1 != null)
            {
                if (DS1.Tables[0].Rows.Count > 0)
                {
                    oQuestionnaireLib = new BLL.QuestionnaireLib();
                    oQuestionnaireLib.SaveUserRiskStratificationProcessDetailsStepSecond(oListQuestionnaireInfo, new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString()));

                    BLL.UserLib oUserLib = new BLL.UserLib();
                    if (!oUserLib.CheckUserAssessmentAlreadyExists(new Guid(DS1.Tables[0].Rows[0]["USER_ID"].ToString())))
                        objBackOfficeClass.Mem_INSERT_UserAssessments(DS1.Tables[0].Rows[0]["USER_ID"].ToString(), "1", intScore.ToString());

                    objBackOfficeClass = null;
                    oListQuestionnaireInfo = null;
                    DS1 = null;
                    oUserLib = null;
                    Response.Redirect(AppConfig.GetBaseSiteUrl() + "Users/RiskStratificationProcessStep3.aspx?id=" + Request.QueryString["id"].ToString() + "&sc=" + AppLib.Encrypt(intScore.ToString()) + "&c=" + AppLib.Encrypt(intCategory.ToString()) + "&cat=" + category.ToString());
                }
            }
        }
        catch (Exception ex) { lblError.Text = ex.Message; }
        finally { oQuestionnaireLib = null; }
    }
 /// <summary>
 /// following function is used to bind the questions.
 /// </summary>
 private void BindQuestionnaires()
 {
     BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
     GVQuestionnaireHeading.DataSource = oQuestionnaireLib.GetGlobalCodesByCategoryName("SubQuestionnaireTypes");
     GVQuestionnaireHeading.DataBind();
     oQuestionnaireLib = null;
 }
Beispiel #8
0
    /*Sub Header***********************************************************
    Function Name: BindGlobalCodesDropdown
    Functionality: This function is used to bind the dropdown from the globalcodes
    Input: dropdownlist and the strInitialText
    Output:
    Note:
    *********************************************************************/
    public static void BindGlobalCodesDropdown(DropDownList ddList, string strInitialText, string _strCategory)
    {
        BLL.QuestionnaireLib oQuestionnaireLib = new BLL.QuestionnaireLib();
        ddList.DataSource = oQuestionnaireLib.GetGlobalCodesByCategoryName(_strCategory);
        ddList.DataTextField = "strHeading";
        ddList.DataValueField = "IntGlobalCodesId";
        ddList.DataBind();

        ListItem lstInitialItem;
        if (strInitialText.Trim() != "")
        {
            lstInitialItem = new ListItem(strInitialText, "0");
            ddList.Items.Insert(0, lstInitialItem);
        }
        lstInitialItem = null;

        oQuestionnaireLib = null;
    }
 /// Function Header*******************************************************
 /// Function Name: BindAnnouncements
 /// Function Type: Function
 /// Functionality: used to bind announcements
 /// Input: 
 /// Output: 
 /// Return Value:
 /// Note: 
 /// *********************************************************************
 private void BindSocialLinks()
 {
     BLL.QuestionnaireLib oQuestionnaireLib;
     try
     {
         oQuestionnaireLib = new BLL.QuestionnaireLib();
         //dlLinks.DataSource = oQuestionnaireLib.GetGlobalCodesByCategoryName("SocialNetworkingLink");
         //dlLinks.DataBind();
     }
     catch (Exception ex) { throw ex; }
     finally { oQuestionnaireLib = null; }
 }