protected void Page_Load(object sender, EventArgs e) { External_APIs.SendGrid sg = new External_APIs.SendGrid(); if ((Request.QueryString["transid"] != null) && (Request.QueryString["transid"] != "")) { transid = Request.QueryString["transid"].ToString(); } if ((Request.Form["transid"] != null) && (Request.Form["transid"] != "")) { transid = Request.Form["transid"].ToString(); } if ((Request.QueryString["status"] != null) && (Request.QueryString["status"] != "")) { status = Request.QueryString["status"].ToString(); } if ((Request.Form["status"] != null) && (Request.Form["status"] != "")) { status = Request.Form["status"].ToString(); } if ((Request.QueryString["message"] != null) && (Request.QueryString["message"] != "")) { message = Request.QueryString["message"].ToString(); } if ((Request.Form["message"] != null) && (Request.Form["message"] != "")) { message = Request.Form["message"].ToString(); } sg.SimpleEmail("Lorne", "Passport PostBack", "*****@*****.**", "", "Request Postback was pinged forms count =" + Request.Form.Count.ToString() + ", querystring count = " + Request.QueryString.Count.ToString() + ". transid = " + transid + "; message = " + message + "; status = " + status, "Request Postback"); /* if (transid != "") { int paymentkey = sitetemp.getPaymentKey_fromEmbeetransid(Convert.ToInt32(transid)); EmbeeObject embeeobject = sitetemp.getEmbeeObject(paymentkey); //Process transaction if (status.Trim().ToUpper() == "COMPLETED") { //complete transaction Peerfx_DB.SPs.UpdateEmbeeObjectsIpn(Convert.ToInt32(transid), message, 2).Execute(); Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 5).Execute(); //email to say top up was sent sg.Send_Email_Payment_Completed_Embee(embeeobject); } else if (status.Trim().ToUpper() == "CANCELED") { //cancel transaction Peerfx_DB.SPs.UpdateEmbeeObjectsIpn(Convert.ToInt32(transid), message, 3).Execute(); Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 7).Execute(); //email to say top up was cancelled } }*/ }
protected void RadListView1_ItemCommand(object source, RadListViewCommandEventArgs e) { if (e.CommandName == "Validate") { DataTable dttemp = Peerfx_DB.SPs.ViewVerificationMethods().GetDataSet().Tables[0]; RadListViewDataItem lvdi = (RadListViewDataItem)e.ListViewItem; int userkey = Convert.ToInt32(hduserkey.Value); int verificationmethod = Convert.ToInt32(dttemp.Rows[lvdi.DataItemIndex]["verification_method_key"]); Peerfx_DB.SPs.UpdateVerification(userkey, verificationmethod, true, sitetemp.get_ipaddress(), null).Execute(); LoadUserProfile(Convert.ToInt32(hduserkey.Value)); if ((verificationmethod == 2) || (verificationmethod == 3)) { External_APIs.SendGrid sg = new External_APIs.SendGrid(); sg.Send_Email_Verification_Approved(userkey, verificationmethod); if (verificationmethod == 2) { mx.TrackEvent("Verification - Passport ID Confirmed", userkey, null); } else { mx.TrackEvent("Verification - Address Confirmed", userkey, null); } } } else if (e.CommandName == "Reject") { DataTable dttemp = Peerfx_DB.SPs.ViewVerificationMethods().GetDataSet().Tables[0]; RadListViewDataItem lvdi = (RadListViewDataItem)e.ListViewItem; Peerfx_DB.SPs.UpdateVerification(Convert.ToInt32(hduserkey.Value), Convert.ToInt32(dttemp.Rows[lvdi.DataItemIndex]["verification_method_key"]), false, sitetemp.get_ipaddress(), null).Execute(); LoadUserProfile(Convert.ToInt32(hduserkey.Value)); } }
protected void btnsignup_Click(object sender, EventArgs e) { string strid = null; if ((Request.QueryString["id"] != null) && (Request.QueryString["id"] != "")) { strid = Request.QueryString["id"].ToString(); } //check if email exists DataTable dttemp = Peerfx_DB.SPs.ViewUsersEmail(txtemail.Text).GetDataSet().Tables[0]; if (dttemp.Rows.Count > 0) { //user exists lblerror.Text = "Email address already Signed Up"; } else if (txtemail.Text == "") { lblerror.Text = "Please enter email address"; } else if (!sitetemp.IsValidEmail(txtemail.Text)) { lblerror.Text = "Please enter a valid email address"; } else if (txtfirstname.Text == "") { lblerror.Text = "Please enter first name"; } else if (txtlastname.Text == "") { lblerror.Text = "Please enter last name"; } else if (txtpassword.Text == "") { lblerror.Text = "Please enter password"; } else if (strid == null) { lblerror.Text = "Could not find Embee ID"; } else { //sign up user & log them in StoredProcedure sp_UpdateSignup1 = Peerfx_DB.SPs.UpdateUsers(0, "", txtfirstname.Text, "", txtlastname.Text, null, null, txtemail.Text, HttpContext.Current.Request.UserHostAddress, 0); sp_UpdateSignup1.Execute(); int temp_user_key = Convert.ToInt32(sp_UpdateSignup1.Command.Parameters[9].ParameterValue.ToString()); Peerfx_DB.SPs.UpdateUsersInfo(temp_user_key, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).Execute(); Peerfx_DB.SPs.UpdateUsersInfoSignupTab3(temp_user_key, "", txtpassword.Text).Execute(); Peerfx_DB.SPs.UpdateUsersReferral(temp_user_key, strid).Execute(); mx.TrackEvent("Sign Up - Embee", temp_user_key, null); Users user = sitetemp.view_users_info_email(txtemail.Text); HttpContext.Current.Session["currentuser"] = user; Response.Redirect("/User/Verification.aspx"); //send verification email External_APIs.SendGrid sg = new External_APIs.SendGrid(); sg.Send_Email_Verification(temp_user_key); } }
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { //tx statuses //1 = pending //2 = processed //3 = removed if (e.CommandName == "btnconnectuser") { GridDataItem item = (GridDataItem)e.Item; int txkey = Convert.ToInt32(item["tx_external_key"].Text); decimal amount = Convert.ToDecimal(item["amount"].Text); int currency = Convert.ToInt32(item["info_currencies_key"].Text); RadComboBox ddlconnectuser = (RadComboBox)item.FindControl("ddlconnectuser"); if (ddlconnectuser.SelectedValue != "") { int userkey = Convert.ToInt32(ddlconnectuser.SelectedValue); Peerfx_DB.SPs.UpdateProcessDeposit(txkey, 2, userkey).Execute(); RadGrid1.Rebind(); //deposit to user, send email External_APIs.SendGrid sg = new External_APIs.SendGrid(); sg.Send_Email_Deposit_Received(userkey, 0, 0, amount, currency); } else { Label lblerror = (Label)item.FindControl("lblerror"); lblerror.Text = "You must select a user"; lblerror.Visible = true; } } else if (e.CommandName == "btnconnectpayment") { //connect tx to a payment GridDataItem item = (GridDataItem)e.Item; int txkey = Convert.ToInt32(item["tx_external_key"].Text); decimal amount = Convert.ToDecimal(item["amount"].Text); int currency = Convert.ToInt32(item["info_currencies_key"].Text); RadComboBox ddlconnectuser = (RadComboBox)item.FindControl("ddlconnectpayment"); if (ddlconnectuser.SelectedIndex > -1) { int paymentskey = Convert.ToInt32(ddlconnectuser.SelectedValue); //Move money to payment object & change status to 3 Peerfx_DB.SPs.UpdateProcessDeposit(txkey, 1, paymentskey).Execute(); RadGrid1.Rebind(); //Send to complete payment Models.Payment paymenttemp = sitetemp.getPayment(paymentskey); sitetemp.payment_complete(paymenttemp); int userkey = paymenttemp.Requestor_user_key; //deposit to payment, send email External_APIs.SendGrid sg = new External_APIs.SendGrid(); sg.Send_Email_Deposit_Received(userkey, paymentskey, 1, amount, currency); } else { Label lblerror = (Label)item.FindControl("lblerror"); lblerror.Text = "You must select a payment"; lblerror.Visible = true; } } else if (e.CommandName == "btnconnectCC") { //connect tx to a payment GridDataItem item = (GridDataItem)e.Item; int txkey = Convert.ToInt32(item["tx_external_key"].Text); RadComboBox ddlconnectCC = (RadComboBox)item.FindControl("ddlconnectCC"); if (ddlconnectCC.SelectedIndex > -1) { int paymentskey = Convert.ToInt32(ddlconnectCC.SelectedValue); Peerfx_DB.SPs.UpdateProcessDeposit(txkey, 1, paymentskey).Execute(); RadGrid1.Rebind(); //Send to currency conversion Models.Payment paymenttemp = sitetemp.getPayment(paymentskey); sitetemp.payment_complete(paymenttemp); } else { Label lblerror = (Label)item.FindControl("lblerror"); lblerror.Text = "You must select a payment"; lblerror.Visible = true; } } else if (e.CommandName == "btnremovedeposit") { GridDataItem item = (GridDataItem)e.Item; int txkey = Convert.ToInt32(item["tx_external_key"].Text); Peerfx_DB.SPs.UpdateTransactionExternalStatus(txkey, 3, sitetemp.get_ipaddress(),currentuser.User_key).Execute(); RadGrid1.Rebind(); } else if (e.CommandName == "Update") { //updating fees GridEditFormItem item = (GridEditFormItem)e.Item; Label lbltxfees = (Label)item.FindControl("lbltxfeeskey"); int txfees = Convert.ToInt32(lbltxfees.Text); RadNumericTextBox txtamount = (RadNumericTextBox)item.FindControl("txtamount"); RadComboBox ddlconnectuser = (RadComboBox)item.FindControl("ddlcurrency"); string description = (item["description"].Controls[0] as TextBox).Text; Peerfx_DB.SPs.UpdateTransactionFees(txfees, 0, 0, Convert.ToDecimal(txtamount.Text), Convert.ToInt32(ddlconnectuser.SelectedValue), description, null,0).Execute(); } else if (e.CommandName == "btninsertexisting") { //insert new deposit & connect it to existing bank account GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item; decimal amount = Convert.ToDecimal((insertedItem["tx_external_key"].FindControl("txtamountexisting") as RadNumericTextBox).Text); int sender_bank_key = Convert.ToInt32((insertedItem["tx_external_key"].FindControl("ddlexistingbankaccounts") as RadComboBox).SelectedValue); int receiver_bank_key = Convert.ToInt32((insertedItem["tx_external_key"].FindControl("ddlreceiveraccount") as RadComboBox).SelectedValue); string Description = (insertedItem["tx_external_key"].FindControl("txtdeposit") as RadTextBox).Text; string bankreference = (insertedItem["tx_external_key"].FindControl("txtbankref") as RadTextBox).Text; Peerfx_DB.SPs.UpdateTransactionsExternal(0, 1, sitetemp.getbankaccountcurrency(receiver_bank_key), amount, sitetemp.getpaymentobject(sender_bank_key), sitetemp.getpaymentobject(receiver_bank_key), sitetemp.get_ipaddress(), currentuser.User_key, Description, bankreference, 0, null, null).Execute(); RadGrid1.EditIndexes.Clear(); RadGrid1.MasterTableView.IsItemInserted = false; RadGrid1.MasterTableView.Rebind(); } }
protected void Setfb() { string oauth = Request.QueryString["code"].ToString(); Peerfx.External_APIs.Facebook fb = new External_APIs.Facebook(); string accesstoken = fb.getaccesstoken(oauth, HttpContext.Current.Request.Url.AbsoluteUri,currentuser.User_key); //Get user id fb.updateuserinfo(currentuser.User_key); sitetemp.VerificationReward(5, currentuser.User_key); External_APIs.Mixpanel mx = new External_APIs.Mixpanel(); mx.TrackEvent("Verification - Facebook Connected",currentuser.User_key,null); string msg = ""; if (currentuser.Referral != null) { //Embee Referral string url = "https://www.embeepay.com/fb/wallet/bin/embee_reward.php?id=" + currentuser.Referral; HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest; webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.MediaType = "application/x-www-form-urlencoded"; webRequest.Method = "GET"; string responseString; try { HttpWebResponse webResponse; // Get the response from the request object and verify the status webResponse = webRequest.GetResponse() as HttpWebResponse; if (!webRequest.HaveResponse) { throw new Exception(); } if (webResponse.StatusCode != HttpStatusCode.OK && webResponse.StatusCode != HttpStatusCode.Accepted) { throw new Exception(); } // Read the response string StreamReader reader = new StreamReader(webResponse.GetResponseStream()); responseString = reader.ReadToEnd(); reader.Close(); mx.TrackEvent("Referral Complete", currentuser.User_key,null); msg = "?msg=You have completed your Embee task. Thanks! Feel free to continue to play around with our site."; } catch (Exception e) { Peerfx_DB.SPs.UpdateApiErrors(3, "", e.Message, url).Execute(); string Toemail = System.Configuration.ConfigurationSettings.AppSettings.Get("ErrorToEmail").ToString(); External_APIs.SendGrid sg = new External_APIs.SendGrid(); sg.SimpleEmail("Lorne", "Passportfx API Error", Toemail, "*****@*****.**", e.Message, "Embee Error"); } } //redirect back to verification page Response.Redirect("/User/Verification.aspx" + msg); }