protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (this.Session["FromPage"] == null || Code.GetString(this.Session["FromPage"], string.Empty) != "reconfirm") { Session.Clear(); SDCodeCheck.JSUtil.AlertSussTranscation("Please enter from the first page", "agreement.aspx"); } if (Session["ChangePointInfo"] == null) AlertThenClose("Data lost, please try again!", true); Dictionary<string, string> dss = (Dictionary<string, string>)this.Session["ChangePointInfo"]; if (dss.Keys.Count != 5) AlertThenClose("Please manipulate as the normal procedure!", true); int GashPoints = 0; int GamePoints = 0; int GameBonus = 0; //預防未知的錯誤,例如欄位名稱錯誤 try { if (!Code.IsInt(dss["GashPoints"].ToString(), out GashPoints) || !Code.IsInt(dss["GamePoints"].ToString(), out GamePoints) || !Code.IsInt(dss["GameBonus"].ToString(), out GameBonus)) AlertThenClose("Sorry! System is busy now, please try again!(1)", true); if (string.IsNullOrEmpty(dss["ServerName"].ToString()) || string.IsNullOrEmpty(dss["CharacterName"].ToString())) AlertThenClose("Sorry! System is busy now, please try again!(2)", true); } catch (Exception ee) { AlertThenClose("Sorry! System is busy now, please try again!(3)", true); } lbl_GashAccount.Text = gi.GashAccount; lbl_Server_Name.Text = dss["ServerName"].ToString(); lbl_Character_Name.Text = dss["CharacterName"].ToString(); lbl_Change_Gash_Point.Text = GashPoints.ToString(); lbl_Change_Game_Point.Text = GamePoints.ToString(); Gamania.SD.Helper.GashService Gashs = new Gamania.SD.Helper.GashService(); int intUserPoint = Gashs.GetUserTotalPoint(gi.GameAccount, strPayServiceCode, strPayRegion, gi.GashRegion); if (intUserPoint < 0) { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "complete.aspx", "Page_Load", "GetUserTotalPoint", "Fail to get gamer's BeanPoint," + intUserPoint.ToString()); AlertThenClose("Fail to get your BeanPoint, please try again!", true); } else { lbl_Now_Gash.Text = intUserPoint.ToString(); } HFNewGuid.Value = System.Guid.NewGuid().ToString(); Session["PointComplete"] = HFNewGuid.Value; } string strNewGuid = (string)Session["PointComplete"] ?? string.Empty; if (strNewGuid != HFNewGuid.Value) SDCodeCheck.JSUtil.AlertCloseMsg("Please don't open another page repetitively."); //Session.Clear(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (this.Session["FromPage"] == null || Code.GetString(this.Session["FromPage"], string.Empty) != "Agreement") { Session.Clear(); SDCodeCheck.JSUtil.AlertSussTranscation("Please enter from the first page", "agreement.aspx"); } Set_Radio_Button(); if (gi.GashRegion.ToUpper() == "TW") { lbl_change_ratio.Text = "1:2"; lblNotice.Text = "Currently we provide 6 kind of BeanPoint exchange to GT Gold Point, they are "50 points", "150 points", "600 points", "1500 points", "3000 points", "5000 points", and you can only exchange 1 kind everytime."; } else if (gi.GashRegion.ToUpper() == "HK") { lbl_change_ratio.Text = "10:8 (HongKong BeanPoint 1.25 = 1 GT Gold Point)"; lblNotice.Text = "Currently we provide 7 kind of HongKong BeanPoint exchange to GT Gold Point, they are "125 points", "375 points", "750 points", "1500 points", "3750 points", "7500 points", "12500 points", and you can only exchange 1 kind everytime."; } lbl_Gash_Account.Text = gi.GashAccount; Gamania.SD.Helper.GashService Gashs = new Gamania.SD.Helper.GashService(); int intUserPoint = Gashs.GetUserTotalPoint(gi.GameAccount, strPayServiceCode, strPayRegion, gi.GashRegion); if (intUserPoint < 0) { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "confirm.aspx", "Page_Load", "GetUserTotalPoint", "Fail to get gamer's beanpoint," + intUserPoint.ToString()); AlertThenClose("Fail to get your BeanPoint, please try again!", true); } else { lblUserPoint.Text = intUserPoint.ToString(); } string errmsg = string.Empty; int intTest = Code.GetInt(ConfigurationManager.AppSettings["IsTest"], 1); DataTable ServerDT = Gamania.GT.Common.Select_Servers(intTest, out errmsg); if (ServerDT != null && ServerDT.Rows.Count > 0 && string.IsNullOrEmpty(errmsg)) Code.BindToControl(ddl_Server, ServerDT, "ServerName", "ServerID"); else if (!string.IsNullOrEmpty(errmsg)) { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "confirm.aspx", "Page_Load", "Select_Servers", "Fail to get DB server list:" + errmsg); //AlertThenClose(errmsg, true); AlertThenClose("Sorry! System is busy now, please try again!(4)", true); } ddl_Server.Items.Insert(0, new ListItem("Please choose your server", "-1")); ddl_Character.Items.Insert(0, new ListItem("Please choose your character", "-1")); HFNewGuid.Value = System.Guid.NewGuid().ToString(); Session["PointConfirm"] = HFNewGuid.Value; } }
protected void btn_confirm_Click(object sender, ImageClickEventArgs e) { string strNewGuid = (string)Session["PointReconfirm"] ?? string.Empty; if (strNewGuid != HFNewGuid.Value) SDCodeCheck.JSUtil.AlertCloseMsg("Please don't open another page repetitively"); Dictionary<string, string> dss = (Dictionary<string, string>)this.Session["ChangePointInfo"]; if (dss.Keys.Count != 8) AlertThenClose("Please manipulate as the normal procedure!!", true); int gashPoints = 0; int gamePoints = 0; int gameBonus = 0; string CharacterArea = ""; string AliasAccountID = ""; string ServerName = ""; string CharacterName = ""; string ServerID = ""; if (!Code.IsInt(dss["GashPoints"].ToString(), out gashPoints) || !Code.IsInt(dss["GamePoints"].ToString(), out gamePoints) || !Code.IsInt(dss["GameBonus"].ToString(), out gameBonus)) AlertThenClose("Sorry! System is busy now, please try again!(4)", true); if (string.IsNullOrEmpty(dss["ServerID"].ToString()) || string.IsNullOrEmpty(dss["ServerName"].ToString()) || string.IsNullOrEmpty(dss["CharacterName"].ToString()) || string.IsNullOrEmpty(dss["CharacterArea"].ToString()) || string.IsNullOrEmpty(dss["AliasAccountID"].ToString())) AlertThenClose("Sorry! System is busy now, please try again!(5)", true); ServerID = dss["ServerID"].ToString(); CharacterArea = dss["CharacterArea"].ToString(); AliasAccountID = dss["AliasAccountID"].ToString(); ServerName = dss["ServerName"].ToString(); CharacterName = dss["CharacterName"].ToString(); //check how much is the BeanPoint have to pay int payGash = gashPoints; if (IsTest == "0") payGash = 1; else if (IsTest == "2") payGash = 0; // 1. =====get gamer's BeanPoint===== Gamania.SD.Helper.GashService Gashs = new Gamania.SD.Helper.GashService(); int ownGash = Gashs.GetUserTotalPoint(gi.GameAccount, strPayServiceCode, strPayRegion, gi.GashRegion); if (ownGash < 0) { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "reconfirm.aspx", "Page_Load", "btn_confirm_Click", "Fail to get gamer's BeanPoint," + ownGash.ToString()); AlertThenClose("Fail to get your BeanPoint, please try again!!", true); } else if (ownGash < gashPoints) { AlertThenClose("Your BeanPoint is not enough, please buy at specific store, or buy online at tw.beanfun.com.", true); } else { // 2. =====呼叫USP_GT_Insert_Log===== int logID = 0; if (!this.Insert_Log(ServerID, AliasAccountID, CharacterName, payGash, gamePoints, gameBonus, out logID)) { AlertThenClose("Sorry! System is busy now, please try again!(6)", true); } else if (logID == 0) { AlertThenClose("Sorry! System is busy now, please try again!(9)", true); } else { //3. =====deduct BeanPoint if insert log successfully===== Gamania.SD.Helper.GashService gashws = new Gamania.SD.Helper.GashService(); string checkDeduct = "1"; if (payGash != 0)//don't call WS if deduct 0 BeanPoint checkDeduct = gashws.Deduct_GASHPoint_ServiceAccount(this.gi.GameAccount, this.strPayServiceCode, this.strPayRegion, this.gi.GashRegion, payGash, string.Format("君臨天下轉點:{0}", logID.ToString()), SDCodeCheck.WebComm.GetUserIP()); if (checkDeduct != "1") { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "reconfirm.aspx", "btn_confirm_Click", "Deduct_GASHPoint", "Fail to deduct BeanPoint," + checkDeduct); this.UpdateLog("Fail to deduct your BeanPoint!" + gashws.OutputMsg, logID, 2); AlertThenClose("Fail to deduct your BeanPoint, please try again!", true); } else this.UpdateLog("Success to deduct BeanPoint, haven't given Game Point yet!" + gashws.OutputMsg, logID, 1); //4. =====call WS to give Game Point if deduct BeanPoint successfully===== string errMsg = string.Empty; int returnValue = Gamania.GT.Common.Insert_Game_Coin(AliasAccountID, this.strPayServiceCode, this.strPayRegion, this.gi.GashRegion, CharacterName, CharacterArea, logID, ServerID, payGash, gamePoints, 1, out errMsg); if (returnValue != 1) { Gamania.SD.IRS.ErrorLog.InsErrLog(216, "reconfirm.aspx", "btn_confirm_Click", "Insert_Game_Coin", "Success to deduct BeanPoint, fail to give Game Point:" + returnValue + ";" + errMsg); this.UpdateLog("Success to deduct BeanPoint, fail to give Game Point!" + errMsg, logID, 4); AlertThenClose("Sorry! We've deducted your BeanPoint successively, but fail to give you Gold Point, please contact to our customer service!" + returnValue.ToString(), true); } this.UpdateLog("Success to give Game Point!" + errMsg, logID, 3); //5. =====show message if give Gold Point successfully===== dss = new Dictionary<string, string>(); dss.Add("ServerName", ServerName); //Server Name dss.Add("CharacterName", CharacterName); //Character Name dss.Add("GashPoints", gashPoints.ToString()); //Paid BeanPoint dss.Add("GamePoints", gamePoints.ToString()); //Get Gold Point dss.Add("GameBonus", gameBonus.ToString()); //Bonus Point Session["ChangePointInfo"] = dss; Session["FromPage"] = "reconfirm"; Response.Redirect("complete.aspx"); } } }