protected void btnToQSB_Click(object sender, EventArgs e) { try { var cash = (int)(Convert.ToInt32(tbQSB.Text) / (1 - ConfigGlobal.ExchangeFee) * ConfigGlobal.ExchangeRate); if (cash > CurrentGambler.Cash || cash <= 0) { throw new Exception("Insufficient Founds"); } CurrentGambler.Cash -= cash; CurrentGambler.Update(); var banker = new Banker(Banker.DefaultBankerID); banker.Cash += cash * ConfigGlobal.ExchangeFee; banker.Update(null); Users.UpdateUserExtCredits(userid, 2, Convert.ToInt32(tbQSB.Text)); ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('套现枪手币成功');window.location.href = window.location.href;", true); } catch { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", "alert('套现失败');", true); } }
protected void btnToCash_Click(object sender, EventArgs e) { try { // Remove ExchangeFee //int qsb = (int)(Convert.ToInt32(tbCash.Text) * (1 + Entity.ConfigGlobal.ExchangeFee) / Entity.ConfigGlobal.ExchangeRate); var qsb = Convert.ToInt32(tbCash.Text) / ConfigGlobal.ExchangeRate; if (qsb > Users.GetUserExtCredits(userid, 2) || qsb <= 0) { throw new Exception("Insufficient Founds"); } CurrentGambler.Cash += Convert.ToInt32(tbCash.Text.Trim()); CurrentGambler.Update(); var banker = new Banker(Banker.DefaultBankerID); banker.Cash += qsb * ConfigGlobal.ExchangeFee * ConfigGlobal.ExchangeRate; banker.Update(null); Users.UpdateUserExtCredits(userid, 2, -qsb); ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('充值博彩币成功');window.location.href = window.location.href;", true); } catch { ClientScript.RegisterClientScriptBlock(typeof(string), "failed", "alert('充值失败');", true); } }