public async Task<ActionResult> OrgCheck01(OrgCheck01ViewModel orgCheck01ViewModel)
        {
            ViewBag.LeftMenu = Global.Report;
            int questionSn = orgCheck01ViewModel.QuestionSn;

            if (orgCheck01ViewModel.QuestionSn > 0)
            {
                var quesMaster = await _quesMasterService.GetQuesOgranAnalysisAsync(questionSn);

                if (orgCheck01ViewModel.SubmitType == "N")
                {
                    quesMaster.SaveStatus = 17;
                }

                //기획관리
                var management = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "M");

                if (management == null)
                {
                    var QuesOgranAnalMgmt = Mapper.Map<QuesOgranAnalysis>(orgCheck01ViewModel.Management);
                    QuesOgranAnalMgmt.QuestionSn = questionSn;
                    QuesOgranAnalMgmt.DeptCd = "M";
                    QuesOgranAnalMgmt.RegDt = DateTime.Now;
                    QuesOgranAnalMgmt.RegId = Session[Global.LoginID].ToString();
                    quesMaster.QuesOgranAnalysis.Add(QuesOgranAnalMgmt);
                }
                else
                {
                    management.Dept1 = orgCheck01ViewModel.Management.Dept1;
                    management.Dept2 = orgCheck01ViewModel.Management.Dept2;
                    management.OfficerCount = orgCheck01ViewModel.Management.OfficerCount;
                    management.ChiefCount = orgCheck01ViewModel.Management.ChiefCount;
                    management.StaffCount = orgCheck01ViewModel.Management.StaffCount;
                    management.BeginnerCount = orgCheck01ViewModel.Management.BeginnerCount;
                    management.UpdDt = DateTime.Now;
                    management.UpdId = Session[Global.LoginID].ToString();
                }

                //생산관리
                var produce = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "P");

                if (produce == null)
                {
                    var QuesOgranAnalProd = Mapper.Map<QuesOgranAnalysis>(orgCheck01ViewModel.Produce);
                    QuesOgranAnalProd.QuestionSn = questionSn;
                    QuesOgranAnalProd.DeptCd = "P";
                    QuesOgranAnalProd.RegDt = DateTime.Now;
                    QuesOgranAnalProd.RegId = Session[Global.LoginID].ToString();
                    quesMaster.QuesOgranAnalysis.Add(QuesOgranAnalProd);
                }
                else
                {
                    produce.Dept1 = orgCheck01ViewModel.Produce.Dept1;
                    produce.Dept2 = orgCheck01ViewModel.Produce.Dept2;
                    produce.OfficerCount = orgCheck01ViewModel.Produce.OfficerCount;
                    produce.ChiefCount = orgCheck01ViewModel.Produce.ChiefCount;
                    produce.StaffCount = orgCheck01ViewModel.Produce.StaffCount;
                    produce.BeginnerCount = orgCheck01ViewModel.Produce.BeginnerCount;
                    produce.UpdDt = DateTime.Now;
                    produce.UpdId = Session[Global.LoginID].ToString();
                }

                //연구개발
                var rnd = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "R");

                if (rnd == null)
                {
                    var QuesOgranAnalRnd = Mapper.Map<QuesOgranAnalysis>(orgCheck01ViewModel.RND);
                    QuesOgranAnalRnd.QuestionSn = questionSn;
                    QuesOgranAnalRnd.DeptCd = "R";
                    QuesOgranAnalRnd.RegDt = DateTime.Now;
                    QuesOgranAnalRnd.RegId = Session[Global.LoginID].ToString();
                    quesMaster.QuesOgranAnalysis.Add(QuesOgranAnalRnd);
                }
                else
                {
                    rnd.Dept1 = orgCheck01ViewModel.RND.Dept1;
                    rnd.Dept2 = orgCheck01ViewModel.RND.Dept2;
                    rnd.OfficerCount = orgCheck01ViewModel.RND.OfficerCount;
                    rnd.ChiefCount = orgCheck01ViewModel.RND.ChiefCount;
                    rnd.StaffCount = orgCheck01ViewModel.RND.StaffCount;
                    rnd.BeginnerCount = orgCheck01ViewModel.RND.BeginnerCount;
                    rnd.UpdDt = DateTime.Now;
                    rnd.UpdId = Session[Global.LoginID].ToString();
                }

                //마케팅
                var salse = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "S");

                if (salse == null)
                {
                    var QuesOgranAnalSalse = Mapper.Map<QuesOgranAnalysis>(orgCheck01ViewModel.Salse);
                    QuesOgranAnalSalse.QuestionSn = questionSn;
                    QuesOgranAnalSalse.DeptCd = "S";
                    QuesOgranAnalSalse.RegDt = DateTime.Now;
                    QuesOgranAnalSalse.RegId = Session[Global.LoginID].ToString();
                    quesMaster.QuesOgranAnalysis.Add(QuesOgranAnalSalse);
                }
                else
                {
                    salse.Dept1 = orgCheck01ViewModel.Salse.Dept1;
                    salse.Dept2 = orgCheck01ViewModel.Salse.Dept2;
                    salse.OfficerCount = orgCheck01ViewModel.Salse.OfficerCount;
                    salse.ChiefCount = orgCheck01ViewModel.Salse.ChiefCount;
                    salse.StaffCount = orgCheck01ViewModel.Salse.StaffCount;
                    salse.BeginnerCount = orgCheck01ViewModel.Salse.BeginnerCount;
                    salse.UpdDt = DateTime.Now;
                    salse.UpdId = Session[Global.LoginID].ToString();
                }

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

            if (orgCheck01ViewModel.SubmitType == "T")
            {
                return RedirectToAction("OrgCheck01", "Report", new { @questionSn = questionSn });
            }
            else
            {
                return RedirectToAction("BasicSurveyComplete", "Report", new { @questionSn = questionSn });
            }
        }
        public async Task<ActionResult> OrgCheck01(string questionSn, string status)
        {
            ViewBag.LeftMenu = Global.Report;

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

            var orgCheck01 = new OrgCheck01ViewModel();

            // 조직구성 조회
            var quesMaster = await _quesMasterService.GetQuesOgranAnalysisAsync(int.Parse(questionSn));

            //기획관리
            var management = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "M");

            if (management == null)
            {
                orgCheck01.Management = new OrgCompositionViewModel();
            }
            else
            {
                orgCheck01.Management = Mapper.Map<OrgCompositionViewModel>(management);
            }

            //생산관리
            var produce = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "P");

            if (produce == null)
            {
                orgCheck01.Produce = new OrgCompositionViewModel();
            }
            else
            {
                orgCheck01.Produce = Mapper.Map<OrgCompositionViewModel>(produce);
            }

            //연구개발
            var rnd = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "R");

            if (rnd == null)
            {
                orgCheck01.RND = new OrgCompositionViewModel();
            }
            else
            {
                orgCheck01.RND = Mapper.Map<OrgCompositionViewModel>(rnd);
            }

            //마케팅
            var salse = quesMaster.QuesOgranAnalysis.SingleOrDefault(i => i.DeptCd == "S");

            if (salse == null)
            {
                orgCheck01.Salse = new OrgCompositionViewModel();
            }
            else
            {
                orgCheck01.Salse = Mapper.Map<OrgCompositionViewModel>(salse);
            }

            orgCheck01.StaffSumCount = orgCheck01.Management.StaffCount + orgCheck01.Produce.StaffCount + orgCheck01.RND.StaffCount + orgCheck01.Salse.StaffCount;

            orgCheck01.ChiefSumCount = orgCheck01.Management.ChiefCount + orgCheck01.Produce.ChiefCount + orgCheck01.RND.ChiefCount + orgCheck01.Salse.ChiefCount;

            orgCheck01.OfficerSumCount = orgCheck01.Management.OfficerCount + orgCheck01.Produce.OfficerCount + orgCheck01.RND.OfficerCount + orgCheck01.Salse.OfficerCount;

            orgCheck01.BeginnerSumCount = orgCheck01.Management.BeginnerCount + orgCheck01.Produce.BeginnerCount + orgCheck01.RND.BeginnerCount + orgCheck01.Salse.BeginnerCount;

            orgCheck01.TotalSumCount = orgCheck01.StaffSumCount + orgCheck01.ChiefSumCount + orgCheck01.OfficerSumCount + orgCheck01.BeginnerSumCount;

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