Esempio n. 1
0
        public async Task <ActionResult> AgreeMentorAgreement()
        {
            ScUsr scUsr = await _scUsrService.SelectMentorInfo(Session[Global.LoginID].ToString());

            scUsr.AgreeYn = "Y";

            _scUsrService.ModifyScUsr(scUsr);

            await _scUsrService.SaveDbContextAsync();

            Session[Global.AgreeYn] = "Y";

            return(RedirectToAction("Index", "Main"));
        }
Esempio n. 2
0
        public async Task <JsonResult> UpdateLoginPassword(string ID, string LOGIN_PW)
        {
            // 누가 로그인 했는 지에 대한 ID 확인
            VcUsrInfo 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> 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));
            }
        }
        public async Task <JsonResult> DeleteExpert(string[] loginIds)
        {
            ViewBag.LeftMenu = Global.ExpertMng;

            foreach (var loginId in loginIds)
            {
                ScUsr scUsr = await _scUsrService.SelectScUsr(loginId);

                scUsr.Status = "D";
                await _scUsrService.SaveDbContextAsync();
            }
            return(Json(new { result = true }));
        }
        //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" }));
        }
        public async Task <ActionResult> ChangePassword(ChangePasswordViewModel model)
        {
            ViewBag.LeftMenu = Global.MyInfo;

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

            VcUsrInfo 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();

                    /**
                     * 다래 DB 연결 주석
                     * 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());
            }
        }
Esempio n. 7
0
        public async Task <ActionResult> ModifyMyInfo(CompanyMyInfoViewModel companyInfoViewModel, ModifyCompanyParamModel param)
        {
            ViewBag.LeftMenu = Global.MyInfo;

            VcUsrInfo 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;

            //회사정보 foreign key
            //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"));
        }