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

            if (bizCheck06ViewModel.QuestionSn > 0)
            {
                //인력의 비율, 연구개발 인력의 능력 저장 또는 업데이트 정보 설정
                var quesYearMaster = await _quesMasterService.GetQuesResult2Async(questionSn);

                if (bizCheck06ViewModel.SubmitType == "N")
                {
                    quesYearMaster.SaveStatus = 9;
                }

                //연구개발 인력수
                var yearRndItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.RndEmp.CheckListSn);
                if (yearRndItem == null)
                {
                    var quesYearRndEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.RndEmp);
                    quesYearRndEmp.QuestionSn = questionSn;
                    quesYearRndEmp.RegDt = DateTime.Now;
                    quesYearRndEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearRndEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearRndEmp);
                }
                else
                {
                    yearRndItem.D = bizCheck06ViewModel.RndEmp.D;
                    yearRndItem.D451 = bizCheck06ViewModel.RndEmp.D451;
                    yearRndItem.D452 = bizCheck06ViewModel.RndEmp.D452;
                    yearRndItem.D453 = bizCheck06ViewModel.RndEmp.D453;
                    yearRndItem.UpdDt = DateTime.Now;
                    yearRndItem.UpdId = Session[Global.LoginID].ToString();
                }


                //전체임직원수
                var yearTotalItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.TotalEmp.CheckListSn);
                if (yearTotalItem == null)
                {
                    var quesYearTotalEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.TotalEmp);
                    quesYearTotalEmp.QuestionSn = questionSn;
                    quesYearTotalEmp.RegDt = DateTime.Now;
                    quesYearTotalEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearTotalEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearTotalEmp);
                }
                else
                {
                    yearTotalItem.D = bizCheck06ViewModel.TotalEmp.D;
                    yearTotalItem.D451 = bizCheck06ViewModel.TotalEmp.D451;
                    yearTotalItem.D452 = bizCheck06ViewModel.TotalEmp.D452;
                    yearTotalItem.D453 = bizCheck06ViewModel.TotalEmp.D453;
                    yearTotalItem.UpdDt = DateTime.Now;
                    yearTotalItem.UpdId = Session[Global.LoginID].ToString();
                }

                //박사급
                var yearDoctorItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.DoctorEmp.CheckListSn);
                if (yearDoctorItem == null)
                {
                    var quesYearDoctorEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.DoctorEmp);
                    quesYearDoctorEmp.QuestionSn = questionSn;
                    quesYearDoctorEmp.RegDt = DateTime.Now;
                    quesYearDoctorEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearDoctorEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearDoctorEmp);
                }
                else
                {
                    yearDoctorItem.D = bizCheck06ViewModel.DoctorEmp.D;
                    yearDoctorItem.UpdDt = DateTime.Now;
                    yearDoctorItem.UpdId = Session[Global.LoginID].ToString();
                }

                //석사급
                var yearMasterItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.MasterEmp.CheckListSn);
                if (yearMasterItem == null)
                {
                    var quesYearMasterEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.MasterEmp);
                    quesYearMasterEmp.QuestionSn = questionSn;
                    quesYearMasterEmp.RegDt = DateTime.Now;
                    quesYearMasterEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearMasterEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearMasterEmp);
                }
                else
                {
                    yearMasterItem.D = bizCheck06ViewModel.MasterEmp.D;
                    yearMasterItem.UpdDt = DateTime.Now;
                    yearMasterItem.UpdId = Session[Global.LoginID].ToString();
                }

                //학사급
                var yearCollegeItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.CollegeEmp.CheckListSn);
                if (yearCollegeItem == null)
                {
                    var quesYearCollegeEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.CollegeEmp);
                    quesYearCollegeEmp.QuestionSn = questionSn;
                    quesYearCollegeEmp.RegDt = DateTime.Now;
                    quesYearCollegeEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearCollegeEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearCollegeEmp);
                }
                else
                {
                    yearCollegeItem.D = bizCheck06ViewModel.CollegeEmp.D;
                    yearCollegeItem.UpdDt = DateTime.Now;
                    yearCollegeItem.UpdId = Session[Global.LoginID].ToString();
                }

                //기능사급
                var yearTechItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.TechEmp.CheckListSn);
                if (yearTechItem == null)
                {
                    var quesYearTechEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.TechEmp);
                    quesYearTechEmp.QuestionSn = questionSn;
                    quesYearTechEmp.RegDt = DateTime.Now;
                    quesYearTechEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearTechEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearTechEmp);
                }
                else
                {
                    yearTechItem.D = bizCheck06ViewModel.TechEmp.D;
                    yearTechItem.UpdDt = DateTime.Now;
                    yearTechItem.UpdId = Session[Global.LoginID].ToString();
                }

                //고졸이하
                var yearHighItem = quesYearMaster.QuesResult2.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == bizCheck06ViewModel.HighEmp.CheckListSn);
                if (yearHighItem == null)
                {
                    var quesYearHighEmp = Mapper.Map<QuesResult2>(bizCheck06ViewModel.HighEmp);
                    quesYearHighEmp.QuestionSn = questionSn;
                    quesYearHighEmp.RegDt = DateTime.Now;
                    quesYearHighEmp.RegId = Session[Global.LoginID].ToString();
                    quesYearHighEmp.BasicYear = quesYearMaster.BasicYear;
                    quesYearMaster.QuesResult2.Add(quesYearHighEmp);
                }
                else
                {
                    yearHighItem.D = bizCheck06ViewModel.HighEmp.D;
                    yearHighItem.UpdDt = DateTime.Now;
                    yearHighItem.UpdId = Session[Global.LoginID].ToString();
                }

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

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

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

            var bizCheck06 = new BizCheck06ViewModel();

            //인력의 비율
            var quesResult2sEmpRate = await _quesResult2Service.GetQuesResult2sAsync(int.Parse(questionSn), "A1B102");

            if (quesResult2sEmpRate.Count() != 2)
            {
                var quesCheckList = await _quesCheckListService.GetQuesCheckListAsync("A1B102");
                var quesYearListView = Mapper.Map<List<QuesYearListViewModel>>(quesCheckList);

                foreach (var item in quesYearListView)
                {
                    item.QuestionSn = int.Parse(questionSn);
                    item.BasicYear = DateTime.Now.Year;
                    item.D = "0";
                    item.D451 = "0";
                    item.D452 = "0";
                    item.D453 = "0";
                }
                //전체임직원수
                bizCheck06.TotalEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10202");
                //연구개발인력
                bizCheck06.RndEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10201");
            }
            else
            {
                var quesYearListView = Mapper.Map<List<QuesYearListViewModel>>(quesResult2sEmpRate);
                //전체임직원수
                bizCheck06.TotalEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10202");
                //연구개발인력
                bizCheck06.RndEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10201");
            }

            //연구개발 인력의 능력
            var quesResult2sEmpCapa = await _quesResult2Service.GetQuesResult2sAsync(int.Parse(questionSn), "A1B103");

            if (quesResult2sEmpCapa.Count() != 5)
            {
                var quesCheckList = await _quesCheckListService.GetQuesCheckListAsync("A1B103");
                var quesYearListView = Mapper.Map<List<QuesYearListViewModel>>(quesCheckList);

                foreach (var item in quesYearListView)
                {
                    item.QuestionSn = int.Parse(questionSn);
                    item.BasicYear = DateTime.Now.Year;
                    item.D = "0";
                    item.D451 = "0";
                    item.D452 = "0";
                    item.D453 = "0";
                }
                //박사급
                bizCheck06.DoctorEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10301");
                //석사급
                bizCheck06.MasterEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10302");
                //학사급
                bizCheck06.CollegeEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10303");
                //기능사급
                bizCheck06.TechEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10304");
                //고졸이하급
                bizCheck06.HighEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10305");
            }
            else
            {
                var quesYearListView = Mapper.Map<List<QuesYearListViewModel>>(quesResult2sEmpCapa);
                //박사급
                bizCheck06.DoctorEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10301");
                //석사급
                bizCheck06.MasterEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10302");
                //학사급
                bizCheck06.CollegeEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10303");
                //기능사급
                bizCheck06.TechEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10304");
                //고졸이하급
                bizCheck06.HighEmp = quesYearListView.SingleOrDefault(i => i.DetailCd == "A1B10305");
            }

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