コード例 #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));
            }

            VcUsrInfo scUsr = await _scUsrService.SelectScUsr(loginViewModel.ID);

            if (scUsr != null)
            {
                //패스워드비교
                //var vcCompInfo = await _vcCompInfoService.getVcCompInfoById(loginViewModel.ID);
                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));
            }
        }
コード例 #2
0
        public async Task <ActionResult> ModifyMyInfo(BizWorkViewModel bizWorkViewModel)
        {
            ViewBag.LeftMenu = Global.MyInfo;
            var scUsr = await _scUsrService.SelectScUsr(Session[Global.LoginID].ToString());

            scUsr.Name   = bizWorkViewModel.Name;
            scUsr.DeptNm = bizWorkViewModel.DeptNm;
            scUsr.TelNo  = bizWorkViewModel.TelNo1 + "-" + bizWorkViewModel.TelNo2 + "-" + bizWorkViewModel.TelNo3;
            scUsr.MbNo   = bizWorkViewModel.MbNo1 + "-" + bizWorkViewModel.MbNo2 + "-" + bizWorkViewModel.MbNo3;
            scUsr.FaxNo  = bizWorkViewModel.FaxNo1 + "-" + bizWorkViewModel.FaxNo2 + "-" + bizWorkViewModel.FaxNo3;
            scUsr.Email  = bizWorkViewModel.Email1 + "@" + bizWorkViewModel.Email2;

            int result = await _scUsrService.SaveDbContextAsync();

            if (result != -1)
            {
                return(RedirectToAction("MyInfo", "Main"));
            }
            else
            {
                ModelState.AddModelError("", "내정보 수정 실패.");
                var scBizWork = await _scBizWorkService.GetBizWorkByloginId(Session[Global.LoginID].ToString());

                var usrView =
                    Mapper.Map <BizWorkViewModel>(scBizWork);

                return(View(usrView));
            }
        }
コード例 #3
0
        public async Task <ActionResult> DoLogin(LoginViewModel loginViewModel)
        {
            VcUsrInfo 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)
                {
                    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"));

                    case "A":     //사업관리자
                        return(RedirectToAction("index", "BizManager/Main"));

                    default:
                        return(RedirectToAction("index", "Home"));
                    }
                }
                //else
                //{
                //    return RedirectToAction("index", "Home");
                //}
            }
            else
            {
                return(RedirectToAction("index", "Home"));
            }
        }
コード例 #4
0
        public async Task <JsonResult> GetMentor(string MentorID)
        {
            ScUsr result = await _scUsrService.SelectScUsr(MentorID);

            var mentor =
                Mapper.Map <JoinMentorViewModel>(result);

            return(Json(mentor));
        }
コード例 #5
0
        // GET: Company/MyInfo
        public async Task <ActionResult> MyInfo()
        {
            ViewBag.naviLeftMenu = Global.MyInfo;

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

            var myInfo =
                Mapper.Map <CompanyMyInfoViewModel>(scUsr);

            //업종, 종목
            //var listScBizType = await _scBizTypeService.GetScBizTypeByCompSn(int.Parse(scUsr.CompSn));
            //var bizTypeViewModel =
            //   Mapper.Map<List<BizTypeViewModel>>(listScBizType);

            //myInfo.BizTypes = bizTypeViewModel;

            return(View(myInfo));
        }
コード例 #6
0
        public async Task <ActionResult> ExpertManagerDetail(string loginId)
        {
            ViewBag.LeftMenu = Global.ExpertMng;

            ScUsr scUsr = await _scUsrService.SelectScUsr(loginId);

            var myInfo =
                Mapper.Map <JoinExpertViewModel>(scUsr);

            //업종, 종목
            var listScBizType = await _scBizTypeService.GetScBizTypeByCompSn(myInfo.CompSn);

            var bizTypeViewModel =
                Mapper.Map <List <BizTypeViewModel> >(listScBizType);

            myInfo.BizTypes = bizTypeViewModel;

            return(View(myInfo));
        }
コード例 #7
0
        public async Task <ActionResult> BizManagerDetail(string loginId)
        {
            ViewBag.LeftMenu = Global.BizMng;
            //var dicScNtc = _scNtcService.GetNoticeDetailById(noticeSn);
            var scUsr = await _scUsrService.SelectScUsr(loginId);

            var joinCompanyView =
                Mapper.Map <JoinCompanyViewModel>(scUsr);

            return(View(joinCompanyView));
        }
コード例 #8
0
        //public async Task<ActionResult> ResetMentorPw(string bizWorkSn, string mentorId)
        //{
        //    ViewBag.LeftMenu = Global.MentorMng;

        //    ScMentorMappiing scMentorMapping = await _scMentorMappingService.GetMentor(int.Parse(bizWorkSn), mentorId);

        //    var usrView =
        //        Mapper.Map<JoinMentorViewModel>(scMentorMapping);

        //    SHACryptography sha2 = new SHACryptography();

        //    //ScUsr scUsr = await _scUsrService.SelectScUsr(model.ID);
        //    //SHUSER_SyUser syUsr = new SHUSER_SyUser();

        //    //// 특정한 pw를 미리 설정
        //    //model.NewLoginPw = "ab12345678";

        //    //scUsr.LoginPw = sha2.EncryptString(model.NewLoginPw);
        //    //syUsr.SmartPwd = scUsr.LoginPw;
        //    //await _scUsrService.SaveDbContextAsync();
        //    //var rst = _scUsrService.UpdatePassword(syUsr);

        //    //// 누가 누구의 pw를 초기화 시킬 것인지?

        //    //string usrArea;

        //    //if (Session[Global.UserType].ToString().Equals(Global.SysManager))
        //    //{
        //    //    // 시스템 담당자
        //    //    // 시스템 담당자가 -> 사업관리기관, 전문가 회원 pw 초기화
        //    //    usrArea = "SysManager";
        //    //}
        //    //else if (Session[Global.UserType].ToString().Equals(Global.BizManager))
        //    //{
        //    //    // 사업관리기관
        //    //    // 사업관리기관 -> 사업담당자, 멘토 pw 초기화
        //    //    usrArea = "BizManager";
        //    //}


        //    //return View();

        //    return View(usrView);
        //}


        // add Loy

        public async Task <ActionResult> UserPasswordReset(string mentorId)
        {
            //ScMentorMappiing scMentorMapping = await _scMentorMappingService.GetMentor(int.Parse(bizWorkSn), mentorId);
            //ScUsr scUsr = await _scUsrService.SelectScUsr(scMentorMapping.MentorId);
            ScUsr scUsr = await _scUsrService.SelectScUsr(mentorId);

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

            await _scUsrService.SaveDbContextAsync();

            var rst = _scUsrService.UserPasswordReset(scUsr);

            // 초기화 후 list로 돌아가기
            return(RedirectToAction("MentorList", "MentorMng", new { area = "BizManager" }));
        }