📄 customer.java
字号:
package fangsoft.testcenter.model;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class Customer {
public static boolean login(String userId, String password) throws IOException {
File file=new File(Constants.CUSTOMER_FILE_NAME);
String[] files=file.list();
for(int i=0;i<files.length;i++){
if((userId+".txt").equals(files[i])){
FileReader fr=new FileReader(Constants.CUSTOMER_FILE_NAME+files[i]);
BufferedReader reader=new BufferedReader(fr);
String name=reader.readLine();
String pword=reader.readLine();
if(pword.equals(password))return true;
else return false;
}
}
return false;
}
private Profile profile;
private String name;
private String email;
private String addrCountry;
private String addrProvince;
private String addrCity;
private String addrStreet;
private String postcode;
private String phone;
private byte[] resume;
public Customer() {
super();
}
public String getAddrCity() {
return addrCity;
}
public void setAddrCity(String addrCity) {
this.addrCity = addrCity;
}
public String getAddrCountry() {
return addrCountry;
}
public void setAddrCountry(String addrCountry) {
this.addrCountry = addrCountry;
}
public String getAddrProvince() {
return addrProvince;
}
public void setAddrProvince(String addrProvince) {
this.addrProvince = addrProvince;
}
public String getAddrStreet() {
return addrStreet;
}
public void setAddrStreet(String addrStreet) {
this.addrStreet = addrStreet;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPostcode() {
return postcode;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public Profile getProfile() {
return profile;
}
public void setProfile(Profile profile) {
this.profile = profile;
}
public byte[] getResume() {
return resume;
}
public void setResume(byte[] resume) {
this.resume = resume;
}
public void changePassword(String newPass){
profile.setPassword(newPass);
}
public void changeComm(String addrCountry,String addrProvince,
String addrCity,String addrStreet,
String postcode,String phone ){
setAddrCountry(addrCountry);
setAddrProvince(addrProvince);
setAddrCity(addrCity);
setAddrStreet(addrStreet);
setPostcode(postcode);
setPhone(phone);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -