Пример #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);
        }
    }
Пример #2
0
    protected void ImageButtonLock_Click(object sender, ImageClickEventArgs e)
    {
        Assessment ass = new Assessment();
        GridViewRow row = ((ImageButton)sender).Parent.Parent as GridViewRow;
        HiddenField HiddenFieldAssessmentID = (HiddenField)row.Cells[0].FindControl("HiddenFieldAssessmentID");
        string OID = HiddenFieldAssessmentID.Value;
        if (ass.GetAssessmentStatusByOID(Convert.ToInt32(OID)) == 1)
        {
            PopulateGrid();
            lblStatus.Text = "This Assessment can not be Locked.It has already been Locked";
        }
        else
        {
            if (ass.UpdateAssessmentStatus(Convert.ToInt32(OID)))
            {
                PopulateGrid();
                lblStatus.Text = "This Assessment  has been locked Successfully";
            }

        }
    }
Пример #3
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);
     }
 }
Пример #4
0
    protected void ImageButtonDelete_Click(object sender, ImageClickEventArgs e)
    {
        Assessment ass = new Assessment();
        GridViewRow row = ((ImageButton)sender).Parent.Parent as GridViewRow;
        HiddenField HiddenFieldAssessmentID = (HiddenField)row.Cells[0].FindControl("HiddenFieldAssessmentID");
        string OID = HiddenFieldAssessmentID.Value;
        string AssessmentName = null;

        if (ass.GetAssessmentStatusByOID(Convert.ToInt32(OID)) == 1)
        {
            PopulateGrid();
            lblStatus.Text = "This Assessment can not be Deleted.It has been Locked";
            return;
        }

        if (OID != null && OID != "")
        {
            ass = ass.GetAssessmentByOID(Convert.ToInt32(OID));
            if (ass != null)
            {
                AssessmentName = ass.AssessmentName;
            }
        }
        if (ass.DisableAssessmentStatus(Convert.ToInt32(OID)))
        {

            CVTCMenu menu = new CVTCMenu();
            menu = menu.GetMenuByMenuName(AssessmentName);
            if (menu != null)
            {
                int MenuID = menu.MenuID;
                int parentID = menu.Parent;

                while (MenuID <= (menu.MenuID + 8))
                {
                    menu.DeleteMenuByParent(MenuID);
                    MenuID++;
                }
                menu.DeleteMenuByMenuID(menu.MenuID);
            }
            PopulateGrid();
            lblStatus.Text = "This Assessment has been deleted successfully";
        }
    }