private void LoadList()
        {
            QueDao queDaoObj = new QueDao();

            String courseIdLocal         = Session["CourseID"].ToString();
            List <QueAttribute> attrList = queDaoObj.getAttrbuteList(courseIdLocal);

            attributeListTag.DataSource = attrList;
            attributeListTag.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            QueDao queDaoObj = new QueDao();

            if (Page.IsPostBack == false)
            {
                fillRelevanceScore(scoreTxtBx1, true);
                fillRelevanceScore(TextBox1, true);
                fillRelevanceScore(TextBox2, true);
                fillCLODropDown(Session["CourseID"].ToString());
                if (DropDownList3.SelectedItem != null)
                {
                    fillSODropDown(DropDownList3.SelectedItem.Value);
                    fillCourseTopicDropDownByCloId(DropDownList3.SelectedItem.Value);
                }

                String   value    = ClientQueryString;
                String[] valueArr = value.Split('=', '&');
                if (valueArr.Count() > 1)
                {
                    int  inputId    = Int32.Parse(valueArr[1]);
                    bool deleteMode = valueArr[7] == "true" ? true : false;
                    bool viewMode   = valueArr[3] == "true" ? true : false;
                    bool editMode   = valueArr[5] == "true" ? true : false;

                    if (deleteMode)
                    {
                        deleteQuestion(inputId);
                    }

                    this.Title              = viewMode ? "View a Question" : "Update a Question";
                    ViewState["viewMode"]   = viewMode;
                    ViewState["editMode"]   = editMode;
                    ViewState["deleteMode"] = deleteMode;

                    List <int> idsList = new List <int>();
                    idsList.Add(inputId);
                    List <QueQuestion> queObjectTemp = queDaoObj.questionList(idsList);
                    if (queObjectTemp.Count > 0)
                    {
                        QueQuestion queObje = queObjectTemp[0];
                        quesStmt.Text = queObje.questionStatement;
                        fillCourseTopicDropDownByCloId(DropDownList3.SelectedItem.Value);
                        DropDownList5.SelectedValue = queObje.courseTopicId.ToString();
                        fillCLODropDown(Session["CourseID"].ToString());
                        DropDownList3.SelectedValue = queObje.cloId.ToString();
                        fillSODropDown(DropDownList3.SelectedItem.Value);
                        DropDownList4.SelectedValue = queObje.soId.ToString();
                    }

                    List <QueAttributeScore> attScoreList = queDaoObj.getQuestionScoreListByID(inputId);
                    foreach (QueAttributeScore attSocre in attScoreList)
                    {
                        if (attSocre.attributeID == 1301) // CLO
                        {
                            TextBox1.SelectedValue = attSocre.scoreValue.ToString();
                        }
                        else if (attSocre.attributeID == 1302) // SO
                        {
                            TextBox2.SelectedValue = attSocre.scoreValue.ToString();
                        }
                        else if (attSocre.attributeID == 1303) // Course Topic
                        {
                            scoreTxtBx1.SelectedValue = attSocre.scoreValue.ToString();
                        }
                    }

                    DropDownList5.Enabled = !viewMode;
                    DropDownList3.Enabled = !viewMode;
                    DropDownList4.Enabled = !viewMode;
                    scoreTxtBx1.Enabled   = !viewMode;
                    Button1.Visible       = !viewMode;
                    DataList12.Enabled    = !viewMode;
                    TextBox1.Enabled      = !viewMode;
                    TextBox2.Enabled      = !viewMode;
                    quesStmt.Enabled      = !viewMode;
                    cancelBtn.Text        = viewMode ? "Close" : "Cancel";
                    Button1.Text          = editMode ? "Update" : "Submit";
                }
                else
                {
                    //FirstGridViewRow();
                    this.Title = "Add a Question";
                }
            }

            String courseIdLocal = Session["CourseID"].ToString();
            List <KMSABET.MyPocos.QueAttribute> attributeList = queDaoObj.getAttrbuteList(courseIdLocal);

            DataList12.DataSource = attributeList;
            DataList12.DataBind();

            //MyUtilities.LogUtils.myLog.Info("Selected drop down value is: " + DropDownList1.SelectedValue);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false && Session["CourseID"] != null)
            {
                fillCLODropDown(Session["CourseID"].ToString());
                fillCourseTopicDropDownByCloId(DropDownList3.SelectedItem.Value);
                fillSODropDown(DropDownList3.SelectedItem.Value);

                ViewState["questionList"] = null;
                ViewState["selectedQuestionList"] = null;
                ViewState["questionScoreList"] = null;

                Button myNextBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepNextButton");
                Button myPreviousBtn = (Button)Wizard1.FindControl("StepNavigationTemplateContainerID$StepPreviousButton");
                if (myPreviousBtn != null)
                {
                    //LogUtils.myLog.Info("My Previous Button is not null");
                    myPreviousBtn.Visible = false;
                }

                bool editMode = Request.QueryString["editMode"] == null ? false : bool.Parse(Request.QueryString["editMode"]);
                if (editMode)
                {
                    label1.Text = "Update Assessment";
                    Wizard1.StartNextButtonText = "Add/Delete Questions";
                    setEditData();
                }
                else
                {
                    label1.Text = "Add Assessment";
                    Wizard1.ActiveStepIndex = 1;
                }
            }
            else
            {
                if (ViewState["questionList"] != null)
                {
                    questionList = (List<QueQuestion>)ViewState["questionList"];
                }

                if (ViewState["selectedQuestionList"] != null)
                {
                    selectedQuestionList = (List<QueQuestion>)ViewState["selectedQuestionList"];
                }
                if (ViewState["questionScoreList"] != null)
                {
                    questionScoreList = (List<QueQuestionScore>)ViewState["questionScoreList"];
                }

            }

            bool editMode1 = Request.QueryString["editMode"] == null ? false : bool.Parse(Request.QueryString["editMode"]);
            if (editMode1) this.Title = "Update Assessment";
            else this.Title = "Add Assessment";

            if (Session["CourseID"] != null)
            {
                String courseIdLocal = Session["CourseID"].ToString();
                List<KMSABET.MyPocos.QueAttribute> attributeList = queDaoObj.getAttrbuteList(courseIdLocal);
                DataList12.DataSource = attributeList;
                DataList12.DataBind();
            }
        }
Exemple #4
0
        protected void GenerateQuestions(object sender, EventArgs e)
        {
            LogUtils.myLog.Info(numberQuestions.Text);
            String courseId = Session["CourseID"].ToString();

            LogUtils.myLog.Info("Session[\"CourseID\"] : " + Session["CourseID"]);
            LogUtils.myLog.Info("Before courseId : " + courseId);
            if (courseId == null || courseId == "")
            {
                courseId = "4";
            }

            LogUtils.myLog.Info("After courseId : " + courseId);

            LogUtils.myLog.Info("Button Generate Questions clicked." + DateTime.Now.ToString());
            AppDao appDaoObj = new AppDao();

            List <AppCourseTopic> topicList = appDaoObj.getCourseTopicList(courseId);
            List <AppCLO>         CLOList   = appDaoObj.getCLOList(courseId);

            QueDao queDaoObj = new QueDao();

            String courseIdLocal         = Session["CourseID"].ToString();
            List <QueAttribute> attrList = queDaoObj.getAttrbuteList(courseIdLocal);

            foreach (QueAttribute attr in attrList)
            {
                attr.optionsList = queDaoObj.getAttributeOptionListByAttrID(attr.attributeID.ToString());
            }

            foreach (AppCLO clo in CLOList)
            {
                List <AppSO> SOList = appDaoObj.getSOList(clo.cloId.ToString());
                clo.soList = SOList;
            }

            foreach (AppCourseTopic courseTopic in topicList)
            {
                LogUtils.myLog.Info("Course Topic : " + courseTopic.topic);
                foreach (AppCLO clo in CLOList)
                {
                    LogUtils.myLog.Info("CLO : " + clo.cloStatement);

                    foreach (AppSO so in clo.soList)
                    {
                        LogUtils.myLog.Info("SO : " + so.statement);
                        QueQuestion queDetails = new QueQuestion();
                        queDetails.cloId         = clo.cloId;
                        queDetails.soId          = so.id;
                        queDetails.courseTopicId = courseTopic.id;
                        queDetails.courseId      = Int32.Parse(courseId);
                        queDetails.attrOptionIds = new List <int>();
                        try
                        {
                            SqlConnection myConnection = new SqlConnection(MyConstants.DBConnectionString);
                            //LogUtils.myLog.Info(MyConstants.DBConnectionString);
                            myConnection.Open();

                            display(attrList, attrList.Count, queDetails, myConnection);

                            myConnection.Close();
                        }
                        catch (Exception ex)
                        {
                            LogUtils.myLog.Debug(e.ToString(), ex);
                        }

                        LogUtils.myLog.Info("After inserting questions. Total Questions : " + totalQuesCount);
                    }
                }
            }

            /*List<QueAttribute> attrList = new List<QueAttribute>();
             * QueAttribute attr1 = new QueAttribute();
             * attr1.attributeID = 1;
             * attr1.attributeStatement = "Time";
             * attr1.optionsList = new List<QueAttributeOption>();
             * QueAttributeOption o1 = new QueAttributeOption();
             * o1.attributeId = 1;
             * o1.optionStatement = "5 mins";
             * o1.attributeOptionId = 1;
             * attr1.optionsList.Add(o1);
             *
             * QueAttributeOption o2 = new QueAttributeOption();
             * o2.attributeId = 1;
             * o2.optionStatement = "10 mins";
             * o2.attributeOptionId = 2;
             * attr1.optionsList.Add(o2);
             *
             * QueAttributeOption o5 = new QueAttributeOption();
             * o5.attributeId = 1;
             * o5.optionStatement = "15 mins";
             * o5.attributeOptionId = 5;
             * attr1.optionsList.Add(o5);
             *
             * QueAttribute attr2 = new QueAttribute();
             * attr2.attributeID = 1;
             * attr2.attributeStatement = "Type";
             * attr2.optionsList = new List<QueAttributeOption>();
             * QueAttributeOption o3 = new QueAttributeOption();
             * o3.attributeId = 2;
             * o3.optionStatement = "MCQ";
             * o3.attributeOptionId = 1;
             * attr2.optionsList.Add(o3);
             *
             * QueAttributeOption o4 = new QueAttributeOption();
             * o4.attributeId = 2;
             * o4.optionStatement = "FB";
             * o4.attributeOptionId = 2;
             * attr2.optionsList.Add(o4);
             *
             * attrList.Add(attr1);
             * attrList.Add(attr2);
             * display(attrList, attrList.Count);
             */
        }