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

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

                if (bizCheck12ViewModel.SubmitType == "N")
                {
                    quesMaster.SaveStatus = 15;
                }

                // A1D101 : 인적자윈의 확보와 개발관리
                foreach (var item in bizCheck12ViewModel.HRMng)
                {
                    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();
                    }
                }


                // A1D102 : 이적자원의 보상 및 유지관리
                foreach (var item in bizCheck12ViewModel.HRMaintenance)
                {
                    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(bizCheck12ViewModel);
            }

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

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

            var bizCheck12 = new BizCheck12ViewModel();

            // A1D101 : 인적자윈의 확보와 개발관리
            var quesResult1s = await _quesResult1Service.GetQuesResult1sAsync(int.Parse(questionSn), "A1D101");

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

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

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

            // A1D102 : 이적자원의 보상 및 유지관리
            var quesResult1sMaintenance = await _quesResult1Service.GetQuesResult1sAsync(int.Parse(questionSn), "A1D102");

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

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

                bizCheck12.HRMaintenance = quesCheckListView;
            }
            else
            {
                var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesResult1sMaintenance);
                bizCheck12.HRMaintenance = quesCheckListView;
            }

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