Beispiel #1
0
    private void InitializeQuestion(int soid)
    {
        try
        {
            Section s = new Section();
            s = s.GetSectionByOID(soid);
            Label lblSect;
            Label lineBreak = new Label();
            lineBreak.Text = "<br />";
            lblSect = new Label();

            //Section
            //lblSect.Text = s.SectionName;
           // PlaceHolderMain.Controls.Add(lblSect);

            PlaceHolderMain.Controls.Add(InsertLineBreaks(1));
            //Each Question
            foreach (Question q in s.QuestionList)
            {
                // PlaceHolderMain.Controls.Add(InsertLineBreaks(1));
                lblSect = new Label();
                lblSect.Text = q.OrderNo + ". " + q.QuestionText;
                PlaceHolderMain.Controls.Add(lblSect);

                if (q.RespAction == "Radio Button")
                {
                    //Panel p = new Panel();

                    RadioButtonList rblist = new RadioButtonList();
                    rblist.ID = q.QuestionOID.ToString();

                    //Each Question Response
                    foreach (QuestionResponse resp in q.QuestionRespList)
                    {
                        rblist.Items.Add(resp.Response);
                    }
                    //p.Controls.Add(rblist);
                    ///PlaceHolderMain.Controls.Add(InsertLineBreaks(1));
                    PlaceHolderMain.Controls.Add(rblist);
                }
                else if (q.RespAction == "Check Box")
                {
                    //Panel p = new Panel();
                    CheckBoxList chlist = new CheckBoxList();
                    chlist.ID = q.QuestionOID.ToString();

                    //Each Question Response
                    foreach (QuestionResponse resp in q.QuestionRespList)
                    {
                        chlist.Items.Add(resp.Response);
                    }
                    //p.Controls.Add(chlist);
                    //PlaceHolderMain.Controls.Add(InsertLineBreaks(1));
                    PlaceHolderMain.Controls.Add(chlist);
                }

                else if (q.RespAction == "Drop Down")
                {
                    //Panel p = new Panel();
                    DropDownList ddl = new DropDownList();
                    ddl.ID = q.QuestionOID.ToString();

                    //Each Question Response
                    foreach (QuestionResponse resp in q.QuestionRespList)
                    {
                        ddl.Items.Add(resp.Response);
                    }
                    //p.Controls.Add(ddl);
                    PlaceHolderMain.Controls.Add(ddl);
                }

            }
            PlaceHolderMain.Controls.Add(InsertLineBreaks(2));
        }
        catch (Exception ex)
        { }
    }
Beispiel #2
0
    protected void ButtonSaveMyWork_Click(object sender, EventArgs e)
    {
        string ordNum, ques, RespAct, Multi, Resp, Flag, reverse =null;
        int assessmentOID,sectionOID,totalQuestion=0;
        assessmentOID = (Session["aid"] != null) ? Convert.ToInt32(Session["aid"]) : -1;
        sectionOID = (Request.QueryString["soid"] != null) ? Convert.ToInt32(Request.QueryString["soid"]) : -1;

        Section sectionExiting = null;
        Collection<Question> quesList = new Collection<Question>(); ;
        Collection<QuestionResponse> respList;//=new Collection<QuestionResponse>();
        Question questn;
        QuestionResponse quesResp;
        Section section = new Section();
        sectionExiting = section.GetSectionByOID(sectionOID);

        section.SectionOID = sectionExiting != null ? sectionExiting.SectionOID : 0;
        section.SectionName = TextBoxSectionName.Text;
        section.AssessmentOID = assessmentOID;
        section.LastModifiedBy = 1;
        section.CreatedBy = 1;
        section.FlagPointTotal = 0;
        section.PassingTotal = 0;
        //section.SectionOID = 0;
        section.TotalFlag = 0;
        section.TotalQuestion = 0;
        section.PassingTotal = 0;
        section.Flag = Convert.ToInt32(TextBoxFlag.Text);
        section.Low = Convert.ToInt32(TextBoxLow.Text);
        section.Medium = Convert.ToInt32(TextBoxMedium.Text);
        section.High = 67;

        totalQuestion = sectionExiting != null ? sectionExiting.QuestionList.Count : 0;

        #region Question

        for (int i = 1; ; i++)
        {
            ordNum = "TextOrderNumber" + i.ToString();
            ques = "TextQuestion" + i.ToString();
            RespAct = "SelectResponseAction" + i.ToString();
            Resp = "TextResponse" + i.ToString();
            Flag = "SelectFalgRating" + i.ToString();
            reverse = "chkReverse" + i.ToString();

            ordNum = Request.Form[ordNum];
            if (ordNum == null) break;
            ques = Request.Form[ques];
            RespAct = Request.Form[RespAct];
            Resp = Request.Form[Resp];
            Flag = Request.Form[Flag];
            reverse = Request.Form[reverse];

            //Assign Values to question
            questn = new Question();
            if (i > totalQuestion)
            {
                questn.QuestionOID = 0;
            }
            else
            {
                questn.QuestionOID = sectionExiting.QuestionList[i-1].QuestionOID;
            }
            questn.SectionOID = section.SectionOID;
            questn.CreatedBy = 1;//Set current user
            questn.LastModifiedBy = 1;//Set current user
            questn.Keyword =" ";// Key;
            questn.MultipleAllow = 1;
            questn.OrderNo = Convert.ToInt32(ordNum);
            questn.QuestionText = ques;
            questn.RespAction = RespAct;
            int rev = 0;
            if (reverse == "on")
            {
                rev = 1;
            }
            questn.Reverse = rev;
            quesList.Add(questn);

            //Assign values Question Response
            respList = new Collection<QuestionResponse>();
            quesResp = new QuestionResponse();
            if( questn.QuestionOID !=0)
            {
                quesResp.QuestionResponseOID = sectionExiting.QuestionList[i - 1].QuestionRespList[0].QuestionResponseOID;
            }
            quesResp.CreatedBy = 1;
            quesResp.LastModifiedBy = 1;
            quesResp.FlagRating = Convert.ToInt32(Flag);
            quesResp.Response = Resp;
            respList.Add(quesResp);

            //Process
            for (int j = 2; ; j++)
            {
                Resp = "TextResponse" + i.ToString() + "_" + j.ToString();
                Flag = "SelectFalgRating" + i.ToString() + "_" + j.ToString();

                Resp = Request.Form[Resp];
                Flag = Request.Form[Flag];
                if (Resp == null) break;

                //Assign values Question Response
                quesResp = new QuestionResponse();
                if (i > totalQuestion)
                {
                    quesResp.QuestionResponseOID = 0;
                }
                else
                {
                    if (j > sectionExiting.QuestionList[i-1].QuestionRespList.Count)
                    {
                        quesResp.QuestionResponseOID = 0;
                    }
                    else
                    {
                        quesResp.QuestionResponseOID = sectionExiting.QuestionList[i-1].QuestionRespList[j-1].QuestionResponseOID;
                    }
                }

                //quesResp.QuestionResponseOID = sectionExiting.QuestionList[i].QuestionRespList
                quesResp.CreatedBy = 1;
                quesResp.LastModifiedBy = 1;

                quesResp.FlagRating = Convert.ToInt32(Flag);
                quesResp.Response = Resp;
                respList.Add(quesResp);
            }

            questn.QuestionRespList = respList;

        }
        #endregion

        section.QuestionList = quesList;
        section.UpdateSection();
        section.UpdateAssessmentSection();

        this.InitializeQuestion(sectionOID);
        LabelMessage.Text = "Saved Successfully.";
    }
Beispiel #3
0
    private void InitializeQuestion(int SOID)
    {
        string str = " <table>";
        //str += "<tr>       <td class='style2' >Order#</td> <td>Enter Question</td> <td>Response Action</td>             <td>Responses </td>       <td>Point</td>       <td>Reverse</td>       <td>&nbsp;</td>       </tr>";
        str += "<tr>       <td class='style2' >Order#</td> <td>Enter Question</td>              <td>Responses </td>       <td>Point</td>   <td>Reverse</td>       </tr>";
          try
            {
                Section s = new Section();
                s = s.GetSectionByOID(SOID);
                if (s != null)
                {
                    //TextBoxPassingTotal.Text = s.PassingTotal.ToString();
                    TextBoxSectionName.Text = s.SectionName;
                    TextBoxTotalQuestion.Text = s.TotalQuestion.ToString();
                    TextBoxFlag.Text = s.Flag.ToString();
                    TextBoxLow.Text = s.Low.ToString();
                    TextBoxMedium.Text = s.Medium.ToString();
                    Strong.InnerHtml = s.Medium.ToString();
                    //TextBoxhi.Text = s.High.ToString();
                    int i = 1;
                    int k=1;
                    foreach (Question q in s.QuestionList)
                    {

                        //Code for question
                        int j = 1;

                        foreach (QuestionResponse qr in q.QuestionRespList)
                        {
                            //Code for Question Response
                            if (j == 1)
                            {
                                k=q.QuestionRespList.Count;
                                str += AddFullRow(i.ToString(), q.QuestionText,  qr.Response,k.ToString(),qr.FlagRating,q.RespAction,q.Reverse);
                            }
                            else
                            {
                                str += AddSubRow(i.ToString(), j.ToString(), qr.Response, qr.FlagRating);
                            }

                            j++;

                        }
                        i++;
                    }
                    HiddenRowId.Value = (i - 1).ToString();
                }
            }
            catch (Exception ex)
            { }

        str+="<tr id='RInd'><td colspan='8'>&nbsp;</td></tr>";
        str += "</table>";
        Div1.InnerHtml = str;
    }
Beispiel #4
0
    private void InitializeQuestion(int SOID)
    {
        string str = " <table>";
        str += "<tr>       <td class='style2' >Order# &nbsp;</td> <td>Enter Question&nbsp;&nbsp;</td> <td style='Display:none'>Response Action&nbsp;&nbsp;</td>             <td>Responses&nbsp;&nbsp; </td>       <td>Keyword&nbsp;&nbsp;</td>              <td>&nbsp;</td>       </tr>";
          try
            {
                Section s = new Section();
                s = s.GetSectionByOID(SOID);
                if (s != null)
                {
                    //TextBoxPassingTotal.Text = s.PassingTotal.ToString();
                    //TextBoxSectionName.Text = s.SectionName;
                    TextBoxTotalQuestion.Text = s.TotalQuestion.ToString();
                    //TextBoxFlag.Text = s.Flag.ToString();
                    //TextBoxLow.Text = s.Low.ToString();
                    //TextBoxMedium.Text = s.Medium.ToString();
                    //TextBoxhi.Text = s.High.ToString();
                    if (s.QuestionList.Count == 0)
                        str += AddFullRow("1", " ", " ", " ", "Radio Button", " ");

                    int i = 1;
                    int k=1;
                    foreach (Question q in s.QuestionList)
                    {

                        //Code for question
                        int j = 1;
                        foreach (QuestionResponse qr in q.QuestionRespList)
                        {
                            //Code for Question Response
                            if (j == 1)
                            {
                                k=q.QuestionRespList.Count;
                                str += AddFullRow(i.ToString(), q.QuestionText,  qr.Response,k.ToString(),q.RespAction,q.Keyword);
                            }
                            else
                            {
                                str += AddSubRow(i.ToString(), j.ToString(), qr.Response);
                            }

                            j++;

                        }
                        i++;
                    }
                    if (i == 1) i++;
                    HiddenRowId.Value = (i - 1).ToString();
                }
            }
            catch (Exception ex)
            { }

          str += "<tr id='Row_Ind'><td colspan='8'>&nbsp;</td></tr>";
        str += "</table>";
        Div1.InnerHtml = str;
    }