Beispiel #1
0
    protected void btnDeleteSection_Click(object sender, EventArgs e)
    {
        Sections sec = new Sections();
        Question ques=new Question ();
        Assessment ass = new Assessment();
        AnswerDetail ansDetail = new AnswerDetail();
        CVTCMenu menu=new CVTCMenu ();
        QuestionResponse qr=new QuestionResponse ();
        int sectOID = Convert.ToInt32(Request.QueryString["soid"].ToString());
        int AssOID = sec.GetAssessmentOIDBySectionOID(sectOID);
        if (ass.GetAssessmentStatusByOID(Convert.ToInt32(AssOID)) == 1)
        {
            LabelMessage.Text = "This group can not be deleted.It has been Locked";
            return;
        }
        else
        {
            string menuURL = "pg/assessment/section.aspx?soid=" + sectOID + "";
            //Delete from AnswerDetails and Question Table by SectionOID
            bool DeleteFromAnswerDetail=ansDetail.DeleteAnswerDetailBySectionOID(sectOID);
            Collection<Question> qList = new Collection<Question>();
            qList = ques.GetQuestionOIDBySectionOID(sectOID);
            foreach (Question q in qList )
            {
                qr.DeleteQuestionBySectionOID(q.QuestionOID);
            }
            bool DeleteFromQuestion = ques.DeleteQuestionBySectionOID(sectOID);
            bool DeleteFromMenu = menu.DeleteMenuByMenuURL(menuURL);
            bool DeleteFromSection = sec.DeleteSectionBySectionOID(sectOID);
            if (DeleteFromSection && DeleteFromMenu)
            {

                InitializeQuestion(sectOID);
                LabelMessage.Text = "This question group has been deleted successfully";
            }
            else
            {
                LabelMessage.Text = "This question group can not be deleted.Please try again..";
            }
            ButtonRefresh_Click(null, null);
        }
    }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     int sectOID;
     if (!Page.IsPostBack)
     {
         LabelMessage.Text = "";
         sectOID = Convert.ToInt32(Request.QueryString["soid"].ToString());
         Session["soid"] = sectOID;
         HiddenSectionID.Value = sectOID.ToString ();
         InitializeQuestion(sectOID);
         Sections sec = new Sections();
         Assessment ass = new Assessment();
         int AssOID = sec.GetAssessmentOIDBySectionOID(sectOID);
         if (ass.GetAssessmentStatusByOID(Convert.ToInt32(AssOID)) == 1)
         {
             HiddenAssessmentLocked.Value = "1";
         }
         else
         {
             HiddenAssessmentLocked.Value = "0";
         }
     }
     else
     {
        // sectOID=Convert.ToInt32(Session["soid"]);
         //InitializeQuestion(sectOID);
     }
 }