Exemplo n.º 1
0
        public List <ImpRuleQuesAnswer> getRuleAnswerList(int ruleQuestionID = 0, int quesTypeID = 0)
        {
            List <ImpRuleQuesAnswer> quesAnsList = new List <ImpRuleQuesAnswer>();
            String myQuery = "SELECT *"
                             + " FROM I_Rule_Ques_Answer QA"
                             + " JOIN I_Rule_Question Q ON Q.rule_question_id = QA.I_Rule_Question_rule_question_id"
                             + " WHERE 1=1";

            myQuery += ruleQuestionID != 0 ? " AND QA.I_Rule_Question_rule_question_id = " + ruleQuestionID : "";
            myQuery += quesTypeID != 0 ? " AND Q.rule_question_type_id = " + quesTypeID : "";

            DBUtils       dbUtils    = new DBUtils();
            SqlDataReader listReader = dbUtils.readOperation(myQuery);

            while (listReader.Read())
            {
                ImpRuleQuesAnswer obj1 = new ImpRuleQuesAnswer();

                obj1.answerId       = (int)listReader["answer_id"];
                obj1.answerStatemet = listReader["answer_statement"].ToString();
                obj1.questionId     = (int)listReader["I_Rule_Question_rule_question_id"];
                quesAnsList.Add(obj1);
            }
            dbUtils.closeDBConnection();
            return(quesAnsList);
        }
Exemplo n.º 2
0
        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int ruleID = Request.QueryString["id"] == null ? 0 : Int32.Parse(Request.QueryString["id"]);

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //Get questionID here
                int         ruleQuesID       = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ruleQuesId"));
                int         questionTypeID   = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ruleQuesTypeID"));
                HiddenField questionIDHidden = (HiddenField)e.Item.FindControl("ruleQuestionIDHidden");
                HiddenField ruleQuestionTypeIDHiddenBackend = (HiddenField)e.Item.FindControl("ruleQuestionTypeIDHidden");

                ruleQuestionTypeIDHiddenBackend.Value = questionTypeID.ToString();
                questionIDHidden.Value = ruleQuesID.ToString();

                if (questionTypeID == 1101)
                {
                    RadioButtonList RadioButtonList1     = (RadioButtonList)e.Item.FindControl("radlstPubs");
                    Panel           queryPanelOneBackend = (Panel)e.Item.FindControl("queryPanelOne");
                    queryPanelOneBackend.Visible = false;

                    ImpDao impDaoObj = new ImpDao();
                    List <ImpRuleQuesAnswer> answerList = impDaoObj.getRuleAnswerList(ruleQuesID, questionTypeID);

                    RadioButtonList1.DataSource     = answerList;
                    RadioButtonList1.DataTextField  = "answerStatemet";
                    RadioButtonList1.DataValueField = "answerId";
                    RadioButtonList1.DataBind();

                    if (ruleID != 0)
                    {
                        ImpRuleQuesAnswer ruleAns = impDaoObj.getRuleAnswerByRuleIDQuestionID(ruleQuesID, ruleID);
                        RadioButtonList1.SelectedValue = ruleAns.answerId.ToString();
                    }
                }
                else if (questionTypeID == 1102)
                {
                    RadioButtonList RadioButtonList1 = (RadioButtonList)e.Item.FindControl("radlstPubs");

                    DBUtils       dbUtils1             = new DBUtils();
                    SqlDataReader attributeTypeReader1 = dbUtils1.readOperation("SELECT * FROM App_CODE Where CODE_TYPE_ID=1600");
                    while (attributeTypeReader1.Read())
                    {
                        RadioButtonList1.Items.Add(new ListItem(attributeTypeReader1["CODE_VALUE"].ToString(),
                                                                attributeTypeReader1["CODE_ID"].ToString()));
                    }
                    dbUtils1.closeDBConnection();

                    if (ruleID != 0)
                    {
                        ImpDao            impDaoObj = new ImpDao();
                        ImpRuleQuesAnswer ruleAns   = impDaoObj.getRuleDBValueByRuleIDQuestionID(ruleQuesID, ruleID);
                        RadioButtonList1.SelectedValue = ruleAns.comparisonTypeID.ToString();
                        TextBox comparisonValueTxtBox = (TextBox)e.Item.FindControl("dbQueryValue");
                        comparisonValueTxtBox.Text = ruleAns.comparisonValue.ToString();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public ImpRuleQuesAnswer getRuleDBValueByRuleIDQuestionID(int ruleQuestionID, int ruleID)
        {
            ImpRuleQuesAnswer obj1    = new ImpRuleQuesAnswer();
            String            myQuery = "SELECT *"
                                        + " FROM I_Rule_Case RC"
                                        + " WHERE RC.I_RULE_QUESTION_ID = " + ruleQuestionID
                                        + " AND RC.I_Rule_rule_id = " + ruleID;

            DBUtils       dbUtils    = new DBUtils();
            SqlDataReader listReader = dbUtils.readOperation(myQuery);

            while (listReader.Read())
            {
                obj1.questionId       = (int)listReader["I_RULE_QUESTION_ID"];
                obj1.comparisonValue  = (int)listReader["COMPARISON_VALUE"];
                obj1.comparisonTypeID = (int)listReader["COMPARISON_TYPE"];
            }
            dbUtils.closeDBConnection();
            return(obj1);
        }
Exemplo n.º 4
0
        public ImpRuleQuesAnswer getRuleAnswerByRuleIDQuestionID(int ruleQuestionID, int ruleID)
        {
            ImpRuleQuesAnswer obj1    = new ImpRuleQuesAnswer();
            String            myQuery = "SELECT *"
                                        + " FROM I_Rule_Case RC"
                                        + " JOIN I_Rule_Ques_Answer QA ON QA.answer_id = RC.I_Rule_Ques_Answer_answer_id"
                                        + " JOIN I_Rule_Question RQ ON RQ.rule_question_id = QA.I_Rule_Question_rule_question_id"
                                        + " WHERE RQ.rule_question_id = " + ruleQuestionID
                                        + " AND RC.I_Rule_rule_id = " + ruleID;

            DBUtils       dbUtils    = new DBUtils();
            SqlDataReader listReader = dbUtils.readOperation(myQuery);

            while (listReader.Read())
            {
                obj1.answerId   = (int)listReader["answer_id"];
                obj1.questionId = (int)listReader["rule_question_id"];
            }
            dbUtils.closeDBConnection();
            return(obj1);
        }