using System; using System.Web.UI; using GCheckout.Checkout; using GCheckout.Util; public partial class BuyNow3 : System.Web.UI.Page { protected void imgPayPal_Click(object sender, ImageClickEventArgs e) { if (Page.IsValid) { UG.Affiliate objAffiliate = new UG.Affiliate(); objAffiliate.ReferralCode = txtRefCode.Text.ToUpper(); objAffiliate.Email = ""; if (txtRefCode.Text.Trim() != "" && !objAffiliate.IsAffiliateExist()) { ErrLabel.Text = "Please enter correct referral code. This referral code does not exist."; return; } UG.PayPal.PayPalHelper objPayPal = new UG.PayPal.PayPalHelper(); objPayPal.PayPalBaseUrl = System.Configuration.ConfigurationManager.AppSettings["PayPalBaseUrl"]; objPayPal.AccountEmail = System.Configuration.ConfigurationManager.AppSettings["PayPalAccountMail"]; objPayPal.Amount = decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["PayAmount"]); objPayPal.ItemName = "Draft Center - The Revolutionary Fantasy Football Tool for Draft Day Domination!"; objPayPal.SuccessUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; objPayPal.CancelUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; objPayPal.Custom = txtRefCode.Text.Trim(); //objPayPal.NotifyUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/ProcessPayPalNotify.aspx"; //objPayPal.EncryptKey = ""; //objPayPal.EncryptKey = System.Configuration.ConfigurationManager.AppSettings["PayPalEncryptKey"]; //objPayPal.NotifyUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/NotifyPayPal.aspx"; Response.Redirect(objPayPal.GetSubmitUrl()); // UG.User objUser = new UG.User(); // objUser.FirstName = UG.Utility.Text.ProperCase(txtFirstName.Text.Trim()); // objUser.LastName = UG.Utility.Text.ProperCase(txtLastName.Text.Trim()); // objUser.Email = txtEmail.Text.Trim(); // objUser.Password = UG.Utility.Password.EncodePassword(UG.Utility.Password.RandomPasword(8, 12), UG.Utility.Password.PasswordFormat.Encrypted); // objUser.Address = txtAddress.Text; // objUser.City = UG.Utility.Text.ProperCase(txtCity.Text.Trim()); // objUser.State = UG.Utility.Text.ProperCase(txtState.Text.Trim()); // objUser.Zip = txtZip.Text.Trim(); // objUser.Phone = System.Text.RegularExpressions.Regex.Replace(txtPhone.Text.Trim(), @"\D", ""); // objUser.ReferralCode = txtRefCode.Text.ToUpper(); // if (objUser.ValidateLogin(true)) // { // ErrLabel.Text = "Email address already exists."; // } // else // { // objUser.AddUser(); // if (!objUser.OperationStatus) // { // UG.PayPal.PayPalHelper objPayPal = new UG.PayPal.PayPalHelper(); // objPayPal.PayPalBaseUrl = System.Configuration.ConfigurationManager.AppSettings["PayPalBaseUrl"]; // objPayPal.AccountEmail = System.Configuration.ConfigurationManager.AppSettings["PayPalAccountMail"]; // objPayPal.Amount = decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["PayAmount"]); // objPayPal.ItemName = "Fantasy Football Draft Center"; // objPayPal.SuccessUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; // objPayPal.CancelUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; // objPayPal.Custom = objUser.UserID.ToString(); // //objPayPal.NotifyUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/NotifyPayPal.aspx"; // Response.Redirect(objPayPal.GetSubmitUrl()); // //Response.Redirect("BuyNow2.aspx?UID=" + objUser.UserID.ToString()); // //SendEmail(objUser.Email, objUser.FirstName + " " + objUser.LastName, objUser.Password); // //ErrLabel.Text = "You have registered successfully. Please check your mail for login information."; // //Response.AddHeader("refresh", "3;BuyNow2.aspx"); // } // else // { // ErrLabel.Text = objUser.OperationResult; // } // } //} //string userID = Request.QueryString["UID"] != null ? Request.QueryString["UID"].ToString() : "0"; //if (userID != "0") //{ //UG.PayPal.PayPalHelper objPayPal = new UG.PayPal.PayPalHelper(); //objPayPal.PayPalBaseUrl = System.Configuration.ConfigurationManager.AppSettings["PayPalBaseUrl"]; //objPayPal.AccountEmail = System.Configuration.ConfigurationManager.AppSettings["PayPalAccountMail"]; //objPayPal.Amount = decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["PayAmount"]); //objPayPal.ItemName = "Fantasy Football Draft Center"; //objPayPal.SuccessUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; //objPayPal.CancelUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks.aspx"; //objPayPal.Custom = userID; ////objPayPal.NotifyUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/NotifyPayPal.aspx"; //Response.Redirect(objPayPal.GetSubmitUrl()); } } protected void Page_Load(object sender, EventArgs e) { } protected void cmdContinue_Click(object sender, EventArgs e) { } protected void GCheckoutButton1_Click(object sender, ImageClickEventArgs e) { UG.Affiliate objAffiliate = new UG.Affiliate(); objAffiliate.ReferralCode = txtRefCode.Text.ToUpper(); objAffiliate.Email = ""; if (txtRefCode.Text.Trim() != "" && !objAffiliate.IsAffiliateExist()) { ErrLabel.Text = "Please enter correct referral code. This referral code does not exist."; return; } CheckoutShoppingCartRequest Req = GCheckoutButton1.CreateRequest(); decimal price = decimal.Parse(System.Configuration.ConfigurationManager.AppSettings["PayAmount"]); Req.AddItem("Draft Center", "The Revolutionary Fantasy Football Tool for Draft Day Domination!", price, 1, "" + txtRefCode.Text.Trim() + ""); Req.ContinueShoppingUrl = System.Configuration.ConfigurationManager.AppSettings["Site"] + "/Thanks2.aspx"; try { GCheckoutResponse Resp = Req.Send(); Response.Redirect(Resp.RedirectUrl); } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex, "Business Exception Policy"); ErrLabel.Text = "Due to some technical problem Google Checkout is not accessible. Please try after some time."; } } }