Ejemplo n.º 1
0
        public async Task<ActionResult> Index(LoginViewModel loginViewModel)
        {
            if (Session[Global.UserLogo] == null)
            {
                base.SetLogo("bi_main.png", "Login");
            }

            if (!ModelState.IsValid)
            {
                return View(loginViewModel);
            }

            ScUsr scUsr = await _scUsrService.SelectScUsr(loginViewModel.ID);
            if (scUsr != null)
            {
                //패스워드비교
                SHACryptography sha2 = new SHACryptography();
                if (scUsr.LoginPw == sha2.EncryptString(loginViewModel.Password))
                //if (user.LOGIN_PW == param.LOGIN_PW)
                {
                    base.LogOn(scUsr);
                    switch (scUsr.UsrType)
                    {
                        case Global.Company: //기업
                            return RedirectToAction("index", "Company/Main");
                        case Global.Mentor: //멘토
                            return RedirectToAction("index", "Mentor/Main");
                        case Global.Expert: //전문가
                            return RedirectToAction("index", "Expert/Main");
                        case Global.SysManager: //SCP
                            return RedirectToAction("index", "SysManager/Main");
                        case Global.BizManager: //사업관리자
                            return RedirectToAction("index", "BizManager/Main");
                        default:
                            ModelState.AddModelError("", "정의되지 않은 사용자 타입입니다.");
                            return View(loginViewModel);
                    }

                }
                else
                {
                    ModelState.AddModelError("", "비밀번호가 일치하지 않습니다.");
                    return View(loginViewModel);
                }
            }
            else
            {
                ModelState.AddModelError("", "아이디가 존재하지 않습니다.");
                return View(loginViewModel);
            }
        }
        public async Task<ActionResult> RegBizManager(JoinCompanyViewModel joinCompanyViewModel)
        {
            ViewBag.LeftMenu = Global.BizMng;

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

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

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

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

            //저장
            IList<ScUsr> scUsrs = new List<ScUsr>();
            scUsrs.Add(scUsr);
            scCompInfo.ScUsrs = scUsrs;

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

            if (result != -1)
                return RedirectToAction("BizManager", "BizManager");
            else
                return View(joinCompanyViewModel);

        }
Ejemplo n.º 3
0
        public async Task<ActionResult> ModifyMyInfo(CompanyMyInfoViewModel companyInfoViewModel, ModifyCompanyParamModel param)
        {
            ViewBag.LeftMenu = Global.MyInfo;

            ScUsr scUsr = await _scUsrService.SelectScUsr(Session[Global.LoginID].ToString());

            if (Session[Global.LoginID].ToString() != param.LoginIdChk)
            {
                companyInfoViewModel =
                   Mapper.Map<CompanyMyInfoViewModel>(scUsr);
                ModelState.AddModelError("", "로그인된 아이디가 아닙니다.");
                return View(companyInfoViewModel);
            }

            //실제패스워드와 입력패스워드 비교
            SHACryptography sha2 = new SHACryptography();
            if (param.LoginPwChk != sha2.EncryptString(companyInfoViewModel.LoginPw))
            {
                companyInfoViewModel =
                   Mapper.Map<CompanyMyInfoViewModel>(scUsr);

                ModelState.AddModelError("", "비밀번호가 일치하지 않습니다.");
                return View(companyInfoViewModel);
            }

            //담당자정보
            scUsr.Name = companyInfoViewModel.Name;
            scUsr.Email = companyInfoViewModel.Email1 + "@" + companyInfoViewModel.Email2;
            //scUsr.FaxNo = mentorViewModel.FaxNo1 + "-" + mentorViewModel.FaxNo2 + "-" + mentorViewModel.FaxNo3;
            scUsr.MbNo = companyInfoViewModel.MbNo1 + "-" + companyInfoViewModel.MbNo2 + "-" + companyInfoViewModel.MbNo3;
            scUsr.TelNo = companyInfoViewModel.TelNo1 + "-" + companyInfoViewModel.TelNo2 + "-" + companyInfoViewModel.TelNo3;

            //회사정보
            scUsr.ScCompInfo.CompNm = companyInfoViewModel.CompNm;
            scUsr.ScCompInfo.OwnNm = companyInfoViewModel.ComOwnNm;
            scUsr.ScCompInfo.TelNo = companyInfoViewModel.ComTelNo1 + "-" + companyInfoViewModel.ComTelNo2 + "-" + companyInfoViewModel.ComTelNo3;
            scUsr.ScCompInfo.PostNo = companyInfoViewModel.ComPostNo;
            scUsr.ScCompInfo.Addr1 = companyInfoViewModel.ComAddr1;
            scUsr.ScCompInfo.Addr2 = companyInfoViewModel.ComAddr2;

            _scUsrService.ModifyScUsr(scUsr);

            //업종 ,종목
            int compSn = int.Parse(Session[Global.CompSN].ToString());
            if (companyInfoViewModel.BizTypes.Count > 0)
            {
                _scBizTypeService.DeleteScBizTypeByCompSn(compSn);

                foreach (var item in companyInfoViewModel.BizTypes)
                {
                    var scBizType = new ScBizType
                    {
                       CompSn = compSn,
                       BizTypeCd = item.BizTypeCd,
                       BizTypeNm = item.BizTypeNm
                    };

                    _scBizTypeService.AddScBizType(scBizType);
                }
            }
            

            //다성공시 커밋
            await _scUsrService.SaveDbContextAsync();

            return RedirectToAction("MyInfo", "MyInfo");
        }
Ejemplo n.º 4
0
        public async Task<JsonResult> UpdateLoginPassword(string ID, string LOGIN_PW)
        {
            ScUsr scUsr = await _scUsrService.SelectScUsr(ID);
            
            if (scUsr != null)
            {
                //패스워드비교
                SHACryptography sha2 = new SHACryptography();
                scUsr.LoginPw = sha2.EncryptString(LOGIN_PW);
                await _scUsrService.SaveDbContextAsync();

                SHUSER_SyUser syUsr = new SHUSER_SyUser();
                syUsr.SmartPwd = scUsr.LoginPw;
                syUsr.IdUser = scUsr.LoginId;
                syUsr.MembBusnpersNo = scUsr.ScCompInfo.RegistrationNo;
                var rst = _scUsrService.UpdatePassword(syUsr);

                return Json(new { result = true });
            }
            else
            {
                return Json(new { result = false });
            }
        }
        public async Task<ActionResult> RegBizWork(BizWorkViewModel bizWorkViewModel)
        {
            ViewBag.LeftMenu = Global.BizWorkMng;

            if (ModelState.IsValid)
            {
                var scUsr = Mapper.Map<ScUsr>(bizWorkViewModel);
                var scBizWork = Mapper.Map<ScBizWork>(bizWorkViewModel);

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

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

                //사업정보 추가 정보 설정
                scBizWork.Status = "N";
                scBizWork.MngCompSn = int.Parse(Session[Global.CompSN].ToString());
                scBizWork.RegId = Session[Global.LoginID].ToString();
                scBizWork.RegDt = DateTime.Now;

                //저장
                IList<ScBizWork> scBizWorks = new List<ScBizWork>();
                scUsr.ScBizWorks.Add(scBizWork);

                int result = await _scUsrService.AddBizManagerMemberAsync(scUsr);

                if (result != -1)
                    return RedirectToAction("BizWorkList", "BizWorkMng");
                else
                {
                    ModelState.AddModelError("", "사업 등록 실패.");
                    return View(bizWorkViewModel);
                }
            }
            ModelState.AddModelError("", "입력값 검증 실패.");
            return View(bizWorkViewModel);
        }
Ejemplo n.º 6
0
        public async Task<ActionResult> ModifyMyInfo(MentorMyInfoViewModel mentorViewModel, ModifyMentorParamModel param, IEnumerable<HttpPostedFileBase> files)
        {
            ViewBag.LeftMenu = Global.MyInfo;

            ScUsr scUsr = await _scUsrService.SelectMentorInfo(Session[Global.LoginID].ToString());

            if (Session[Global.LoginID].ToString() != param.LoginIdChk)
            {
                mentorViewModel =
                   Mapper.Map<MentorMyInfoViewModel>(scUsr);
                ModelState.AddModelError("", "로그인된 아이디가 아닙니다.");
                return View(mentorViewModel);
            }

            //실제패스워드와 입력패스워드 비교
            SHACryptography sha2 = new SHACryptography();
            if (param.LoginPwChk != sha2.EncryptString(mentorViewModel.LoginPw))
            {
                mentorViewModel =
                   Mapper.Map<MentorMyInfoViewModel>(scUsr);

                ModelState.AddModelError("", "비밀번호가 일치하지 않습니다.");
                return View(mentorViewModel);
            }

            scUsr.AccountNo = mentorViewModel.AccountNo;
            scUsr.Addr1 = mentorViewModel.Addr1;
            scUsr.Addr2 = mentorViewModel.Addr2;
            scUsr.BankNm = mentorViewModel.BankNm;
            scUsr.Email = mentorViewModel.Email1 + "@" + mentorViewModel.Email2;
            scUsr.FaxNo = mentorViewModel.FaxNo1 + "-" + mentorViewModel.FaxNo2 + "-" + mentorViewModel.FaxNo3;
            scUsr.MbNo = mentorViewModel.MbNo1 + "-" + mentorViewModel.MbNo2 + "-" + mentorViewModel.MbNo3;
            scUsr.Name = mentorViewModel.Name;
            scUsr.PostNo = mentorViewModel.PostNo;
            scUsr.TelNo = mentorViewModel.TelNo1 + "-" + mentorViewModel.TelNo2 + "-" + mentorViewModel.TelNo3;
            scUsr.UsrTypeDetail = mentorViewModel.UsrTypeDetail;

            //_scUsrService.ModifyScUsr(scUsr);

            //파일정보 업데이트
            if (!string.IsNullOrEmpty(param.DeleteFileSn))
            {
                scUsr.ScUsrResume.ScFileInfo.Status = "D";
            }

            //신규파일정보저장 및 파일업로드
            foreach (var file in files)
            {
                if(file !=null)
                {
                    var fileHelper = new FileHelper();

                    var savedFileName = fileHelper.GetUploadFileName(file);

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

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

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

                    //_scUsrService.ModifyMentorInfo(scUsr);

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

            _scUsrService.ModifyScUsr(scUsr);

            //다성공시 커밋
            await _scUsrService.SaveDbContextAsync();

            return RedirectToAction("MyInfo", "Main");
        }
        public async Task<ActionResult> RegExpertManager(JoinExpertViewModel joinExpertViewModel, string BizList)
        {
            ViewBag.LeftMenu = Global.ExpertMng;

            var bizMngList = await _scUsrService.GetBizManagerAsync();
            var bizMngDropDown =
                Mapper.Map<List<BizMngDropDownModel>>(bizMngList);
            BizMngDropDownModel title = new BizMngDropDownModel();
            title.CompSn = 0;
            title.CompNm = "사업관리기관 선택";
            bizMngDropDown.Insert(0, title);
            
            SelectList bizList = new SelectList(bizMngDropDown, "CompSn", "CompNm");
            ViewBag.SelectBizMngList = bizList;

            if (ModelState.IsValid)
            {
                if(string.IsNullOrEmpty(BizList) || BizList == "0" )
                {
                    ModelState.AddModelError("", "사업명을 선택하지 않았습니다.");
                    return View(joinExpertViewModel);
                }

                var expert = await _scExpertMappingService.GetSameDetailTypeExpertAsync(int.Parse(BizList), joinExpertViewModel.UsrTypeDetail);
                if(expert != null)
                {
                    ModelState.AddModelError("", "동일한 분야의 전문가가 이미 사업에 맵핑되어 있습니다.");
                    return View(joinExpertViewModel);
                }

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

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

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

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

                //전문가 매핑정보 생성
                IList<ScExpertMapping> scExpertMappings = new List<ScExpertMapping>();
                ScExpertMapping scExpertMapping = new ScExpertMapping();
                scExpertMapping.BizWorkSn = int.Parse(BizList);
                scExpertMapping.ExpertId = scUsr.LoginId;
                scExpertMapping.Status = "N";
                scExpertMapping.RegId = scUsr.RegId;
                scExpertMapping.RegDt = scUsr.RegDt;
                scExpertMappings.Add(scExpertMapping);
                scUsr.ScExpertMappings = scExpertMappings;

                //저장
                IList<ScUsr> scUsrs = new List<ScUsr>();
                scUsrs.Add(scUsr);
                scCompInfo.ScUsrs = scUsrs;


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

                if (result != -1)
                    return RedirectToAction("ExpertManager", "ExpertManager");
                else
                { 
                    ModelState.AddModelError("", "전문가 등록 실패.");
                    return View(joinExpertViewModel);
                }
            }
            return View(joinExpertViewModel);
        }
Ejemplo n.º 8
0
        public async Task<ActionResult> CompanyJoin(JoinCompanyViewModel joinCompanyViewModel, string BizList)
        {
            if (ModelState.IsValid)
            {
                if(string.IsNullOrEmpty(BizList))
                {
                    ModelState.AddModelError("", "사업명을 선택하지 않았습니다.");
                    return View(joinCompanyViewModel);
                }
                var scUsr = Mapper.Map<ScUsr>(joinCompanyViewModel);
                var syUser = Mapper.Map<SHUSER_SyUser>(joinCompanyViewModel);
                var scCompInfo = Mapper.Map<ScCompInfo>(joinCompanyViewModel);

                //회원정보 추가 정보 설정
                scUsr.RegId = scUsr.LoginId;
                scUsr.RegDt = DateTime.Now;
                scUsr.Status = "N";
                scUsr.UsrType = "C";
                scUsr.UsrTypeDetail = "A";
                scUsr.AgreeYn = "Y";

                if (joinCompanyViewModel.UseErp.Equals(true))
                {
                    scUsr.UseErp = "1";
                }
                else
                {
                    scUsr.UseErp = "0";
                }

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

                //회사정보 추가 정보 설정
                scCompInfo.Status = "N";
                scCompInfo.RegId = scUsr.LoginId;
                scCompInfo.RegDt = DateTime.Now;

                //개인, 법인사업자 구분 설정
                int bizCode = Convert.ToInt32(scCompInfo.RegistrationNo.Substring(3, 2));
                string bizType = string.Empty; //법인 : L, 개인 : C

                if ((bizCode >= 1 && bizCode <= 79) || (bizCode >= 90 && bizCode <= 99) || bizCode == 89 || bizCode == 80)
                {
                    scCompInfo.CompType = "I"; //개인
                }
                else 
                {
                    scCompInfo.CompType = "C"; //법인
                }

                //사업관리 및 사업등록 요청 설절
                ScCompMapping scm = new ScCompMapping();
                scm.BizWorkSn = int.Parse(BizList);
                scm.Status = "R";
                scm.RegId = scUsr.LoginId;
                scm.RegDt = DateTime.Now;



                //다래 추가정보 설정
                // 기업회원 : 1, 세무회계사 : 2
                syUser.UsrGbn = "1";
                //사용가능 : 1, 사용불가 : 0
                if (joinCompanyViewModel.UseErp.Equals(true))
                {
                    syUser.UserStatus = "1";
                }
                else
                {
                    syUser.UserStatus = "0";
                }
                // 무료사용자 : 3, 유료사용자 : 1
                syUser.WebUsrGbn = "3";
                syUser.SmartPwd = scUsr.LoginPw;

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

                //업종,종목처리
                if (joinCompanyViewModel.BizTypes.Count > 0)
                {
                    //._scBizTypeService.DeleteScBizTypeByCompSn(compSn);

                    foreach (var item in joinCompanyViewModel.BizTypes)
                    {
                        var scBizType = new ScBizType
                        {
                            BizTypeCd = item.BizTypeCd,
                            BizTypeNm = item.BizTypeNm
                        };

                        scCompInfo.ScBizTypes.Add(scBizType);
                    }

                }

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

                ////업종,종목처리
                //int compSn = int.Parse(Session[Global.CompSN].ToString());
                //if (joinCompanyViewModel.BizTypes.Count > 0)
                //{
                //    //._scBizTypeService.DeleteScBizTypeByCompSn(compSn);

                //    foreach (var item in joinCompanyViewModel.BizTypes)
                //    {
                //        var scBizType = new ScBizType
                //        {
                //            CompSn = compSn,
                //            BizTypeCd = item.BizTypeCd,
                //            BizTypeNm = item.BizTypeNm
                //        };

                //        _scBizTypeService.AddScBizType(scBizType);
                //    }

                //    await _scBizTypeService.SaveDbContextAsync();
                //}

              

                if (result != -1)
                    return RedirectToAction("CompanyJoinComplete", "Account");
                else
                    return View(joinCompanyViewModel);

                //if (result)
                //    return RedirectToAction("CompanyJoinComplete", "Account");
                //else
                //    return View(joinCompanyViewModel);
            }
            // 이 경우 오류가 발생한 것이므로 폼을 다시 표시하십시오.
            return View(joinCompanyViewModel);
        }
Ejemplo n.º 9
0
        public async Task<ActionResult> ChangePassword(ChangePasswordViewModel model)
        {
            ViewBag.LeftMenu = Global.MyInfo;

            if (Session[Global.LoginID].ToString() != model.ID)
            {
                ModelState.AddModelError("", "로그인된 아이디가 아닙니다.");
                return View();
            }

            ScUsr scUsr = await _scUsrService.SelectScUsr(model.ID);
            if (scUsr != null)
            {
                //패스워드비교
                SHACryptography sha2 = new SHACryptography();
                if (scUsr.LoginPw == sha2.EncryptString(model.LoginPw))
                {
                    scUsr.LoginPw = sha2.EncryptString(model.NewLoginPw);
                    await _scUsrService.SaveDbContextAsync();

                    SHUSER_SyUser syUsr = new SHUSER_SyUser();
                    syUsr.SmartPwd = scUsr.LoginPw;
                    syUsr.IdUser = scUsr.LoginId;
                    syUsr.MembBusnpersNo = scUsr.ScCompInfo.RegistrationNo;
                    var rst = _scUsrService.UpdatePassword(syUsr);

                    string usrArea;

                    if (Session[Global.UserType].ToString().Equals(Global.Company))
                    {// 기업회원
                        usrArea = "Company";
                        return RedirectToAction("MyInfo", "MyInfo", new { area = usrArea });
                    }
                    else if (Session[Global.UserType].ToString().Equals(Global.Mentor))
                    {// 멘토
                        usrArea = "Mentor";
                    }
                    else if (Session[Global.UserType].ToString().Equals(Global.SysManager))
                    {// SCP 관리자
                        usrArea = "SysManager";
                    }
                    else if (Session[Global.UserType].ToString().Equals(Global.BizManager))
                    {// 사업 관리자
                        usrArea = "BizManager";
                    }
                    else if (Session[Global.UserType].ToString().Equals(Global.Expert))
                    {// 전문가
                        usrArea = "Expert";
                    }
                    else
                    {
                        usrArea = "";
                    }
                    return RedirectToAction("MyInfo", "Main", new { area = usrArea });
                }
                else
                {
                    ModelState.AddModelError("", "비밀번호가 일치하지 않습니다.");
                    return View();
                }
            }
            else
            {
                ModelState.AddModelError("", "아이디가 존재하지 않습니다.");
                return View();
            }
        }
Ejemplo n.º 10
0
 public async Task<ActionResult> DoLogin(LoginViewModel loginViewModel)
 {
     ScUsr scUsr = await _scUsrService.SelectScUsr(loginViewModel.ID);
     if (scUsr != null)
     {
         //패스워드비교
         SHACryptography sha2 = new SHACryptography();
         if (scUsr.LoginPw == sha2.EncryptString(loginViewModel.Password))
         //if (user.LOGIN_PW == param.LOGIN_PW)
         {
             //base.LogOn(scUsr);
             //string usrType = user.USR_TYPE;
             switch(scUsr.UsrType)
             {
                 case "C": //기업
                     return RedirectToAction("index", "Commany/Main");
                 case "M": //멘토
                     return RedirectToAction("index", "Mentor/Main");
                 case "P": //전문가
                     return RedirectToAction("index", "Expert/Main");
                 case "S": //SCP
                     return RedirectToAction("index", "SysManager/Main");
                 case "B": //사업관리자
                     return RedirectToAction("index", "BizManager/Main");
                 default:
                     return RedirectToAction("index", "Home");
             }
             
         }
         else
         {
             return RedirectToAction("index", "Home");
         }
     }
     else
     {
         return RedirectToAction("index", "Home");
     }
 }
Ejemplo n.º 11
0
        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);
        }