//로그인 인증 public bool IsAuthenticateLogin(string id, string password) { databaseConnect = "Server=localhost;Database=bookmanage;Uid=root;Pwd=0000"; connect = new MySqlConnection(databaseConnect); // conncet MySQL connect.Open(); // open MySQL sqlQuery = "select * from member where id='" + id + "' and password='******';"; command = new MySqlCommand(sqlQuery, connect); dataReader = command.ExecuteReader(); dataReader.Read(); string serverID = dataReader["id"].ToString(); string serverPWD = dataReader["password"].ToString(); if (serverID.Equals(id) && serverPWD.Equals(password)) { logOnMember = new MemberVO(dataReader["id"].ToString(), dataReader["password"].ToString(), dataReader["name"].ToString(), dataReader["gender"].ToString(), dataReader["phoneNumber"].ToString(), dataReader["email"].ToString(), dataReader["address"].ToString(), dataReader["rentbook"].ToString(), dataReader["duedate"].ToString(), 3); dataReader.Close(); connect.Close(); return(true); } dataReader.Close(); connect.Close(); return(false); }
//회원 정보 삭제 public void RemoveMember() { string confirm; MemberVO foundMember = SearchMember("removeSearch"); print.DeleteMember(foundMember); confirm = Console.ReadLine(); if (errorCheck.Confirm(confirm)) { print.MenuErrorMsg("Y/N오류"); menu.MemberManagementMenu(); return; } sqlQuery = "delete from member where id='" + foundMember.Id + "';"; SendQuery(); dataReader.Read(); if (errorCheck.IsValidChange(dataReader) == false) //편집 에러 { CloseDB(); print.ErrorMsg("회원 삭제"); menu.MemberManagementMenu(); return; } CloseDB(); print.CompleteMsg("회원 삭제 완료"); menu.MemberManagementMenu(); return; }
public void DeleteMember(MemberVO inputMember) { Console.Clear(); Console.WriteLine("\n\n\t---------------------------------삭제할 회원 기존 정보--------------------------------"); Console.WriteLine("\n\t아이디 : {0}", inputMember.Id); Console.WriteLine("\t이름 : {0}", inputMember.Name); Console.WriteLine("\t성별 : {0}", inputMember.Gender); Console.WriteLine("\t핸드폰 번호 : {0}", inputMember.PhoneNumber); Console.WriteLine("\t이메일 : {0}", inputMember.Email); Console.WriteLine("\t주소 : {0}", inputMember.Address + "\n"); Console.WriteLine("\t--------------------------------------------------------------------------------------"); Console.Write("\n\n\t정말로 삭제하시겠습니까? (Y/N) : "); }
//회원 검색 public MemberVO SearchMember(string searchType) { string searchID; switch (searchType) { case "editSearch": print.Search("정보를 편집할 회원의 아이디"); break; case "removeSearch": print.Search("삭제할 회원의 아이디"); break; case "justSearch": print.Search("검색할 회원의 아이디"); break; } searchID = Console.ReadLine(); sqlQuery = "select * from member where id='" + searchID + "';"; SendQuery(); dataReader.Read(); if (errorCheck.IsValidMember(dataReader) == false) //검색 에러 { CloseDB(); print.ErrorMsg("존재하는 회원 찾기"); if (searchType.Equals("justSearch")) { menu.MemberManagementMenu(); } return(null); } MemberVO foundMember = new MemberVO(dataReader["id"].ToString(), dataReader["password"].ToString(), dataReader["name"].ToString(), dataReader["gender"].ToString(), dataReader["phoneNumber"].ToString(), dataReader["email"].ToString(), dataReader["address"].ToString(), dataReader["rentbook"].ToString(), dataReader["duedate"].ToString(), 3); CloseDB(); if (searchType.Equals("justSearch")) { print.MemberInfo(foundMember); menu.MemberManagementMenu(); } return(foundMember); }
public void MemberInfo(MemberVO inputMember) { Console.Clear(); Console.WriteLine("\n\n\t---------------------------------검색한 회원 기존 정보--------------------------------"); Console.WriteLine("\n\t아이디 : {0}", inputMember.Id); Console.WriteLine("\t학번 : {0}", inputMember.Name); Console.WriteLine("\t성별 : {0}", inputMember.Gender); Console.WriteLine("\t핸드폰 번호 : {0}", inputMember.PhoneNumber); Console.WriteLine("\t주소 : {0}", inputMember.Address); Console.WriteLine("\t현재 대출한 책 : {0}", inputMember.RentBook); Console.WriteLine("\t반납 예정일 : {0}", inputMember.DueDate + "\n"); Console.WriteLine("\t연장 가능횟수 : {0}", inputMember.ExtensionCount + "\n"); Console.WriteLine("\t--------------------------------------------------------------------------------------"); Console.Write("\n\n\t이전으로 돌아가려면 엔터..."); Console.ReadLine(); }
//기본 기능은 주소/핸드폰 번호만 수정 가능 public MemberVO EditMember(MemberVO inputMember) { string phoneNumber, address; Console.Clear(); Console.WriteLine("\n\n\t---------------------------------수정할 회원 기존 정보--------------------------------"); Console.WriteLine("\n\t아이디 : {0}", inputMember.Id); Console.WriteLine("\t이름 : {0}", inputMember.Name); Console.WriteLine("\t성별 : {0}", inputMember.Gender); Console.WriteLine("\t핸드폰 번호 : {0}", inputMember.PhoneNumber); Console.WriteLine("\t이메일 주소 : {0}", inputMember.Email); Console.WriteLine("\t주소 : {0}", inputMember.Address + "\n"); Console.WriteLine("\t--------------------------------------------------------------------------------------"); Console.WriteLine("\n\n\t---------------------------------수정할 회원 정보 입력--------------------------------"); while (true) { Console.Write("\n\t핸드폰 번호 입력(010-1234-5678 형식) : "); phoneNumber = Console.ReadLine(); if (errorCheck.MemberPhone(phoneNumber) == false) { break; } FormErrorMsg("핸드폰 번호"); } while (true) { Console.Write("\n\n\t주소 입력(동/리까지 입력) : "); address = Console.ReadLine(); if (errorCheck.MemberAddress(address) == false) { break; } FormErrorMsg("주소"); } inputMember.PhoneNumber = phoneNumber; inputMember.Address = address; return(inputMember); }
//회원정보 수정 public void EditMember() { MemberVO foundMember = SearchMember("editSearch"); foundMember = print.EditMember(foundMember); sqlQuery = "update member set phoneNumber ='" + foundMember.PhoneNumber + "', address ='" + foundMember.Address + "' where id='" + foundMember.Id + "';"; SendQuery(); dataReader.Read(); if (errorCheck.IsValidChange(dataReader) == false) //편집 에러 { CloseDB(); print.ErrorMsg("회원 정보 수정"); menu.MemberManagementMenu(); return; } CloseDB(); print.CompleteMsg("회원 정보 수정 완료"); menu.MemberManagementMenu(); return; }
public MemberVO RegisterMember() //while로 틀린 항목 다시 입력하게 { string id, password, name, gender, phoneNumber, email, address; Console.Clear(); while (true) { Console.Write("\n\n\t학번 입력 (6~8자리 이내) : "); id = Console.ReadLine(); if (errorCheck.MemberID(id) == false) { break; } FormErrorMsg("학번"); } while (true) { Console.Write("\n\n\t비밀번호 입력 (숫자만 4자리) : "); password = Console.ReadLine(); if (errorCheck.MemberPassword(password) == false)//미리 설정해둔 정규식에 맞으면 bool 타입 false 반환 { break; } FormErrorMsg("이름"); } while (true) { Console.Write("\n\n\t이름 입력 (4자리 이내) : "); name = Console.ReadLine(); if (errorCheck.MemberName(name) == false)//미리 설정해둔 정규식에 맞으면 bool 타입 false 반환 { break; } FormErrorMsg("이름"); } while (true) { Console.Write("\n\n\t성별 입력 (남자/여자): "); gender = Console.ReadLine(); if (errorCheck.MemberGender(gender) == false) { break; } FormErrorMsg("성별"); } while (true) { Console.Write("\n\n\t핸드폰 번호 입력(010-1234-5678 형식) : "); phoneNumber = Console.ReadLine(); if (errorCheck.MemberPhone(phoneNumber) == false) { break; } FormErrorMsg("핸드폰 번호"); } while (true) { Console.Write("\n\n\t이메일 입력 : "); email = Console.ReadLine(); if (errorCheck.MemberEmail(email) == false) { break; } FormErrorMsg("이메일"); } while (true) { Console.Write("\n\n\t주소 입력 : "); address = Console.ReadLine(); if (errorCheck.MemberAddress(address) == false) { break; } FormErrorMsg("주소"); } MemberVO newMember = new MemberVO(id, password, name, gender, phoneNumber, email, address, "없음", "없음", 2); return(newMember); }