protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string stringID = Request.QueryString["@"]; int userID = Convert.ToInt32(stringID); int recoveryCode = retrieveCode(userID); string recoveryCodeSend = recoveryCode.ToString(); string registeredEmail = retrieveEmail(userID); GmailSMTP smtp = new GmailSMTP(); smtp.Send(registeredEmail, "MarketStory Activation Code", "Email Code: " + recoveryCodeSend, true); int otp = retrieveOtp(userID); string otpSend = otp.ToString(); int registeredMobile = retrieveMobile(userID); Response.Write(otp); string url = "http://gateway.onewaysms.sg:10002/api.aspx?apiusername=APIRBRI6I1ZYE&apipassword=APIRBRI6I1ZYERBRI6&mobileno=65" + registeredMobile + "&senderid=MarketStory&languagetype=1&message=OTP: " + otpSend; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.Accept = "Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); } }
protected void confirmCashOutButton_Click(object sender, EventArgs e) { int amountToCashOut = Convert.ToInt32(cashOutAmountInput.Text); if (amountToCashOut > user.getAccountBalance()) { ScriptManager.RegisterStartupScript(this, typeof(string), "cashOutFailedScript", "alert('You cannot cash out more than what you earn!');", true); } else if (amountToCashOut < 10) { ScriptManager.RegisterStartupScript(this, typeof(string), "cashOutFailedScript", "alert('You need to check out a minimum of $10!');", true); } else if (amountToCashOut <= user.getAccountBalance()) { ScriptManager.RegisterStartupScript(this, typeof(string), "cashOutSuccessScript", "alert('Cash out succeeded! Please check your email!');", true); user = user.retrieveUser(userID); user.updateUserAccountBalance(userID, -amountToCashOut); GmailSMTP smtp = new GmailSMTP(); string cashOutMessage = "You have opted to cash out an amount of $" + HttpUtility.HtmlEncode(amountToCashOut) + " on " + HttpUtility.HtmlEncode(DateTime.Now.ToString()); cashOutMessage += "\nPlease reply this email with your residential information so we can mail you the cheque"; cashOutMessage += "\nYou may also provide us with your banking information so we can bank transfer you the money"; cashOutMessage += "\n\nThank you for using MarketStory"; smtp.Send(user.getEmail(), "MarketStory Cash Out Success", cashOutMessage, true); user = user.retrieveUserAccountBalance(userID); displayUserAccountBalance.Text = HttpUtility.HtmlEncode("$" + Convert.ToString(user.getAccountBalance())); displayAmountToCashOut.Visible = false; cashOutAmountInput.Visible = false; confirmCashOutButton.Visible = false; cancelCashOutButton.Visible = false; cashOutAmountInput.Text = null; cashOutButton.Visible = true; } }