public async Task <ActionResult> MentorCompMapping(JoinMentorViewModel paramodel, string curPage) { ViewBag.naviLeftMenu = Global.MentorMng; var baLoginKey = Session[Global.LoginID].ToString(); var baInfo = await _scUsrService.getBaInfoById(baLoginKey); // 기업 List SqlParameter loginKey = new SqlParameter("TCMS_LOGIN_KEY", Session[Global.LoginID]); object[] parameters22 = new object[] { loginKey }; var obj22 = await procMngService.baGetCompSelectList(parameters22); //var obj23 = obj22.Where(bw => bw.MENTOR_SN == null); var dropDownCompList22 = Mapper.Map <List <JoinMentorViewModel> >(obj22); JoinMentorViewModel title22 = new JoinMentorViewModel(); title22.CompSn = "0"; title22.CompNm = "기업선택"; dropDownCompList22.Insert(0, title22); SelectList compSelectList = new SelectList(dropDownCompList22, "CompSn", "CompNm"); ViewBag.SelectCompList = compSelectList; // 멘토 select List //SqlParameter loginId2 = new SqlParameter("LOGIN_ID", Session[Global.LoginID]); // sql 파라미터 값 설정 //object[] parameters2 = new object[] { loginId2 }; // 객체에 데이터 삽입 //var obj2 = await procBaMentorMapping.getBaMentorMapping(parameters2); // 해당 기업과 관련된 리스트데이터 가져오기 var obj2 = await _scUsrService.baGetMappingMentor(baInfo.BaSn); var dropDownMentor = Mapper.Map <List <JoinMentorViewModel> >(obj2); foreach (var item in dropDownMentor) { var mentorInfo = await _scUsrService.selectScUsrByTcms(item.MentorLoginKey); var mentorNm = mentorInfo.Name; item.MentorNm = mentorNm; } JoinMentorViewModel title = new JoinMentorViewModel(); title.MentorSn = "0"; title.MentorNm = "멘토 선택"; dropDownMentor.Insert(0, title); SelectList mentorListSelect = new SelectList(dropDownMentor, "MentorSn", "MentorNm"); ViewBag.SelectMentorList = mentorListSelect; // 분야 select List var conCodeList = new List <SelectListItem>(); conCodeList.Add(new SelectListItem { Value = "0", Text = "분야 코드 선택", Selected = true }); SelectList list = new SelectList(conCodeList, "Value", "Text"); ViewBag.SelectConCodeList = list; // 해당 BA에 매핑된 멘토 SelectList SqlParameter baSn = new SqlParameter("BA_SN", baInfo.BaSn.ToString()); object[] baSnSql = new object[] { baSn }; var obj = await procMngService.baGetCompMentorMappingList(baSnSql); var usrViewsInfo = Mapper.Map <List <JoinMentorViewModel> >(obj); // mapping 됐는지 안됐는지 확인 foreach (var item in usrViewsInfo) { var itemCompSn = int.Parse(item.CompSn); var itemBaSn = int.Parse(item.BaSn); var itemNumSn = item.NumSn; var itemSubNumSn = item.SubNumSn; var itemConCode = item.ConCode; var checkMapping = await vcMentorMappingService.checkCompMentorMapping(itemCompSn, itemBaSn, itemNumSn, itemSubNumSn, itemConCode); if (checkMapping.Count > 0) { item.MappingYn = "Y"; } else { item.MappingYn = "N"; } } var usrViewsInfos = Mapper.Map <List <JoinMentorViewModel> >(usrViewsInfo); var usrViewsInfosOrderby = usrViewsInfo.OrderBy(bw => bw.MappingYn); int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]); return(View(new StaticPagedList <JoinMentorViewModel>(usrViewsInfosOrderby.ToPagedList(int.Parse(curPage ?? "1"), pagingSize), int.Parse(curPage ?? "1"), pagingSize, usrViewsInfos.Count))); }