/// <summary> /// 기업사용자 생성 /// </summary> /// <param name="entrprsUserT">기업사용자 정보</param> /// <returns>생성된 Row의 Key값</returns> public void InsertEntrprsUser(EntrprsUserT entrprsUserT) { BeginTran(); try { string existYn = new UserDac().SelectUserExistYn(entrprsUserT.UserId); if (existYn == "Y") { // 사용자 ID 중복체크 throw new Exception("해당 사용자ID 는 이미 사용중입니다."); } // 사용자 생성 UserT userT = new UserT(); userT.UserId = entrprsUserT.UserId; userT.UserSeCode = "AC007002"; //사용자구분코드( 기업사용자: AC007002) new UserBiz().InsertUser(userT, "Y"); // 기업사용자 INSERT new EntrprsUserDac().InsertEntrprsUser(entrprsUserT); Commit(); } catch (Exception ex) { RollBack(); throw (ex); } }
/// <summary> /// 사용자 등록 /// </summary> /// <param name="userT"></param> public void InsertUser(UserT userT, string createPwYn) { if (createPwYn == "Y") { //임시 비밀번호 생성 string password = Security.Security.GetTempPassword(); userT.Password = Security.Security.Encrypt(password); //비밀번호 암호화 //TODO 비밀번호 이메일 전송 new EmailSendBiz().SendTempPassword(userT.UserId); } userT.PasswordInitlAt = createPwYn; new UserDac().InsertUser(userT); }
/// <summary> /// 사용자 비밀번호 초기화 /// </summary> /// <param name="userId"></param> public UserT InitUserPassword(string userId) { string initPassword = Security.Security.GetTempPassword(); UserT userT = new UserT(); userT.UserId = userId; userT.PasswordInitlAt = "Y"; userT.Password = Security.Security.Encrypt(initPassword); //비밀번호 수정 new UserDac().UpdateUserPassword(userT); //비밀번호 이메일 전송 ArchFx.EventLog.WindowEventLog.WriteLog("Ktc : SendTempPassword", "SendTempPassword", System.Diagnostics.EventLogEntryType.Information); new EmailSendBiz().SendTempPassword(userId); return userT; }
/// <summary> /// ID,PW 찾기 /// </summary> /// <param name="userT"></param> /// <returns></returns> public UserT FindIdPw(UserT userT) { string userId = new UserDac().SelectUserId(userT); if (userId != null && userId.Length > 0) { if (userT.FindSeCode == "PW") { //비밀번호 초기화 InitUserPassword(userT.UserId); } userT.UserId = userId; userT.IsSuccess = true; } else { userT.IsSuccess = false; } return userT; }
/// <summary> /// 개인사용자 생성 /// </summary> /// <param name="indvdlUserT">개인사용자 정보</param> /// <returns>생성된 Row의 Key값</returns> public void InsertIndvdlUser(IndvdlUserT indvdlUserT) { BeginTran(); try { //회원가입을 통해 개인사용자를 생성하는 경우 아이핀 고유번호 중복체크 if (!String.IsNullOrEmpty(indvdlUserT.IpinInnb)) { string ipinExistYn = new IndvdlUserDac().SelectIpinExistYn(indvdlUserT.IpinInnb); if (ipinExistYn == "Y") { //아이핀 고유번호 중복체크 throw new Exception("해당 사용자는 이미 회원가입된 사용자입니다."); } } string existYn = new UserDac().SelectUserExistYn(indvdlUserT.UserId); if (existYn == "Y") { // 사용자 ID 중복체크 throw new Exception("해당 사용자ID 는 이미 사용중입니다."); } // 사용자 생성 UserT userT = new UserT(); userT.UserId = indvdlUserT.UserId; userT.Password = Security.Security.Encrypt(indvdlUserT.Password); //TODO 암호화 //userT.Password = indvdlUserT.Password; userT.UserSeCode = "AC007001"; //사용자구분코드( 개인사용자: AC007001) new UserBiz().InsertUser(userT, "N"); // 개인사용자 INSERT new IndvdlUserDac().InsertIndvdlUser(indvdlUserT); Commit(); } catch (Exception ex) { RollBack(); throw (ex); } }
/// <summary> /// ID,비밀번호 찾기결과 팝업 화면 /// </summary> /// <param name="userT"></param> /// <returns></returns> public ActionResult SearchIdPwPopup(UserT userT) { userT = new UserBiz().FindIdPw(userT); return View(userT); }
/// <summary> /// 회원탈퇴(개인회원) /// </summary> /// <param name="userT"></param> /// <returns></returns> public bool MberSecsn(UserT userT) { bool isSuceess = true; //사용자(개인사용자) 존재여부 판별 ProfileT profileT = new ProfileT(); profileT.UserId = userT.UserId; profileT.UserSeCode = "AC007001"; //profileT = new ProfileDac().SelectUser(profileT); if (profileT != null) { //비밀번호 비교 if (profileT.Password == Security.Security.Encrypt(userT.Password)) { //회원삭제 BeginTran(); try { //개인회원정보 삭제 //new IndvdlUserDac().DeleteIndvdlUser(userT.UserId); //사용자정보 삭제 [김동훈 주석처리(2013-05-16) : 동일ID의 다른 유저의 가입을 막기위해 삭제하지 않는다.] //new UserDac().DeleteUser(userT.UserId); Commit(); } catch (Exception ex) { RollBack(); throw ex; } } else { throw new Exception("비밀번호가 맞지 않습니다."); } } else { throw new Exception("존재하지 않는 사용자 이거나 개인사용자가 아닙니다."); } return isSuceess; }
/// <summary> /// 사용자 비밀번호 수정 /// </summary> /// <param name="userT"></param> public void UpdateUserPassword(UserT userT) { //사용자정보 조회 ProfileT profileT = new ProfileT(); profileT.UserId = userT.UserId; profileT.UserSeCode = userT.UserSeCode; //profileT = new ProfileDac().SelectUser(profileT); if (profileT != null) { //기존비밀번호 일치여부 판별 if (profileT.Password == Security.Security.Encrypt(userT.OldPassword)) { userT.PasswordInitlAt = "N"; //비밀번호 초기화 여부 userT.Password = Security.Security.Encrypt(userT.Password); //비밀번호 암호화 new UserDac().UpdateUserPassword(userT); } else { throw new Exception("기존비밀번호가 일치하지 않습니다."); } } else { throw new Exception("존재하지 않는 사용자 입니다."); } }
/// <summary> /// 기업회원가입 등록 /// </summary> /// <param name="entrprsT"></param> public void JoinEntrprsMember(EntrprsT entrprsT) { EntrprsDac entrprsDac = new EntrprsDac(); long entrprsSn = 0; // 제조업여부 entrprsT.MfcrtrAt = string.IsNullOrEmpty(entrprsT.MfcrtrAt) ? "N" : "Y"; // 수입업여부 entrprsT.IrtbAt = string.IsNullOrEmpty(entrprsT.IrtbAt) ? "N" : "Y"; // 수리업여부 entrprsT.RepairIndutyAt = string.IsNullOrEmpty(entrprsT.RepairIndutyAt) ? "N" : "Y"; // 계량증명업여부 entrprsT.MesurProofIndutyAt = string.IsNullOrEmpty(entrprsT.MesurProofIndutyAt) ? "N" : "Y"; // 계량기사용자여부 entrprsT.MrnrEmplyrAt = string.IsNullOrEmpty(entrprsT.MrnrEmplyrAt) ? "N" : "Y"; BeginTran(); try { //기업정보 등록 entrprsSn = entrprsDac.InsertEntrprs(entrprsT); if (entrprsT.entrprsAdresList != null && entrprsT.entrprsAdresList.Count > 0) { for (int i = 0; i < entrprsT.entrprsAdresList.Count; i++) { EntrprsAdresT entrprsAdresT = entrprsT.entrprsAdresList[i]; entrprsAdresT.EntrprsSn = entrprsSn; //기업주소정보 등록 entrprsDac.InsertEntrprsAdres(entrprsAdresT); } } EntrprsUserT entrprsUserT = new EntrprsUserT(); entrprsUserT.EntrprsSn = entrprsSn; entrprsUserT.UserId = entrprsT.UserId; entrprsUserT.UserNm = entrprsT.UserNm; entrprsUserT.Telno = entrprsT.Telno; entrprsUserT.Mbtlnum = entrprsT.Mbtlnum; entrprsUserT.EmailAdres = entrprsT.EmailAdres; entrprsUserT.MngrAt = "Y"; //관리자여부 entrprsUserT.EntrprsUserSttusCode = "AC019003"; //기업사용자상태코드(승인대기로 설정) entrprsUserT.RegisterSeCode = "AC007002"; //등록자구분코드( 기업사용자: AC007002) entrprsUserT.RegisterId = entrprsT.UserId; entrprsUserT.UpdusrSeCode = "AC007002"; //수정자구분코드( 기업사용자: AC007002) entrprsUserT.UpdusrId = entrprsT.UserId; //기업사용자 ID 중복체크 string existYn = new UserDac().SelectUserExistYn(entrprsUserT.UserId); if (existYn == "Y") { // 사용자 ID 중복체크 throw new Exception("해당 사용자ID 는 이미 사용중입니다."); } // 사용자 생성 UserT userT = new UserT(); userT.UserId = entrprsUserT.UserId; userT.Password = Security.Security.Encrypt(entrprsT.Password); userT.UserSeCode = "AC007002"; //사용자구분코드( 기업사용자: AC007002) new UserBiz().InsertUser(userT, "N"); // 기업사용자 INSERT new EntrprsUserDac().InsertEntrprsUser(entrprsUserT); Commit(); } catch (Exception e) { this.RollBack(); throw e; } }
/// <summary> /// 기업회원정보 수정 /// </summary> /// <param name="entrprsT"></param> public void UpdateEntrprsMember(EntrprsT entrprsT) { EntrprsDac entrprsDac = new EntrprsDac(); long entrprsSn = entrprsT.EntrprsSn; long updateCount = 0; string EntrprsAuthCD = "AC019003"; // 제조업여부 entrprsT.MfcrtrAt = string.IsNullOrEmpty(entrprsT.MfcrtrAt) ? "N" : "Y"; // 수입업여부 entrprsT.IrtbAt = string.IsNullOrEmpty(entrprsT.IrtbAt) ? "N" : "Y"; // 수리업여부 entrprsT.RepairIndutyAt = string.IsNullOrEmpty(entrprsT.RepairIndutyAt) ? "N" : "Y"; // 계량증명업여부 entrprsT.MesurProofIndutyAt = string.IsNullOrEmpty(entrprsT.MesurProofIndutyAt) ? "N" : "Y"; // 계량기사용자여부 entrprsT.MrnrEmplyrAt = string.IsNullOrEmpty(entrprsT.MrnrEmplyrAt) ? "N" : "Y"; //계량기사용자여부 판별후 승인대기or승인 if (entrprsT.MfcrtrAt == "N" && entrprsT.IrtbAt == "N" && entrprsT.RepairIndutyAt == "N" && entrprsT.MesurProofIndutyAt == "N") { if (entrprsT.MrnrEmplyrAt == "Y") { EntrprsAuthCD = "AC019001"; //기업사용자상태코드(승인 설정) } else { EntrprsAuthCD = "AC019003"; //기업사용자상태코드(승인 설정) } } BeginTran(); try { //회원여부 상태 업데이트 - 기존입력된 회원업체 DB 때문 entrprsT.MberAt = "Y"; //기업정보 수정 updateCount = entrprsDac.UpdateEntrprs(entrprsT); if (updateCount > 0) { entrprsDac.DeleteEntrprsAdres(entrprsSn); if (entrprsT.entrprsAdresList != null && entrprsT.entrprsAdresList.Count > 0) { for (int i = 0; i < entrprsT.entrprsAdresList.Count; i++) { EntrprsAdresT entrprsAdresT = entrprsT.entrprsAdresList[i]; entrprsAdresT.EntrprsSn = entrprsSn; entrprsDac.InsertEntrprsAdres(entrprsAdresT); } } } EntrprsUserT entrprsUserT = new EntrprsUserT(); entrprsUserT.EntrprsSn = entrprsSn; entrprsUserT.UserId = entrprsT.UserId; entrprsUserT.UserNm = entrprsT.UserNm; entrprsUserT.Telno = entrprsT.Telno; entrprsUserT.Mbtlnum = entrprsT.Mbtlnum; entrprsUserT.EmailAdres = entrprsT.EmailAdres; entrprsUserT.MberAt = entrprsT.MberAt; //TODO 변경사항 entrprsUserT.MngrAt = "Y"; //관리자여부 //entrprsUserT.EntrprsUserSttusCode = "AC019003"; //기업사용자상태코드(승인대기) entrprsUserT.EntrprsUserSttusCode = EntrprsAuthCD; //기업사용자상태코드 entrprsUserT.RegisterSeCode = "AC007002"; //등록자구분코드( 기업사용자: AC007002) entrprsUserT.RegisterId = entrprsT.UserId; entrprsUserT.UpdusrSeCode = "AC007002"; //수정자구분코드( 기업사용자: AC007002) entrprsUserT.UpdusrId = entrprsT.UserId; /**/ string existYn = new UserBiz().SelectUserExistYn(entrprsT.UserId); if (existYn == "Y") { // 기업사용자 UPDATE new EntrprsUserDac().UpdateEntrprsUser(entrprsUserT); } else { // 사용자 생성 UserT userT = new UserT(); userT.UserId = entrprsUserT.UserId; userT.Password = Security.Security.Encrypt(entrprsT.Password); userT.UserSeCode = "AC007002"; //사용자구분코드( 기업사용자: AC007002) new UserBiz().InsertUser(userT, "N"); // 기업사용자 INSERT new EntrprsUserDac().InsertEntrprsUser(entrprsUserT); } Commit(); } catch (Exception e) { this.RollBack(); throw e; } }