📄 managerpurchase.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: ManagerPurchase.java
package myshop.purchase_sys;
import java.io.PrintStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import myshop.*;
import myshop.member_sys.administratorBean;
import myshop.product_sys.ManagerProduct;
// Referenced classes of package myshop.purchase_sys:
// orderBean
public class ManagerPurchase
{
Handle handle;
DBconn dbconn;
ManagerProduct ManagerProduct;
Md5 md5;
public ManagerPurchase()
throws Exception
{
dbconn = new DBconn();
handle = new Handle();
ManagerProduct = new ManagerProduct();
md5 = new Md5();
}
public void AddFavorite(String s, HttpServletRequest httpservletrequest, HttpSession httpsession)
throws Exception
{
int i = handle.getInt(httpservletrequest, "Pid");
String s3 = handle.GBK2ISO((String)httpsession.getValue("LoginUser"));
try
{
String s1 = "SELECT * FROM " + s + " WHERE Pid=" + i + " AND MName='" + s3 + "'";
ResultSet resultset = dbconn.ExeQuery(s1);
if(!resultset.next())
{
String s2 = "INSERT INTO " + s + "(MName,Pid,date_time) VALUES('" + s3 + "','" + i + "',sysdate())";
dbconn.ExeUpdate(s2);
}
dbconn.CloseConn();
}
catch(SQLException sqlexception)
{
System.err.println("aq.executeQuery:" + sqlexception.getMessage());
}
}
public int CheckLogin(HttpSession httpsession)
throws Exception
{
return httpsession.getValue("LoginUser") != null ? 1 : 0;
}
public void DealStatus(HttpServletRequest httpservletrequest, String s)
throws Exception
{
int i = handle.getInt(httpservletrequest, "status");
int j = handle.getInt(httpservletrequest, "r_info_id");
String s1 = "UPDATE " + s + " SET status = " + i + " WHERE id = " + j;
dbconn.ExeUpdate(s1);
dbconn.CloseConn();
}
public void DelFavoritePro(String s, HttpServletRequest httpservletrequest)
throws Exception
{
int i = handle.getInt(httpservletrequest, "Fid");
if(i != 0)
{
String s1 = "DELETE FROM " + s + " WHERE id=" + i;
dbconn.ExeUpdate(s1);
dbconn.CloseConn();
}
}
public void DelOrder(HttpServletRequest httpservletrequest, String s, String s1)
throws Exception
{
int i = handle.getInt(httpservletrequest, "r_info_id");
String s2 = "DELETE FROM " + s1 + " WHERE id = " + i;
dbconn.ExeUpdate(s2);
s2 = "DELETE FROM " + s + " WHERE r_info_id = " + i;
dbconn.ExeUpdate(s2);
dbconn.CloseConn();
}
public void DelProduct(HttpServletRequest httpservletrequest, HttpSession httpsession)
{
int i = handle.getInt(httpservletrequest, "Pid");
Vector vector = (Vector)httpsession.getValue("Car");
for(int j = 0; j < vector.size(); j++)
{
Car car = (Car)vector.elementAt(j);
if(i == car.getPid())
vector.removeElementAt(j);
}
}
public Hashtable DetailOrder(HttpServletRequest httpservletrequest, String s, String s1, String s2, String s3)
throws Exception
{
Hashtable hashtable = new Hashtable();
Hashtable hashtable2 = new Hashtable();
String s4 = "";
String s7 = "";
String s8 = "";
String s9 = "";
String s10 = "";
String s11 = "";
String s12 = "";
int i = handle.getInt(httpservletrequest, "r_info_id");
int j = 0;
float f3 = 0.0F;
try
{
String s5 = "SELECT * FROM " + s1 + " WHERE id = " + i;
ResultSet resultset = dbconn.ExeQuery(s5);
if(resultset.next())
{
s9 = resultset.getString("r_name");
s10 = resultset.getString("r_address");
s11 = resultset.getString("r_tel");
s12 = resultset.getString("date_time");
}
s5 = "SELECT * FROM " + s + " AS a," + s1 + " AS b WHERE a.r_info_id = " + i + " AND a.r_info_id = b.id";
for(ResultSet resultset1 = dbconn.ExeQuery(s5); resultset1.next();)
{
j++;
float f = resultset1.getFloat("price");
float f1 = resultset1.getFloat("quantity");
s7 = resultset1.getString("note");
float f2 = f * f1;
f3 += f2;
Hashtable hashtable1 = ManagerProduct.DetailProInfo(s2, s3, resultset1.getInt("product_id"));
String s6 = String.valueOf(String.valueOf(hashtable1.get("name")));
s8 = s8 + "<tr bgcolor=ffffff> \n";
s8 = s8 + " <td align=center valign=middle>" + j + "</td>\n";
s8 = s8 + " <td align=center valign=middle>" + s6 + "</td>\n";
s8 = s8 + " <td align=center valign=middle><font color=#FF0000>¥" + f + "</font></td>\n";
s8 = s8 + " <td align=center valign=middle>" + (int)f1 + "</td>\n";
s8 = s8 + " <td align=center valign=middle><font color=#FF0000>¥" + f2 + "</font></td>\n";
s8 = s8 + "</tr>\n";
}
dbconn.CloseConn();
}
catch(SQLException sqlexception)
{
System.err.println("aq.executeQuery:" + sqlexception.getMessage());
}
hashtable2.put("HtmlStr", s8);
hashtable2.put("all_sum", new Float(f3));
hashtable2.put("note", s7);
hashtable2.put("r_name", s9);
hashtable2.put("r_address", s10);
hashtable2.put("r_tel", s11);
hashtable2.put("date_time", s12);
return hashtable2;
}
public Hashtable GetAccountInfo(String s, HttpSession httpsession)
throws Exception
{
Hashtable hashtable = new Hashtable();
if(httpsession.getValue("LoginUser") == null)
{
hashtable.put("r_name", "");
hashtable.put("r_address", "");
hashtable.put("r_tel", "");
return hashtable;
}
String s2 = handle.GBK2ISO((String)httpsession.getValue("LoginUser"));
try
{
String s1 = "SELECT * FROM " + s + " WHERE account = '" + s2 + "'";
ResultSet resultset = dbconn.ExeQuery(s1);
resultset.next();
hashtable.put("r_name", resultset.getString("name"));
hashtable.put("r_address", resultset.getString("address"));
hashtable.put("r_tel", resultset.getString("tel"));
dbconn.CloseConn();
}
catch(SQLException sqlexception)
{
System.err.println("aq.executeQuery:" + sqlexception.getMessage());
}
return hashtable;
}
public Hashtable GetOrderMenu(String s, HttpSession httpsession)
throws Exception
{
String s1 = "";
String s3 = "";
float f1 = 0.0F;
float f4 = 0.0F;
Hashtable hashtable = new Hashtable();
Hashtable hashtable2 = new Hashtable();
Vector vector = (Vector)httpsession.getValue("Car");
if(vector == null)
{
hashtable2.put("html", "");
hashtable2.put("all_total_price", new Integer(0));
return hashtable2;
}
for(int j = vector.size() - 1; j >= 0; j--)
{
Car car = (Car)vector.elementAt(j);
int i = car.getPid();
float f = car.getQuantity();
Hashtable hashtable1 = ProductPN(s, i);
String s2 = String.valueOf(String.valueOf(hashtable1.get("name")));
float f2 = Float.parseFloat(String.valueOf(String.valueOf(hashtable1.get("price"))));
float f3 = f2 * f;
f4 += f3;
s3 = s3 + "<tr align=center valign=middle> ";
s3 = s3 + "\t<td>" + s2 + "</td>";
s3 = s3 + "\t<td>" + f2 + "</td>";
s3 = s3 + "\t<td>" + (int)f + "</td>";
s3 = s3 + "\t<td>" + f3 + "</td>";
s3 = s3 + "</tr>";
}
hashtable2.put("html", s3);
hashtable2.put("all_total_price", new Float(f4));
return hashtable2;
}
public Hashtable GetProduct(String s, HttpSession httpsession)
throws Exception
{
String s1 = "";
String s3 = "";
float f1 = 0.0F;
float f4 = 0.0F;
Hashtable hashtable = new Hashtable();
Hashtable hashtable2 = new Hashtable();
Vector vector = (Vector)httpsession.getValue("Car");
if(vector == null)
{
hashtable2.put("html", "");
hashtable2.put("all_total_price", new Integer(0));
return hashtable2;
}
for(int j = vector.size() - 1; j >= 0; j--)
{
Car car = (Car)vector.elementAt(j);
int i = car.getPid();
float f = car.getQuantity();
Hashtable hashtable1 = ProductPN(s, i);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -