public async Task<ActionResult> CompanyList()
        {
            ViewBag.LeftMenu = Global.CompanyMng;

            //사업 DropDown List Data
            var scExpertsMapping = await _scExpertMappingService.GetExpertsAsync(Session[Global.LoginID].ToString());


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

            //사업담당자 일 경우 담당 사업만 조회
            BizWorkDropDownModel title = new BizWorkDropDownModel();
            title.BizWorkSn = 0;
            title.BizWorkNm = "사업명 선택";
            bizWorkDropDown.Insert(0, title);

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

            ViewBag.SelectBizWorkList = bizList;

            ViewBag.SelectCompInfoList = ReportHelper.MakeCompanyList(null);

            var scCompMappings = await _scCompMappingService.GetExpertCompMappingsAsync(Session[Global.LoginID].ToString(), 0, 0);

            var companyList =
                Mapper.Map<List<ExpertCompanyViewModel>>(scCompMappings);

            int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);

            return View(new StaticPagedList<ExpertCompanyViewModel>(companyList.ToPagedList(1, pagingSize), 1, pagingSize, companyList.Count));
        }
Пример #2
0
        public async Task<IList<BizWorkDropDownModel>> MakeBizWork(int mngCompSn, string excutorId, int bizWorkYear)
        {
            //사업 DropDown List Data
            var listScBizWork = await _scBizWorkService.GetBizWorkList(mngCompSn, excutorId, bizWorkYear);

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

            //사업드롭다운 타이틀 추가
            BizWorkDropDownModel titleBizWork = new BizWorkDropDownModel
            {
                BizWorkSn = 0,
                BizWorkNm = "사업명 선택"
            };

            bizWorkDropDown.Insert(0, titleBizWork);

            return bizWorkDropDown;
        }
        public async Task<IList<BizWorkDropDownModel>> MakeBizWork(string mentorId, int bizWorkYear)
        {
       
            //사업 DropDown List Data
            var listScMentorMapping = await _scMentorMappingService.GetMentorMappingListByMentorId(mentorId, bizWorkYear);
            var listScBizWork = listScMentorMapping.Select(mmp => mmp.ScBizWork);//.ToList();

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

            //사업드롭다운 타이틀 추가
            BizWorkDropDownModel titleBizWork = new BizWorkDropDownModel
            {
                BizWorkSn = 0,
                BizWorkNm = "사업명 선택"
            };

            bizWorkDropDown.Insert(0, titleBizWork);

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

            return bizWorkDropDown;
        }
        public async Task<ActionResult> CompanyList()
        {
            ViewBag.LeftMenu = Global.ComMng;

            string excutorId = null;
            int bizWorkSn = 0;

            //사업담당자 일 경우 담당 사업만 조회
            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")
            {
                bizWorkSn = listScBizWork.First().BizWorkSn;
            }
            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 status = new List<SelectListItem>(){
                new SelectListItem { Value = "", Text = "승인상태", Selected = true },
                new SelectListItem { Value = "R", Text = "승인대기" },
                new SelectListItem { Value = "A", Text = "승인" }
            };

            SelectList statusList = new SelectList(status, "Value", "Text");

            ViewBag.SelectStatusList = statusList;

            int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);

            //사업참여기업 리스트 조회(pagedList 적용)
            var pagedListCompany = await _scCompMappingService.GetPagedListCompMappingsAsync(1, pagingSize, int.Parse(Session[Global.CompSN].ToString()), bizWorkSn);

            var usrViews =
                Mapper.Map<List<CompanyMngViewModel>>(pagedListCompany);

            
            return View(new StaticPagedList<CompanyMngViewModel>(usrViews, 1, pagingSize, pagedListCompany.TotalItemCount));

            //var listCompany = await _scCompMappingService.GetCompMappingsAsync(int.Parse(Session[Global.CompSN].ToString()), bizWorkSn);

            //var usrViews =
            //    Mapper.Map<List<CompanyMngViewModel>>(listCompany);

            //int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
            //return View(new StaticPagedList<CompanyMngViewModel>(usrViews.ToPagedList(1, pagingSize), 1, pagingSize, usrViews.Count));
        }
        public async Task<ActionResult> MentorList()
        {
            ViewBag.LeftMenu = Global.MentorMng;

            string excutorId = null;
            int bizWorkSn = 0;

            //사업담당자 일 경우 담당 사업만 조회
            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")
            {
                bizWorkSn = listScBizWork.First().BizWorkSn;
            }
            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()), bizWorkSn);

            var usrViews =
                Mapper.Map<List<JoinMentorViewModel>>(listMentor);
            int pagingSize = int.Parse(ConfigurationManager.AppSettings["PagingSize"]);
            return View(new StaticPagedList<JoinMentorViewModel>(usrViews.ToPagedList(1, pagingSize), 1, pagingSize, usrViews.Count));

        }
        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)
            {
                if (joinMentorViewModel.BizWorkSn == 0)
                {
                    ModelState.AddModelError("", "사업명을 선택하지 않았습니다.");
                    return View(joinMentorViewModel);
                }

                var scUsr = Mapper.Map<ScUsr>(joinMentorViewModel);
                var scCompInfo = Mapper.Map<ScCompInfo>(joinMentorViewModel);

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

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

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

                //멘토 매핑정보 생성
                ScMentorMappiing scMentorMappiing = new ScMentorMappiing();
                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> 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();
        }