public async Task <ActionResult> RegMentoringReport(MentoringReportViewModel dataRequestViewModel, IEnumerable <HttpPostedFileBase> files)
        {
            ViewBag.naviLeftMenu = Global.MentoringReport;

            var mentorId = Session[Global.LoginID].ToString();

            SqlParameter loginId = new SqlParameter("LOGIN_ID", Session[Global.LoginID]); // sql 파라미터 값 설정

            object[] parameters = new object[] { loginId };                               // 객체에 데이터 삽입

            var obj = await procMngService.getCompMapping(parameters);                    // 해당 기업과 관련된 리스트데이터 가져오기

            var usrViews = Mapper.Map <List <MentoringReportViewModel> >(obj);

            //if (ModelState.IsValid)
            //{
            var scMentoringReport = Mapper.Map <ScMentoringReport>(dataRequestViewModel);

            //var comp = usrViews[0].CompSn;

            scMentoringReport.MentorId = mentorId;
            scMentoringReport.RegId    = mentorId;
            scMentoringReport.RegDt    = DateTime.Now;
            scMentoringReport.Status   = "N";
            scMentoringReport.CompSn   = scMentoringReport.CompSn;

            var compInfo = await _vcCompInfoService.getVcCompInfoByCompSn(scMentoringReport.CompSn ?? default(int));


            // ConCode, NumSn, SubNumSn 자동 할당

            // MentorId로 해당 기업의 num_sn, sub_num_sn을 가져온다
            SqlParameter compSn2  = new SqlParameter("COMP_SN", scMentoringReport.CompSn);
            SqlParameter loginId2 = new SqlParameter("LOGIN_ID", Session[Global.LoginID].ToString());

            object[] parameters2 = new object[] { compSn2, loginId2 };

            var compList = await procMngService.getMentorCompNumSn(parameters2);

            var mentorLoginKey = Session[Global.LoginID].ToString();
            var mentorInfo     = await _vcUsrService.getMentorInfoById(mentorLoginKey);

            var baSn = mentorInfo.BaSn;

            //var conCodeInfo = await _vcMentorMappingService.getConcodeInfo(dataRequestViewModel.CompSn, baSn, mentorInfo.MentorSn, compList[0].NUM_SN, compList[0].SUB_NUM_SN);
            scMentoringReport.NumSn    = compList[0].NUM_SN;
            scMentoringReport.SubNumSn = compList[0].SUB_NUM_SN;
            scMentoringReport.ConCode  = compList[0].CON_CODE;

            //첨부파일
            if (files != null)
            {
                var fileHelper = new FileHelper();
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        //var compSn = usrViews[cnt].CompSn;

                        var savedFileName = fileHelper.GetUploadFileName(file);

                        var subDirectoryPath = Path.Combine(FileType.Mentoring_Report.ToString(), DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString());

                        var savedFilePath = Path.Combine(subDirectoryPath, savedFileName);

                        var tcmsLoginKey    = Session[Global.LoginID].ToString();
                        var tcmsLoginKeyCon = int.Parse(tcmsLoginKey);

                        var mentorUsrInfo = await _vcUsrService.getUsrInfoByTcmsKey(tcmsLoginKeyCon);

                        var mentorIdInfo = mentorUsrInfo.LoginId;

                        var scFileInfo = new ScFileInfo {
                            FileNm = Path.GetFileName(file.FileName), FilePath = savedFilePath, Status = "N", RegId = mentorIdInfo, RegDt = DateTime.Now
                        };

                        var scMentoringFileInfo = new ScMentoringFileInfo {
                            ScFileInfo = scFileInfo
                        };

                        //파일타입에 따라 재정의해서 넣어야 함(첨부파일, 사진)
                        scMentoringFileInfo.Classify = fileHelper.HasImageFile(file) ? "P" : "A";

                        scMentoringReport.RegId    = mentorIdInfo;
                        scMentoringReport.MentorId = mentorIdInfo;

                        scMentoringReport.ScMentoringFileInfoes.Add(scMentoringFileInfo);

                        await fileHelper.UploadFile(file, subDirectoryPath, savedFileName);
                    }
                }
            }

            //저장
            int result = await _scMentoringReportService.AddScMentoringReportAsync(scMentoringReport);

            if (result != -1)
            {
                return(RedirectToAction("MentoringReportList", "MentoringReport"));
            }
            else
            {
                ModelState.AddModelError("", "자료요청 등록 실패.");
                return(View(dataRequestViewModel));
            }
            // }
            //ModelState.AddModelError("", "입력값 검증 실패.");
            //return View(dataRequestViewModel);
        }
        //public async Task<ActionResult> MentoringTotalReportList(SelectedMentorTotalReportParmModel param, string curPage)
        //{
        //    ViewBag.LeftMenu = Global.MentoringReport;

        //    var mentorId = Session[Global.LoginID].ToString();

        //    //사업 DropDown List Data
        //    var bizWorkDropDown = await MakeBizWork(mentorId, param.BizWorkYear);
        //    SelectList bizList = new SelectList(bizWorkDropDown, "BizWorkSn", "BizWorkNm");
        //    ViewBag.SelectBizWorkList = bizList;

        //    //기업 DropDwon List Data
        //    var compInfoDropDown = await MakeBizComp(mentorId, param.BizWorkSn, param.BizWorkYear);
        //    SelectList compInfoList = new SelectList(compInfoDropDown, "CompSn", "CompNm");
        //    ViewBag.SelectCompInfoList = compInfoList;

        //    //사업년도 DownDown List Data
        //    var bizWorkYearDropDown = MakeBizYear(2015);
        //    SelectList bizWorkYear = new SelectList(bizWorkYearDropDown, "Value", "Text");
        //    ViewBag.SelectBizWorkYearList = bizWorkYear;

        //    //검색조건을 유지하기 위한
        //    ViewBag.SelectParam = param;

        //    //실제 쿼리
        //    int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);

        //    var pagedListscMentoringTotalReport = await _scMentoringTotalReportService.GetPagedListMentoringTotalReportAsync(int.Parse(curPage ?? "1"), pagingSize, mentorId, param.BizWorkYear, param.BizWorkSn, param.CompSn);

        //    //맨토링 종합 레포트 정보 조회
        //    var listTotalReportView =
        //       Mapper.Map<List<MentoringTotalReportViewModel>>(pagedListscMentoringTotalReport);

        //    return View(new StaticPagedList<MentoringTotalReportViewModel>(listTotalReportView, int.Parse(curPage ?? "1"), pagingSize, pagedListscMentoringTotalReport.TotalItemCount));

        //}
        //#endregion


        #region 멘토 일지
        public async Task <ActionResult> MentoringReportList(SelectedMentorReportParmModel param, string curPage)
        {
            ViewBag.naviLeftMenu = Global.MentoringReport;

            var mentorLoginKey = Session[Global.LoginID].ToString(); // 로그인 키다

            var mentorIdObj = await _vcUsrService.getUsrInfoByTcmsKey(int.Parse(mentorLoginKey));

            var mentorId = mentorIdObj.LoginId;
            // 추가...
            var scMentoringReportObj = await _scMentoringReportService.getMentoringReportListById(mentorId);

            if (scMentoringReportObj.Count > 0)
            {
                var viewObj = Mapper.Map <List <MentoringReportViewModel> >(scMentoringReportObj);

                foreach (var vObj in viewObj)
                {
                    var compNmObj = await _vcCompInfoService.getVcCompInfoByCompSn(vObj.CompSn);

                    vObj.CompNm = compNmObj.CompNm;
                }

                ViewBag.SelectParam = param;

                //맨토링 일지 정보 조회
                int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
                //var pagedListscMentoringReport = await _scMentoringReportService.GetPagedListMentoringReportAsync(int.Parse(curPage ?? "1"), pagingSize, mentorId, param.BizWorkYear, param.BizWorkSn, param.CompSn);

                return(View(new StaticPagedList <MentoringReportViewModel>(viewObj, int.Parse(curPage ?? "1"), pagingSize, viewObj.Count)));
            }
            else
            {
                return(View());
            }

            //// 추가 블록 끝...
            //SqlParameter loginId = new SqlParameter("LOGIN_ID", Session[Global.LoginID].ToString());
            //object[] parameters = new object[] { loginId };
            //var compList = await procMngService.getCompMapping(parameters);

            //// 기업명 List
            //var compDropDown = Mapper.Map<List<MentoringReportViewModel>>(compList);

            //MentoringReportViewModel title = new MentoringReportViewModel();
            //title.CompSn = 0;
            //title.CompNm = "기업 선택";
            //compDropDown.Insert(0, title);

            //SelectList compListSelect = new SelectList(compDropDown, "CompSn", "CompNm");

            //ViewBag.SelectCompList = compListSelect;


            //// 매핑 되어있지 않은 Mentor는 compSn이 없기때문에 우선은 단순 View만 보여줌
            //if(compList.Count > 0)
            //{
            //    List<ProcMentorGetMentoringReportReturnModel> ieList = new List<ProcMentorGetMentoringReportReturnModel>();
            //    foreach (var compEach in compList)
            //    {
            //        SqlParameter loginId2 = new SqlParameter("LOGIN_ID", Session[Global.LoginID].ToString());
            //        SqlParameter compSn = new SqlParameter("COMP_SN", compEach.COMP_SN);
            //        object[] parameters2 = new object[] { loginId2, compSn };
            //        var compSnList = await procMngService.getMentoringReport(parameters2);
            //        foreach (var obj in compSnList)
            //        {
            //            ieList.Add(obj);
            //        }
            //    }

            //    var mentoringList = ieList;

            //    var listTotalReportView = Mapper.Map<List<MentoringReportViewModel>>(mentoringList);
            //    // MENTOR_ID, COMP_SN을 추출하여 해당 파일 LIST 조회
            //    //SqlParameter loginId2 = new SqlParameter("LOGIN_ID", Session[Global.LoginID].ToString());
            //    //SqlParameter compSn = new SqlParameter("COMP_SN", compList[0].COMP_SN);
            //    //object[] parameters2 = new object[] { loginId2, compSn };
            //    //var compSnList = await procMngService.getMentoringReport(parameters2);
            //    //var mentoringList = compSnList.Where(bw => bw.CLASSIFY == "A");

            //    //var listTotalReportView = Mapper.Map<List<MentoringReportViewModel>>(mentoringList);

            //    //검색조건을 유지하기 위한+
            //    ViewBag.SelectParam = param;

            //    //맨토링 일지 정보 조회
            //    int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
            //    //var pagedListscMentoringReport = await _scMentoringReportService.GetPagedListMentoringReportAsync(int.Parse(curPage ?? "1"), pagingSize, mentorId, param.BizWorkYear, param.BizWorkSn, param.CompSn);

            //    return View(new StaticPagedList<MentoringReportViewModel>(listTotalReportView, int.Parse(curPage ?? "1"), pagingSize, listTotalReportView.Count));

            //}
            //else
            //{
            //    return View();
            //}
        }
        //[HttpPost]
        //public async Task<ActionResult> MentorList(string BizWorkList, string MentorPartList, string curPage)
        //{
        //    ViewBag.LeftMenu = Global.MentorMng;

        //    string excutorId = null;

        //    //사업담당자 일 경우 담당 사업만 조회
        //    if (Session[Global.UserDetailType].ToString() == "M")
        //    {
        //        excutorId = Session[Global.LoginID].ToString();
        //    }
        //    //사업 DropDown List Data
        //    var listScBizWork = await _scBizWorkService.GetBizWorkList(int.Parse(Session[Global.CompSN].ToString()), excutorId);


        //    var bizWorkDropDown =
        //        Mapper.Map<List<BizWorkDropDownModel>>(listScBizWork);

        //    //사업담당자 일 경우 담당 사업만 조회
        //    if (Session[Global.UserDetailType].ToString() == "M")
        //    {
        //        BizWorkList = listScBizWork.First().BizWorkSn.ToString();
        //    }
        //    else
        //    {
        //        BizWorkDropDownModel title = new BizWorkDropDownModel();
        //        title.BizWorkSn = 0;
        //        title.BizWorkNm = "사업명 선택";
        //        bizWorkDropDown.Insert(0, title);
        //    }

        //    SelectList bizList = new SelectList(bizWorkDropDown, "BizWorkSn", "BizWorkNm");

        //    ViewBag.SelectBizWorkList = bizList;


        //    //멘토 분야 DropDown List Data
        //    var mentorPart = new List<SelectListItem>(){
        //        new SelectListItem { Value = "", Text = "멘토분야", Selected = true },
        //        new SelectListItem { Value = "F", Text = "자금" },
        //        new SelectListItem { Value = "D", Text = "기술개발" },
        //        new SelectListItem { Value = "T", Text = "세무회계" },
        //        new SelectListItem { Value = "L", Text = "법무" },
        //        new SelectListItem { Value = "W", Text = "노무" },
        //        new SelectListItem { Value = "P", Text = "특허" },
        //        new SelectListItem { Value = "M", Text = "마케팅" },
        //        new SelectListItem { Value = "E", Text = "기타" }
        //    };

        //    SelectList mentorPartList = new SelectList(mentorPart, "Value", "Text");

        //    ViewBag.SelectMentorPartList = mentorPartList;

        //    //전문가 리스트 조회
        //    var listMentor = await _scMentorMappingService.GetMentorListAsync(int.Parse(Session[Global.CompSN].ToString()), int.Parse(BizWorkList), MentorPartList);

        //    var usrViews =
        //        Mapper.Map<List<JoinMentorViewModel>>(listMentor);

        //    int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
        //    return View(new StaticPagedList<JoinMentorViewModel>(usrViews.ToPagedList(int.Parse(curPage), pagingSize), int.Parse(curPage), pagingSize, usrViews.Count));

        //}

        //public async Task<ActionResult> RegMentor()
        //{
        //    ViewBag.LeftMenu = Global.MentorMng;

        //    string excutorId = null;

        //    //사업담당자 일 경우 담당 사업만 조회
        //    if (Session[Global.UserDetailType].ToString() == "M")
        //    {
        //        excutorId = Session[Global.LoginID].ToString();
        //    }

        //    //사업 DropDown List Data
        //    var listScBizWork = await _scBizWorkService.GetBizWorkList(int.Parse(Session[Global.CompSN].ToString()), excutorId);


        //    var bizWorkDropDown =
        //        Mapper.Map<List<BizWorkDropDownModel>>(listScBizWork);

        //    if (Session[Global.UserDetailType].ToString() == "A")
        //    {
        //        BizWorkDropDownModel title = new BizWorkDropDownModel();
        //        title.BizWorkSn = 0;
        //        title.BizWorkNm = "사업명 선택";
        //        bizWorkDropDown.Insert(0, title);
        //    }

        //    SelectList bizList = new SelectList(bizWorkDropDown, "BizWorkSn", "BizWorkNm");

        //    ViewBag.SelectBizWorkList = bizList;
        //    return View();
        //}

        //[HttpPost]
        //public async Task<ActionResult> RegMentor(JoinMentorViewModel joinMentorViewModel)
        //{
        //    ViewBag.LeftMenu = Global.MentorMng;

        //    string excutorId = null;

        //    //사업담당자 일 경우 담당 사업만 조회
        //    if (Session[Global.UserDetailType].ToString() == "M")
        //    {
        //        excutorId = Session[Global.LoginID].ToString();
        //    }
        //    //사업 DropDown List Data
        //    var listScBizWork = await _scBizWorkService.GetBizWorkList(int.Parse(Session[Global.CompSN].ToString()), excutorId);


        //    var bizWorkDropDown =
        //        Mapper.Map<List<BizWorkDropDownModel>>(listScBizWork);

        //    if (Session[Global.UserDetailType].ToString() == "A")
        //    {
        //        BizWorkDropDownModel title = new BizWorkDropDownModel();
        //        title.BizWorkSn = 0;
        //        title.BizWorkNm = "사업명 선택";
        //        bizWorkDropDown.Insert(0, title);
        //    }

        //    SelectList bizList = new SelectList(bizWorkDropDown, "BizWorkSn", "BizWorkNm");

        //    ViewBag.SelectBizWorkList = bizList;


        //    if (ModelState.IsValid == false)
        //    {
        //        if (joinMentorViewModel.BizWorkSn == 0)
        //        {
        //            ModelState.AddModelError("", "사업명을 선택하지 않았습니다.");
        //            return View(joinMentorViewModel);
        //        }

        //        var scUsr = Mapper.Map<VcUsrInfo>(joinMentorViewModel);
        //        var scCompInfo = Mapper.Map<VcCompInfo>(joinMentorViewModel);

        //        //회원정보 추가 정보 설정
        //        scUsr.RegId = Session[Global.LoginID].ToString();
        //        scUsr.RegDt = DateTime.Now;
        //        scUsr.Status = "N";
        //        scUsr.UsrType = "M";
        //        scUsr.UsrTypeDetail = "E";
        //        scUsr.UseErp = "0";

        //        SHACryptography sha2 = new SHACryptography();
        //        scUsr.LoginPw = sha2.EncryptString(scUsr.LoginPw);

        //        //회사정보 추가 정보 설정
        //        scCompInfo.Status = "N";
        //        scCompInfo.RegId = Session[Global.LoginID].ToString();
        //        scCompInfo.RegDt = DateTime.Now;

        //        //멘토 매핑정보 생성
        //        VcMentorMapping scMentorMappiing = new VcMentorMapping();
        //        scMentorMappiing.BizWorkSn = joinMentorViewModel.BizWorkSn;
        //        scMentorMappiing.MentorId = scUsr.LoginId;
        //        scMentorMappiing.Status = "N";
        //        scMentorMappiing.MngCompSn = int.Parse(Session[Global.CompSN].ToString());
        //        scMentorMappiing.RegId = scUsr.RegId;
        //        scMentorMappiing.RegDt = scUsr.RegDt;
        //        scUsr.ScMentorMappiings.Add(scMentorMappiing);

        //        //저장
        //        scCompInfo.ScUsrs.Add(scUsr);


        //        //bool result = _scUsrService.AddCompanyUser(scCompInfo, scUsr, syUser);
        //        int result = await _scMentorMappingService.AddMentorAsync(scCompInfo);

        //        if (result != -1)
        //            return RedirectToAction("MentorList", "MentorMng");
        //        else
        //        {
        //            ModelState.AddModelError("", "멘토 등록 실패.");
        //            return View(joinMentorViewModel);
        //        }
        //    }
        //    return View(joinMentorViewModel);
        //}

        //public async Task<ActionResult> MentorDetail(string bizWorkSn, string mentorId)
        //{
        //    ViewBag.LeftMenu = Global.MentorMng;

        //    VcMentorMapping vcMentorMapping = await _scMentorMappingService.GetMentor(int.Parse(bizWorkSn), mentorId);
        //    //string a = scMentorMapping.MentorId;
        //    var usrView =
        //        Mapper.Map<JoinMentorViewModel>(vcMentorMapping);

        //    return View(usrView);
        //}

        //[HttpPost]
        //public async Task<JsonResult> DoLoginIdSelect(string LoginId)
        //{
        //    bool result = await _scUsrService.ChkLoginId(LoginId);

        //    if (result.Equals(true))
        //    {
        //        return Json(new { result = true });
        //    }
        //    else
        //    {
        //        return Json(new { result = false });
        //    }

        //}

        public async Task <ActionResult> MentoringReportList(SelectedMentorReportParmModel param, string curPage)
        {
            ViewBag.naviLeftMenu = Global.MentorMng;

            // baLoginKey get
            var baLoginKey = Session[Global.LoginID].ToString();
            // baSn get
            var baSnObj = await vcBaInfoService.getVcBaInfoByKey(int.Parse(baLoginKey));

            // basn -> vcmentorinfo get
            var mentorInfoList = await vcMentorInfoService.getVcMentorInfoListByBaSn(baSnObj.BaSn);

            // foreach (mentor일지같이.. list에 add)
            List <MentoringReportViewModel> mrList = new List <MentoringReportViewModel>();

            if (mentorInfoList.Count > 0)
            {
                foreach (var miObj in mentorInfoList)
                {
                    var mentorIdObj = await _vcUsrService.getUsrInfoByTcmsKey(miObj.TcmsLoginKey);

                    var mentorId = mentorIdObj.LoginId;
                    // 추가...
                    var scMentoringReportObj = await _scMentoringReportService.getMentoringReportListById(mentorId);

                    if (scMentoringReportObj.Count > 0)
                    {
                        var viewObj = Mapper.Map <List <MentoringReportViewModel> >(scMentoringReportObj);

                        foreach (var vObj in viewObj)
                        {
                            var compNmObj = await _vcCompInfoService.getVcCompInfoByCompSn(vObj.CompSn);

                            vObj.CompNm = compNmObj.CompNm;
                            var usrInfoObj = await _vcUsrService.getScUsrByLoginId(vObj.MentorId);

                            vObj.MentorNm = usrInfoObj.Name;
                            mrList.Add(vObj);
                        }
                    }
                }
                //검색조건을 유지하기 위한
                ViewBag.SelectParam = param;

                //맨토링 일지 정보 조회
                int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
                //if (curPage == "")
                //{
                //    curPage = "1";
                //}
                //var pList = mrList.ToPagedList(int.Parse(curPage), pagingSize);
                //return View(pList);
                return(View(new StaticPagedList <MentoringReportViewModel>(mrList, int.Parse(curPage ?? "1"), pagingSize, mrList.Count)));
            }
            else
            {
                return(View());
            }
            // 뷰 보이기

            //var mentorId = Session[Global.LoginID].ToString();

            //SqlParameter loginId = new SqlParameter("LOGIN_ID", Session[Global.LoginID].ToString());
            //object[] parameters = new object[] { loginId };
            //var listObj = await procMngService.getBaMentoringReport(parameters);
            //var reportList = listObj;/*.Where(bw => bw.CLASSIFY == "A").ToList();*/

            //ViewBag.SelectCompInfoList = ReportHelper.MakeCompanyListByBa(listObj);                 // 기업명 dropdownlist

            ////검색조건을 유지하기 위한
            //ViewBag.SelectParam = param;

            ////맨토링 일지 정보 조회
            //int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);

            ////맨토링 일지 정보 to 뷰모델 매핑
            //var listTotalReportView =
            //   Mapper.Map<List<MentoringReportViewModel>>(reportList);

            //return View(new StaticPagedList<MentoringReportViewModel>(listTotalReportView, int.Parse(curPage ?? "1"), pagingSize, listTotalReportView.Count));
        }