Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            Model_AssesIntro ai = AssessmentController.GetAssIntro();
            txtIntroTitle.Text   = ai.Title;
            txtIntroContent.Text = ai.Description;
            LastTitle.Text       = ai.LastTitle;
            LastDes.Text         = ai.LastDes;
            MainTitle.Text       = ai.MainTitle;

            ThanksTitle.Text     = ai.ThanksTitle;
            ThanksDes.Text       = ai.ThanksDes;
            ProfileTitle.Text    = ai.ProfileTitle;
            ProfileCJFTitle.Text = ai.ProfileCJFTitle;
            ProfileFCTitle.Text  = ai.ProfileFCTitle;



            List <Model_AsSection> seclist = AssessmentController.GetSectionList(true);
            dropSection.DataSource     = seclist;
            dropSection.DataTextField  = "Title";
            dropSection.DataValueField = "SCID";
            dropSection.DataBind();

            dropsection2.DataSource     = seclist;
            dropsection2.DataTextField  = "Title";
            dropsection2.DataValueField = "SCID";
            dropsection2.DataBind();

            dropsection_1.DataSource     = seclist;
            dropsection_1.DataTextField  = "Title";
            dropsection_1.DataValueField = "SCID";
            dropsection_1.DataBind();


            dropsection2_2.DataSource     = seclist;
            dropsection2_2.DataTextField  = "Title";
            dropsection2_2.DataValueField = "SCID";
            dropsection2_2.DataBind();

            ListItem lis = new ListItem("All", "0");
            dropsection2.Items.Insert(0, lis);


            dropsection2_2.Items.Insert(0, lis);

            if (!string.IsNullOrEmpty(Request.QueryString["section"]))
            {
                add_section.Visible = true;
                int             id  = int.Parse(Request.QueryString["section"]);
                Model_AsSection sec = AssessmentController.getSectionByID(id);
                SectionTitle.Text         = sec.Title;
                txtCode.Text              = sec.Code;
                txtintro.Text             = sec.Intro;
                status.SelectedValue      = sec.Status.ToString();
                txtpri.Text               = sec.Priority.ToString();
                headsection_pan.InnerHtml = "Edit Section";
            }

            if (!string.IsNullOrEmpty(Request.QueryString["subsection"]))
            {
                sub_pan.Visible = true;
                int subid = int.Parse(Request.QueryString["subsection"]);
                Model_AsSubSection sub = AssessmentController.getSubByID(subid);
                dropSection.SelectedValue = sub.SCID.ToString();
                txtSubTitle.Text          = sub.Title;

                string comret = string.Empty;
                if (!string.IsNullOrEmpty(sub.Combind))
                {
                    string[] arrcom = sub.Combind.Split(',');
                    comret = string.Join(",", arrcom.Select(i => "SU" + i).ToArray());
                }

                Combind.Text        = comret;
                radioSubStatus.Text = sub.Status.ToString();


                headsection_pan1.InnerHtml = "Edit Sub Section";
            }

            if (!string.IsNullOrEmpty(Request.QueryString["subsection2"]))
            {
                sub_pan2.Visible = true;
                int subid = int.Parse(Request.QueryString["subsection2"]);
                Model_AsSubSection2 sub = AssessmentController.getSubByID2(subid);
                dropsection_1.SelectedValue = sub.SCID.ToString();
                txtSubTitle2.Text           = sub.Title;

                string comret = string.Empty;
                if (!string.IsNullOrEmpty(sub.Combind))
                {
                    string[] arrcom = sub.Combind.Split(',');
                    comret = string.Join(",", arrcom.Select(i => "SU" + i).ToArray());
                }

                Combind2.Text        = comret;
                radioSubStatus2.Text = sub.Status.ToString();


                headsection_pan1.InnerHtml = "Edit Sub Section";
            }

            if (!string.IsNullOrEmpty(Request.QueryString["qt"]))
            {
                qType_pan.Visible = true;
                byte        subid = byte.Parse(Request.QueryString["qt"]);
                Model_QType q     = AssessmentController.GetQtypeID(subid);
                txtQtitle.Text        = q.Title;
                qstatus.SelectedValue = q.Status.ToString();

                headsection_pan1.InnerHtml = "Edit Question Type";
            }
        }


        if (!string.IsNullOrEmpty(Request.QueryString["tab"]))
        {
            string tab = Request.QueryString["tab"];

            switch (tab)
            {
            case "2":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "true");
                tab3.Attributes.Add("aria-expanded", "false");
                tab4.Attributes.Add("aria-expanded", "false");
                tab5.Attributes.Add("aria-expanded", "false");

                li_tab1.Attributes.Remove("class");
                li_tab2.Attributes.Add("class", "active");
                li_tab3.Attributes.Remove("class");
                li_tab4.Attributes.Remove("class");
                li_tab5.Attributes.Remove("class");


                tab_content1.Visible = false;
                tab_content2.Visible = true;
                tab_content3.Visible = false;
                tab_content4.Visible = false;
                tab_content5.Visible = false;


                if (!string.IsNullOrEmpty(Request.QueryString["section"]))
                {
                    //dropsection2.SelectedValue = Request.QueryString["section"];
                }



                break;

            case "3":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "false");
                tab3.Attributes.Add("aria-expanded", "true");
                tab4.Attributes.Add("aria-expanded", "false");
                tab5.Attributes.Add("aria-expanded", "false");

                li_tab1.Attributes.Remove("class");
                li_tab2.Attributes.Remove("class");
                li_tab3.Attributes.Add("class", "active");
                li_tab4.Attributes.Remove("class");
                li_tab5.Attributes.Remove("class");

                tab_content1.Visible = false;
                tab_content2.Visible = false;
                tab_content3.Visible = true;
                tab_content4.Visible = false;
                tab_content5.Visible = false;


                break;

            case "4":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "false");
                tab3.Attributes.Add("aria-expanded", "false");
                tab4.Attributes.Add("aria-expanded", "true");
                tab4.Attributes.Add("aria-expanded", "false");

                li_tab1.Attributes.Remove("class");
                li_tab2.Attributes.Remove("class");
                li_tab3.Attributes.Remove("class");
                li_tab4.Attributes.Add("class", "active");
                li_tab5.Attributes.Remove("class");

                tab_content1.Visible = false;
                tab_content2.Visible = false;
                tab_content3.Visible = false;
                tab_content4.Visible = true;
                tab_content5.Visible = false;



                break;

            case "5":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "false");
                tab3.Attributes.Add("aria-expanded", "false");
                tab4.Attributes.Add("aria-expanded", "false");
                tab5.Attributes.Add("aria-expanded", "true");

                li_tab1.Attributes.Remove("class");
                li_tab2.Attributes.Remove("class");
                li_tab3.Attributes.Remove("class");
                li_tab4.Attributes.Remove("class");
                li_tab5.Attributes.Add("class", "active");

                tab_content1.Visible = false;
                tab_content2.Visible = false;
                tab_content3.Visible = false;
                tab_content4.Visible = false;
                tab_content5.Visible = true;

                if (!string.IsNullOrEmpty(Request.QueryString["section"]))
                {
                    // dropsection2_2.SelectedValue = Request.QueryString["section"];
                }

                break;
            }
        }
        else
        {
            tab_content1.Visible = true;
            tab_content2.Visible = false;
            tab_content3.Visible = false;
            tab_content4.Visible = false;

            tab1.Attributes.Add("aria-expanded", "true");
            tab2.Attributes.Add("aria-expanded", "false");
            tab3.Attributes.Add("aria-expanded", "false");
            tab4.Attributes.Add("aria-expanded", "false");

            li_tab1.Attributes.Add("class", "active");
            li_tab2.Attributes.Remove("class");
            li_tab3.Attributes.Remove("class");
            li_tab4.Attributes.Remove("class");
        }
    }