コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Request.QueryString["Tx_Key"] != null) && (Request.QueryString["Tx_Key"] != ""))
            {
                Tx_Key = Convert.ToInt32(Request.QueryString["Tx_Key"].ToString());

                if (Tx_Key == 0)
                {
                    //they cancelled
                    pnlerror.Visible = true;
                    pnlworked.Visible = false;
                }
                else
                {
                    //it worked
                    lblid.Text = Tx_Key.ToString();
                    BlueIkons_DB.SPs.UpdateTransaction(Tx_Key, 0, 0, 0, 2, "", "").Execute();
                    Site sitetemp = new Site();

                    gift giftinfo = sitetemp.GetGiftInfo(Tx_Key);

                    string strapprurl = ConfigurationManager.AppSettings.Get("App_URL").ToString();
                    string strpicurl = ConfigurationManager.AppSettings.Get("BlueIkons_Pics").ToString() + giftinfo.blueikon.ToString() + ".png";
                    if (giftinfo.fbpost)
                    {
                        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;
                        if (receivername.ToLower() == "none")
                        {
                            receivername = "";
                        }
                        string strmessage = "Just sent " + receivername +" a gift using BlueIkons";
                        string strdescription = receivername + ", you can claim your gift by clicking on the BlueIkons image";
                        sitetemp.Facebook_PostLink_OnWall(giftinfo.sender_fbid.ToString(), strapprurl, strmessage, strpicurl, "BlueIkons, Faster than a Gift Card and more Fun!", accesstoken, "", strdescription);
                    }

                    SendEmail se = new SendEmail();
                    se.Send_GiftEmail(Tx_Key, 0);
                    se.Send_GiftEmail(Tx_Key, 1);
                }
            }
        }
コード例 #2
0
ファイル: SendEmail.cs プロジェクト: BlueIkons/BlueIkons
        public void Send_GiftEmail(int giftkey,int type)
        {
            Site sitetemp = new Site();

            gift giftinfo = sitetemp.GetGiftInfo(giftkey);
            fbuser fbuser = sitetemp.Getfbuser(giftinfo.sender_fbid);

            string thebody="";
            string strsubject="";
            string stremailaddress = "";
            //type = 0 Sender email
            //type = 1 Receiver email
            if (type == 0){
                thebody = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("/Emails/SenderEmail1.txt"));
                strsubject = "Your BlueIkons gift has been sent";
                stremailaddress = fbuser.Email;
            }
            else if (type == 1)
            {
                thebody = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("/Emails/ReceiverEmail1.txt"));
                strsubject = fbuser.Firstname + " " + fbuser.Lastname + " has sent you a BlueIkons gift of " + decimal.Round(giftinfo.amount,2).ToString();
                stremailaddress = giftinfo.receiver_email;
            }
            string strpicurl = ConfigurationManager.AppSettings.Get("BlueIkons_Pics").ToString() + giftinfo.blueikon.ToString() + ".png";
            string strapprurl = ConfigurationManager.AppSettings.Get("App_URL").ToString() + "getgift.aspx?invite=" + giftkey.ToString();

            thebody = thebody.Replace("FIRSTNAME", fbuser.Firstname);
            thebody = thebody.Replace("LASTNAME", fbuser.Lastname);
            thebody = thebody.Replace("AMOUNT", decimal.Round(giftinfo.amount,2).ToString());
            thebody = thebody.Replace("WITTYMESSAGE", giftinfo.witty_message);
            thebody = thebody.Replace("IMAGE", strpicurl);
            thebody = thebody.Replace("CLAIMURL", strapprurl);
            thebody = thebody.Replace("RECEIVEREMAIL", giftinfo.receiver_email);

            Send_Email(fbuser.Email, stremailaddress, strsubject, thebody);
        }