You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.4 KiB
66 lines
2.4 KiB
package com.controller;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.swing.JTextField;
|
|
|
|
import com.dao.GuestDaohxr;
|
|
import com.entity.Guesthxr;
|
|
|
|
public class GuestActionhxr {
|
|
//增加客户信息
|
|
public void addGuestInformation(
|
|
JTextField guestNameField,
|
|
JTextField contactInformationField,
|
|
JTextField addressField,
|
|
JTextField businessRecordField) throws Exception{
|
|
GuestDaohxr guestDao = new GuestDaohxr();
|
|
Guesthxr guest = new Guesthxr();
|
|
guest.setGuest_name(guestNameField.getText());
|
|
guest.setContact_information(contactInformationField.getText());
|
|
guest.setAddress(addressField.getText());
|
|
guest.setBusiness_record(businessRecordField.getText());
|
|
|
|
guestDao.addGuest(guest);
|
|
}
|
|
//删除客户信息
|
|
public void delGuestInformation(String guest_name)throws Exception {
|
|
GuestDaohxr guestDao = new GuestDaohxr();
|
|
|
|
guestDao.delGuest(guest_name);
|
|
}
|
|
//修改客户信息
|
|
public void changeGuestInformation(JTextField guestNameField,
|
|
JTextField contactInformationField,
|
|
JTextField addressField,
|
|
JTextField businessRecordField) throws Exception{
|
|
GuestDaohxr guestDao = new GuestDaohxr();
|
|
Guesthxr guest = new Guesthxr();
|
|
|
|
guest.setGuest_name(guestNameField.getText());
|
|
guest.setContact_information(contactInformationField.getText());
|
|
guest.setAddress(addressField.getText());
|
|
guest.setBusiness_record(businessRecordField.getText());
|
|
|
|
guestDao.changeGuest(guest);
|
|
}
|
|
//查询表信息并放入二维数组中保存
|
|
public Object[][] query(String[] columnNames) throws Exception{
|
|
// TODO Auto-generated method stub
|
|
GuestDaohxr guestDao = new GuestDaohxr();
|
|
List<Guesthxr> list = guestDao.query();
|
|
Object[][] results= new Object[list.size()][columnNames.length];
|
|
for (int i = 0; i < list.size(); i++) {
|
|
Guesthxr car = (Guesthxr)list.get(i);
|
|
|
|
results[i][0] = car.getGuest_name();
|
|
results[i][1] = car.getContact_information();
|
|
results[i][2]=car.getAddress();
|
|
results[i][3]=car.getBusiness_record();
|
|
|
|
|
|
}
|
|
return results;
|
|
}
|
|
}
|