public ResultSet returnCusRS()
{
return rsCus;
}
/**
*
* @param c
* @param b
* @return rsCus
*/
public ResultSet readCust(Connection c, String b)
{
conn = c;
customer cr = new customer();
cr.setKey(b);
/**
*
*/
try
{
java.sql.PreparedStatement stmt =
conn.prepareStatement(
"Select * from Customer where CustomerId = ?");
stmt.setString(1, b);
rsCus = stmt.executeQuery();
}
/**
*
*/
catch (Exception ex)
{
System.out.println(ex);
rsCus = null;
}
/**
*
*/
return rsCus;
}
/**
*
* @param c
* @return rsCus
*/
public ResultSet readCust(Connection c)
{
conn = c;
try
{
Statement stmt = conn.createStatement();
rsCus = stmt.executeQuery("select * from Customer");
}
catch (Exception ex)
{
System.out.println(ex);
rsCus = null;
}
return rsCus;
}
/**
*
* @param c
* @param a
* @param b
* @return rSCus
*/
public ResultSet readCust(Connection c, String a, String b)
{
conn = c;
try
{
java.sql.PreparedStatement stmt =
conn.prepareStatement(
"Select * from Customer where ActiveCustomer = Yes");
rsCus = stmt.executeQuery();
}
catch (Exception ex)
{
System.out.println(ex);
rsCus = null;
}
return rsCus;
}
/**
*
* @param co
* @param b
* @param c
*/
public void updatecust1(Connection co, String b, customer c)
{
conn = co;
customer cr = new customer();
cr.setKey(b);
cr = c;
System.out.println(cr);
System.out.println(cr.custId);
System.out.println(cr.workPhone);
System.out.println(cr.activeCustomer);
String updateString = " ";
try
{
Statement stmt = conn.createStatement();
try
{
if (cr.activeCustomer == true)
{
if (cr.citrixId.length() == 0)
{
updateString =
"UPDATE Customer "
+ "Set Company='"
+ cr.custNam
+ "', WorkPhone='"
+ cr.workPhone
+ "', Customer.Money = '"
+ cr.turnOver
+ "', Staff = '"
+ cr.staff
+ "', ITStaff = '"
+ cr.itStaff
+ "', ActiveCustomer = "
+ cr.activeCustomer
+ ", StatusID = '"
+ cr.statusId
+ "', Customer.[I-KonicID] = '"
+ cr.ikonicId
+ "', Customer.TypeOfBusiness = '"
+ cr.typeofBusiness
+ "', WebSite = '"
+ cr.webSite
+ "', MultiSite = "
+ cr.multiSite
+ ", CitrixID = '"
+ cr.citrixId
+ "' WHERE CustomerID="
+ cr.custId;
}
else
{
updateString =
"UPDATE Customer "
+ "Set Company='"
+ cr.custNam
+ "', WorkPhone='"
+ cr.workPhone
+ "', Customer.Money = '"
+ cr.turnOver
+ "', Staff = '"
+ cr.staff
+ "', ITStaff = '"
+ cr.itStaff
+ "', ActiveCustomer = "
+ cr.activeCustomer
+ ", StatusID = '"
+ cr.statusId
+ "', Customer.TypeOfBusiness = '"
+ cr.typeofBusiness
+ "', WebSite = '"
+ cr.webSite
+ "', MultiSite = "
+ cr.multiSite
+ ", CitrixID = '"
+ cr.citrixId
+ "', Customer.CitrixExpire = '"
+ cr.citrixExpire
+ "' WHERE CustomerID="
+ cr.custId;
}
}
else
{
updateString =
"UPDATE Customer "
+ "Set Company='"
+ cr.custNam
+ "', WorkPhone='"
+ cr.workPhone
+ "', Customer.Money = '"
+ cr.turnOver
+ "', Staff = '"
+ cr.staff
+ "', ITStaff = '"
+ cr.itStaff
+ "', ActiveCustomer = "
+ cr.activeCustomer
+ ", StatusID = '"
+ cr.statusId
+ "', Customer.TypeOfBusiness = '"
+ cr.typeofBusiness
+ "', WebSite = '"
+ cr.webSite
+ "', MultiSite = "
+ cr.multiSite
+ " WHERE CustomerID="
+ cr.custId;
}
System.out.println(updateString);
stmt.execute(updateString);
}
catch (Exception ex)
{
System.out.println(ex);
}
}
catch (Exception ex)
{
System.out.println(ex);
}
}