Ejemplo n.º 1
0
        public async Task<ActionResult> BizCheck05(BizCheck05ViewModel bizCheck05ViewModel)
        {
            ViewBag.LeftMenu = Global.Report;
            int questionSn = bizCheck05ViewModel.QuestionSn;

            if (bizCheck05ViewModel.QuestionSn > 0)
            {
                var quesMaster = await _quesMasterService.GetQuesResult1Async(questionSn);

                if (bizCheck05ViewModel.SubmitType == "N")
                {
                    quesMaster.SaveStatus = 8;
                }

                foreach (var item in bizCheck05ViewModel.InfoSystem)
                {
                    var checkItem = quesMaster.QuesResult1.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == item.CheckListSn);
                    if (checkItem == null)
                    {
                        var result1 = new QuesResult1();
                        result1.QuestionSn = questionSn;
                        result1.CheckListSn = item.CheckListSn;
                        result1.AnsVal = item.AnsVal;
                        result1.RegDt = DateTime.Now;
                        result1.RegId = Session[Global.LoginID].ToString();
                        quesMaster.QuesResult1.Add(result1);
                    }
                    else
                    {
                        checkItem.AnsVal = item.AnsVal;
                        checkItem.UpdDt = DateTime.Now;
                        checkItem.UpdId = Session[Global.LoginID].ToString();
                    }
                }

                await _quesMasterService.SaveDbContextAsync();
            }
            else
            {
                //에러처리 필요
                return View(bizCheck05ViewModel);
            }

            if (bizCheck05ViewModel.SubmitType == "T")
            {
                return RedirectToAction("BizCheck05", "Report", new { @questionSn = questionSn });
            }
            else
            {
                return RedirectToAction("BizCheck06", "Report", new { @questionSn = questionSn });
            }
        }
Ejemplo n.º 2
0
        public async Task<ActionResult> BizCheck05(string questionSn, string status)
        {
            ViewBag.LeftMenu = Global.Report;

            if (string.IsNullOrEmpty(questionSn))
            {
                // 오류 처리해야함.
                return View();
            }

            var bizCheck05 = new BizCheck05ViewModel();

            // A1A203 : 정보시스템 활용
            var quesResult1s = await _quesResult1Service.GetQuesResult1sAsync(int.Parse(questionSn), "A1A203");

            if (quesResult1s.Count() != 6)
            {
                var quesCheckList = await _quesCheckListService.GetQuesCheckListAsync("A1A203");
                var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesCheckList);

                foreach (var item in quesCheckListView)
                {
                    item.QuestionSn = int.Parse(questionSn);
                    item.AnsVal = false;
                }

                bizCheck05.InfoSystem = quesCheckListView;
            }
            else
            {
                var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesResult1s);
                bizCheck05.InfoSystem = quesCheckListView;
            }

            bizCheck05.Status = status;
            bizCheck05.QuestionSn = int.Parse(questionSn);
            return View(bizCheck05);
        }