protected void btntest_Click(object sender, EventArgs e) { System.Collections.Hashtable hstemp = new System.Collections.Hashtable(); hstemp.Add("testingproperty", "5464"); External_APIs.Mixpanel mx = new External_APIs.Mixpanel(); mx.TrackEvent("Testing", 10,hstemp); }
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); }