protected void Page_Load(object sender, EventArgs e)
        {
            int                           cloID                   = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);
            ImpDao                        impDaoObj               = new ImpDao();
            GeneralUtils                  genUtilObj              = new GeneralUtils();
            List <ImpRuleQuestion>        dbTypeQuestionList      = impDaoObj.getRuleQuestionList(cloID, 1102);
            List <AskUserWhereAttributes> listAskWhereUserDetails = new List <AskUserWhereAttributes>();

            for (int i = 0; i < dbTypeQuestionList.Count; i++)
            {
                String     dbQueryValue          = dbTypeQuestionList[i].dBQueryStatement;
                List <int> openBracketOccurences = genUtilObj.getCharacterOccurancesInString(dbQueryValue, '{');
                if (openBracketOccurences.Count > 0)
                {
                    List <int>    closeBracketOccurences = genUtilObj.getCharacterOccurancesInString(dbQueryValue, '}');
                    List <int>    endBracketCalculation  = genUtilObj.getEndDifferenceValue(openBracketOccurences, closeBracketOccurences);
                    List <String> jsonAskUserList        = genUtilObj.getJSONStringAskUser(dbQueryValue, openBracketOccurences, endBracketCalculation);
                    for (int j = 0; j < jsonAskUserList.Count; j++)
                    {
                        AskUserWhereAttributes localAskUserAttribute = JsonConvert.DeserializeObject <AskUserWhereAttributes>(jsonAskUserList[j]);
                        localAskUserAttribute.questionID            = dbTypeQuestionList[i].ruleQuesId;
                        localAskUserAttribute.questionStatement     = dbTypeQuestionList[i].ruleQuestionStatemet;
                        localAskUserAttribute.whereAskUserToReplace = jsonAskUserList[j];
                        listAskWhereUserDetails.Add(localAskUserAttribute);
                    }
                }
            }

            DataList1.DataSource = listAskWhereUserDetails;
            DataList1.DataBind();
        }
        private void LoadList()
        {
            ImpDao queDaoObj = new ImpDao();
            List <ImpRuleQuestion> attrList = queDaoObj.getRuleQuestionList();

            attributeListTag.DataSource = attrList;
            attributeListTag.DataBind();
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ImpDao impDaoObj = new ImpDao();
            int    cloID     = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);

            if (Page.IsPostBack == false)
            {
                int  ruleID     = Request.QueryString["id"] == null ? 0 : Int32.Parse(Request.QueryString["id"]);
                bool viewMode   = Request.QueryString["viewMode"] == null ? false : Boolean.Parse(Request.QueryString["viewMode"]);
                bool editMode   = Request.QueryString["editMode"] == null ? false : Boolean.Parse(Request.QueryString["editMode"]);
                bool deleteMode = Request.QueryString["deleteMode"] == null ? false : Boolean.Parse(Request.QueryString["deleteMode"]);

                if (ruleID != 0)
                {
                    if (deleteMode)
                    {
                        deleteRule(ruleID);
                        Response.Redirect("~/KMSPages/ImpRuleList.aspx");
                    }

                    ImpRule rule = impDaoObj.getRuleByID(ruleID);
                    cloID         = rule.cloData.cloId;
                    ruleStmt.Text = rule.ruleStatemet;

                    if (viewMode == true)
                    {
                        ruleStmt.Enabled  = false;
                        DataList1.Enabled = false;
                    }

                    Button1.Visible = !viewMode;
                    cancelBtn.Text  = viewMode ? "Close" : "Cancel";
                    Button1.Text    = editMode ? "Update" : "Submit";
                }

                ViewState["cloID"] = cloID;

                AppCLO myClo = impDaoObj.getCloByCloID(cloID);
                TextBox1.Text = myClo.programName;
                TextBox2.Text = myClo.courseName;
                TextBox3.Text = myClo.cloStatement;
            }

            List <ImpRuleQuestion> quesList = impDaoObj.getRuleQuestionList(Int32.Parse(ViewState["cloID"].ToString()));

            DataList1.DataSource = quesList;
            DataList1.DataBind();
        }
        protected void Button1_Click(object Source, EventArgs e)
        {
            List <AskUserWhereAttributes> listAttributes = new List <AskUserWhereAttributes>();
            ImpDao impDaoObj = new ImpDao();
            int    cloID     = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);
            List <ImpRuleQuestion> dbTypeQuestionList = impDaoObj.getRuleQuestionList(cloID, 1102);

            foreach (DataListItem item in DataList1.Items)
            {
                if (((DropDownList)item.FindControl("ddlItemTemp")).SelectedItem != null)
                {
                    AskUserWhereAttributes localAttr            = new AskUserWhereAttributes();
                    HiddenField            jsonStringHiddenElem = (HiddenField)item.FindControl("jsonStringHidden");
                    String      jsonValue            = jsonStringHiddenElem.Value;
                    HiddenField questionIDHiddenElem = (HiddenField)item.FindControl("questionIDHidden");
                    int         questionID           = Convert.ToInt32(questionIDHiddenElem.Value);
                    String      selectedItemDDL      = ((DropDownList)item.FindControl("ddlItemTemp")).SelectedItem.Value;
                    localAttr.whereAskUserToReplace = jsonValue;
                    localAttr.questionID            = questionID;
                    localAttr.selectedItemValue     = Convert.ToInt32(selectedItemDDL);
                    listAttributes.Add(localAttr);
                }
            }

            String questionJSON = "[";

            foreach (ImpRuleQuestion quesItem in dbTypeQuestionList)
            {
                foreach (AskUserWhereAttributes attr in listAttributes)
                {
                    if (quesItem.ruleQuesId == attr.questionID)
                    {
                        quesItem.dBQueryStatement =
                            quesItem.dBQueryStatement.Replace(attr.whereAskUserToReplace, attr.selectedItemValue.ToString());
                    }
                }
                int returnedResult = impDaoObj.executeSavedDBQuery(quesItem.dBQueryStatement);
                quesItem.dbQueryCalculatedValue = returnedResult;
                questionJSON += "{ruleQuesId : " + quesItem.ruleQuesId + ", dbQueryCalculatedValue : " + quesItem.dbQueryCalculatedValue + "},";
            }
            questionJSON  = questionJSON.Substring(0, questionJSON.Length - 1);
            questionJSON += "]";
            Response.Redirect("~/KMSPages/ImpAskSuggestion.aspx?cloID=" + cloID + "&dbQueryValues=" + questionJSON);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ImpDao impDaoObj = new ImpDao();
            int    cloID     = Request.QueryString["cloID"] == null ? 0 : Int32.Parse(Request.QueryString["cloID"]);

            if (Page.IsPostBack == false)
            {
                AppCLO myClo = impDaoObj.getCloByCloID(cloID);
                TextBox1.Text        = myClo.programName;
                TextBox2.Text        = myClo.courseName;
                TextBox3.Text        = myClo.cloStatement;
                expertSugLbl.Visible = false;
            }

            List <ImpRuleQuestion> quesList = impDaoObj.getRuleQuestionList(cloID);

            DataList1.DataSource = quesList;
            DataList1.DataBind();
        }