* @ name: bgColor.jsp
* @ func: Change the background color by level
give prize to user who get the right level
* @ Author : ranxu
* @ date :2008-06-27
-------------------------------------------------------------->
String bgSql = "";
String prizeSql = "";
long cumulatedExpNow = 0;
long cumulatedExp = 0;
int point_take = 0;
int point_hit = 0;
int level = 0;
int neededExp = 0;
String mainBgColor = "#ffb9b3"; //zhu ye mian bei jing yan se
String mainBgColorName = "";
String mainFontColor = "";
String contentBgColor = "";
String titleColor = ""; //biao ti lan
String titleFontColorY = ""; //wei xuan zhong
String pageBgColor = "";
String pageFNFontColor = "";
String pageFontColorY = "";
String pageFontColorN = "";
String partitionColor = "";
String btnFontColor = "";
int prize = 0;
int re = -1;
/*------------------------------------------------------------------------------------------------
* SELECT point_take and point_hit in order to get now cumulated Experence
-------------------------------------------------------------------------------------------------*/
bgSql = " SELECT point_take,point_hit FROM gt_nslevelset WITH (READUNCOMMITTED) WHERE phonenum=?";
pstmt = con.prepareStatement(bgSql);
pstmt.setLong(1,getLong(gphone));
rs = pstmt.executeQuery();
while(rs.next()){
point_take = rs.getInt("point_take");
point_hit = rs.getInt("point_hit");
}
rs.close();
pstmt.close();
//get now cumulated Experence
cumulatedExpNow = point_take*2+point_hit*1;
/*------------------------------------------------------------------------------------------------
* get the user's level , bgcolor and so on
-------------------------------------------------------------------------------------------------*/
bgSql=" SELECT TOP 1 * FROM gt_nslevel WITH (READUNCOMMITTED) WHERE cumulatedExp //bgSql="SELECT top 1 * FROM gt_nslevel WHERE cumulatedExp>=? ";
pstmt = con.prepareStatement(bgSql);
pstmt.setLong(1,cumulatedExpNow);
rs = pstmt.executeQuery();
while(rs.next()){
level = rs.getInt("level");
neededExp = rs.getInt("neededExp");
cumulatedExp = rs.getInt("cumulatedExp");
mainBgColor=rs.getString("mainBgColor");
mainBgColorName=rs.getString("mainBgColorName");
mainFontColor=rs.getString("mainFontColor");
contentBgColor=rs.getString("contentBgColor");
titleColor=rs.getString("titleColor");
titleFontColorY=rs.getString("titleFontColorY");
pageBgColor=rs.getString("pageBgColor");
pageFNFontColor=rs.getString("pageFNFontColor");
pageFontColorY=rs.getString("pageFontColorY");
pageFontColorN=rs.getString("pageFontColorN");
partitionColor=rs.getString("partitionColor");
btnFontColor=rs.getString("btnFontColor");
prize = rs.getInt("prize");
}
rs.close();
pstmt.close();
/*------------------------------------------------------------------------------------------------
* give prize to user when he got the right level
-------------------------------------------------------------------------------------------------*/
if(prize!=0){
prizeSql="SELECT * FROM gt_moneybook WITH (READUNCOMMITTED) WHERE phonenum=? AND moneybook_flag=? AND moneybook_clover=?";
pstmt=con.prepareStatement(prizeSql);
pstmt.setLong(1,getLong(gphone));
pstmt.setInt(2,1);
pstmt.setLong(3,prize);
rs = pstmt.executeQuery();
if(rs.next()){
}else{
prizeSql="EXEC gt_money_input ?,?,?";
pstmt = con.prepareStatement(prizeSql);
pstmt.setLong(1,getLong(gphone));
pstmt.setString(2,"");
pstmt.setLong(3,prize);
re = pstmt.executeUpdate();
if(re == -1){
return;
}
pstmt.close();
}
rs.close();
pstmt.close();
}
%>