Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
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
            {
            }
        }