コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: otarazan/socialermap
 private void loadStatistics(FacebookLayer fb)
 {
     // socialerMapFriends User/Facebook User
     lblFriendCount.Text = string.Format("{0}/{1}", fb.facebookData.SortedFriends.Rows.Count, fb.facebookData.FriendsData.Count);
     int i = 1;
     foreach (DataRow obj in fb.facebookData.SortedFriends.Rows)
     {
         lblRanking.Text += "<tr><td>" + i + "." + fb.facebookData.GetfriendName(obj[0].ToString()) + "</td><td>" + obj[1] + "</td></tr>";
         if (i++ > FacebookLayer.RANKING_LIST_SIZE)
         {
             break;
         }
     }
 }
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: otarazan/socialermap
        protected void Page_Load(object sender, EventArgs e)
        {
            var auth = new CanvasAuthorizer{Perms = "publish_stream"};

            FacebookLayer fb = new FacebookLayer(auth);
            if (auth.Authorize())
            {
                if (Request.QueryString["action"] != null)
                {
                    LocationActions(Request.QueryString, fb);
                }
                ShowFacebookContent(fb);
            }
        }
コード例 #3
0
ファイル: Default.aspx.cs プロジェクト: otarazan/socialermap
 private void LocationActions(NameValueCollection QueryString, FacebookLayer fb)
 {
     Database db = new Database();
     SocialerMapDbObject obj = new SocialerMapDbObject();
     switch (QueryString["action"])
     {
         case "delete":
             obj.LocationId = Request.QueryString["locationID"];
             db.DeleteSocialerObj(obj, fb.User.FacebookId);
             break;
         case "add":
             obj.UserId = fb.User.FacebookId;
             obj.Date = Request.QueryString["Date"];
             obj.Latitude = Request.QueryString["Latitude"];
             obj.Longitude = Request.QueryString["Longitude"];
             obj.PostToWall = Convert.ToBoolean(Request.QueryString["postwall"]);
             obj.Desc = Request.QueryString["description"];
             obj.Common = Convert.ToBoolean(Request.QueryString["common"]);
             string locationID = db.InsertSocialerObj(obj);
             if (obj.PostToWall)
             {
                 dynamic parameters = new ExpandoObject();
                 parameters.message = "Checked in via SocialerMap";
                 parameters.link = "http://apps.facebook.com/socialermapfbapp/Default.aspx?locationID=" +
                                   locationID;
                 parameters.name = QueryString["description"];
                 parameters.picture = "http://www.socialermap.com/socialermapfbapp/Resources/icon.png";
                 parameters.caption = "Find where i am at " + obj.Date;
                 parameters.privacy = new
                     {
                     value = "ALL_FRIENDS",
                 };
                 fb.fbClient.Post("/me/feed", parameters);
             }
             break;
     }
 }
コード例 #4
0
ファイル: Default.aspx.cs プロジェクト: otarazan/socialermap
 private void ShowFacebookContent(FacebookLayer fb)
 {
     if (!fb.isAccessTokenValid)
     {
         var settings = ConfigurationManager.GetSection("facebookSettings");
         var current = settings as IFacebookApplication;
         HttpCookie cookie = Response.Cookies["fbs_" + current.AppId];
         cookie.Value = null;
         cookie.Expires = DateTime.Now.AddDays(-1d);
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         ClientScript.RegisterStartupScript(this.GetType(), "loadMap",
                                            fb.LoadMap(Request.QueryString["date"], Request.QueryString["fid"],
                                                       Request.QueryString["locationID"]));
         cmbFriends.DataSource = fb.facebookData.FriendsData;
         cmbFriends.DataValueField = "FacebookId";
         cmbFriends.DataTextField = "FacebookName";
         cmbFriends.DataBind();
         cmbFriends.Items.Insert(0, new ListItem("All Friends", null));
         loadStatistics(fb);
     }
 }