예제 #1
0
        protected void btnpf()
        {
            //Pay it forward
            DataSet dstemp = BlueIkons_DB.SPs.ViewFbidpendinggifts(fbuser.UID).GetDataSet();
            int giftkey = Convert.ToInt32(dstemp.Tables[0].Rows[0]["Gift_Key"]);
            gift giftinfo = siteTemp.GetGiftInfo(giftkey);

            PayPal pa = new PayPal();
            if (pa.ParallelPayment(Live_Trial, giftinfo, hdcharityemail.Value))
            {
                //Payment went through
                pnlpayforward.Visible = false;
                pnltxcompleted.Visible = true;
                pnltotal.Visible = false;

                if (giftinfo.fbpost)
                {
                    //post on facebook
                    DataSet dstemp2 = BlueIkons_DB.SPs.ViewFBUser(giftinfo.sender_fbid).GetDataSet();
                    string accesstoken = dstemp2.Tables[0].Rows[0]["Access_Token"].ToString();
                    string receivername = giftinfo.receiver_name;
                    string strmessage = "Paid it Forward";
                    string strdescription = "You too can send a gift by clicking on the image. BlueIkons. Faster than a GiftCard...and more Fun!";
                    string strpicurl = ConfigurationManager.AppSettings.Get("BlueIkons_Pics").ToString() + giftinfo.blueikon.ToString() + ".png";
                    siteTemp.Facebook_PostLink_OnWall(giftinfo.receiver_fbid.ToString(), strapprurl, strmessage, strpicurl, "BlueIkons, Faster than a Gift Card and more Fun!", accesstoken, "", strdescription);
                }
            }
            else
            {
                lblerror.Visible = true;
            }
        }
예제 #2
0
        protected void btnpaypal()
        {
            //Validation
            if (txtamount.Text == "")
            {
                txtamount.Text = "0";
            }
            if (decimal.Parse(txtamount.Text) <= 0)
            {
                lblerror.Text = "Enter amount greater than 0";
                txtamount.Text = "";
            }
            else if (txtemail.Text.Trim() == "")
            {
                lblerror.Text = "Enter receiver email";
            }
            else if (!chkterms.Checked)
            {
                lblerror.Text = "Agree to our Terms of Service (aka Legal Mumbo Jumbo)";
            }
            else
            {
                //validation ok
                if (txtwitty.Text == "")
                {
                    txtwitty.Text = "BlueIkons, faster than a Gift Card - and more fun!";
                }

                Int64 fbfriend = 0;
                if (!lblerrorfriend.Visible) //could choose from fbfriend list
                {
                    fbfriend = Convert.ToInt64(ddlfbfriend.SelectedValue);
                }

                StoredProcedure sp_UpdateGift = BlueIkons_DB.SPs.UpdateGift(0, fbuser.UID, fbfriend, txtemail.Text, txtwitty.Text, getselectedrdicon(), 0, chksharefb.Checked, ddlfbfriend.SelectedItem.Text);
                sp_UpdateGift.Execute();
                string tempGift_Key = sp_UpdateGift.Command.Parameters[6].ParameterValue.ToString();

                StoredProcedure sp_UpdateTransaction = BlueIkons_DB.SPs.UpdateTransaction(0, decimal.Parse(txtamount.Text), 0, Convert.ToInt32(tempGift_Key), 1, "", txtemail.Text);
                sp_UpdateTransaction.Execute();
                string tempTx_Key = sp_UpdateTransaction.Command.Parameters[2].ParameterValue.ToString();

                PayPal pp = new PayPal();
                string pakey = pp.SetPreapproval(fbuser, Live_Trial, Convert.ToInt32(tempTx_Key), decimal.Parse(txtamount.Text));
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "redirect", "");
                string ppredirect = "https://www.sandbox.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=" + pakey;

                //lblscript.Text = "<script language=javascript>alert('here');</script>";
                //hdpaypal.Value = ppredirect;
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert('standardone');","");

                HttpContext.Current.Response.Redirect("ppredirect.aspx?pakey="+pakey);

                //RadAjaxManager1.ResponseScripts.Add("gotourl('" + ppredirect  + "');");
                //RadAjaxPanel1.ResponseScripts.Add("displaypaypal();");
                //Response.Redirect(ppredirect);
                //pnlgotopaypal.Visible = true;
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            fbuser = siteTemp.getfbuser();
            if (!IsPostBack)
            {
                //populate charities info
                DataSet dstemp = BlueIkons_DB.SPs.ViewFbidpendinggifts(fbuser.UID).GetDataSet();
                if (dstemp.Tables[0].Rows.Count > 0)
                {
                    int giftkey = Convert.ToInt32(dstemp.Tables[0].Rows[0]["Gift_Key"]);
                    dstemp = BlueIkons_DB.SPs.ViewCharity(giftkey).GetDataSet();
                    lblcharityname.Text = dstemp.Tables[0].Rows[0]["Charity_Name"].ToString();
                    lblcharitydescription.Text = dstemp.Tables[0].Rows[0]["Charity_Description"].ToString();
                    hdcharityemail.Value = dstemp.Tables[0].Rows[0]["Charity_Email"].ToString();
                    gift giftinfo = siteTemp.GetGiftInfo(giftkey);
                    lblamount.Text = string.Format("{0:C}", giftinfo.amount);
                    lblhumanid.Text = giftkey.ToString();
                    lblgiftid.Text = giftinfo.Gift_Key.ToString();
                    lblgiftamount.Text = string.Format("{0:C}", giftinfo.amount);

                    lblinfo.Text = giftkey.ToString();
                    //check if gift is still good
                    if (siteTemp.Gifthasbeenreceived(giftkey))
                    {
                        Response.Redirect("givegift.aspx?fbid=" + fbuser.UID.ToString() + "&alert=1");
                    }
                    PayPal pp = new PayPal();
                    Transactions txinfo = siteTemp.Gettx(giftinfo.txkey);
                    if (!pp.PreapprovalActive(txinfo.pakey, Live_Trial,giftinfo.txkey))
                    {
                        //Is not active
                        Response.Redirect("givegift.aspx?fbid=" + fbuser.UID.ToString() + "&alert=2");
                    }
                }
            }

            if (Request.Form["__EVENTTARGET"] == "btnpf")
            {
                btnpf();
            }
            if (Request.Form["__EVENTTARGET"] == "btncollect")
            {
                btnpf();
            }
        }
예제 #4
0
        private void updateinvite(fbuser localfbuser)
        {
            //set fbid as receiver of gift
            int giftkey = 0;
            if (HttpContext.Current.Request.QueryString["invite"] != null)
            {
                giftkey = Convert.ToInt32(HttpContext.Current.Request.QueryString["invite"]);
            }
            else if (HttpContext.Current.Request.QueryString["invite"] != null)
            {
                giftkey = Convert.ToInt32(HttpContext.Current.Request.QueryString["invite"]);
            }

            //check if gift is still good
            if (Gifthasbeenreceived(giftkey))
            {
                HttpContext.Current.Response.Redirect("givegift.aspx?fbid=" + localfbuser.UID.ToString() + "&alert=1");
            }
            PayPal pp = new PayPal();
            try
            {
                gift giftinfo = GetGiftInfo(giftkey);
                Transactions txinfo = Gettx(giftinfo.txkey);
                if (!pp.PreapprovalActive(txinfo.pakey, Live_Trial, giftinfo.txkey))
                {
                    //Is not active
                    HttpContext.Current.Response.Redirect("givegift.aspx?fbid=" + localfbuser.UID.ToString() + "&alert=2");
                }

                if (!Gifthasreceiver(giftkey))
                {
                    BlueIkons_DB.SPs.UpdateGiftReceiver(giftkey, localfbuser.UID).Execute();
                }

                HttpContext.Current.Session["invite"] = null;
            }
            catch
            {
            }
        }