Beispiel #1
0
        public ActionResult AddInEngageNine(int page, string sid)
        {
            //p คือ page หน้าที่ผู้ใช้ทำงานอยู่
            GetChoice_topiccomment();
            bool b1 = string.IsNullOrEmpty(sid);

            if (sid == string.Empty || b1 == true)
            {
                return(HttpNotFound());
            }
            if (page != 501)
            {
                return(HttpNotFound());
            }
            int[] code             = GetCode(sid);
            int   codeinvalid      = 2;
            int   endofTest        = 0;
            int   chkSection       = 0;
            int   sectionParameter = 10;

            endofTest   = code[0];
            codeinvalid = code[0];

            var engageid = code[1];

            if (page == null)
            {
                return(HttpNotFound());
            }
            var currentUrl = string.Empty;
            var fullUrl    = this.Url.Action("AddInEngageNine", "AddEngagementEN", null, this.Request.Url.Scheme);

            currentUrl = GetUrl(engageid);
            if (currentUrl == string.Empty)
            {
                SaveCurrentUrl(fullUrl, engageid);
            }
            else
            {
                //update url
                updateUrl(fullUrl, engageid);
            }
            if (codeinvalid == 2)
            {
                return(HttpNotFound());
            }
            chkSection = chkInputData(engageid, 10);
            List <TB_Question> questionName = db.TB_Question.Where(x => x.Section == 3).ToList();

            var viewModel = new questionchoiceViewModel();

            viewModel.questionDetail    = questionName;
            viewModel.Section           = chkSection;
            viewModel.passSection       = sectionParameter;
            viewModel.StatusAccept      = endofTest;
            viewModel.engagepersonal_ID = engageid;
            viewModel.Encript_ID        = sid;

            return(View(viewModel));
        }
        public ActionResult AddInEngageFirst(int page, string sid)
        {
            //p คือ page หน้าที่ผู้ใช้ทำงานอยู่
            bool b1 = string.IsNullOrEmpty(sid);

            if (sid == string.Empty || b1 == true)
            {
                return(HttpNotFound());
            }
            if (page != 60)
            {
                return(HttpNotFound());
            }
            int[] code        = GetCode(sid);
            int   codeinvalid = 2;
            int   endofTest   = 0;

            endofTest   = code[0];
            codeinvalid = code[0];
            int chkSection = 0;
            var engageid   = code[1];
            var currentUrl = string.Empty;
            var fullUrl    = this.Url.Action("AddInEngageFirst", "AddEngagement", null, this.Request.Url.Scheme);

            currentUrl = GetUrl(engageid);
            if (currentUrl == string.Empty)
            {
                SaveCurrentUrl(fullUrl, engageid);
            }
            else
            {
                updateUrl(fullUrl, engageid);
            }
            if (page == null)
            {
                return(HttpNotFound());
            }

            if (codeinvalid == 2)
            {
                return(HttpNotFound());
            }
            chkSection = chkInputData(engageid, 2);
            List <TB_Question> questionName = db.TB_Question.Where(x => x.Section == 2).ToList();
            List <TB_Choice>   choiceName   = db.TB_Choice.Where(c => c.Question_ID == 9).ToList();

            var viewModel = new questionchoiceViewModel();

            viewModel.questionDetail    = questionName;
            viewModel.choiceDetail      = choiceName;
            viewModel.Section           = chkSection;
            viewModel.StatusAccept      = endofTest;
            viewModel.engagepersonal_ID = engageid;
            viewModel.Encript_ID        = sid;

            return(View(viewModel));
        }