Exemple #1
0
        public ActionResult Authenticate()
        {
            string Error = Request.QueryString["error"];

            if (!string.IsNullOrEmpty(Error))
            {
                return(View("Fail"));
            }

            string FacebookAccessToken = Facebook.GetAccessToken(Request.QueryString["code"]);

            //check if the user had given us the correct permissions
            if (!Facebook.hasPermission(FacebookAccessToken, "xmpp_login"))
            {
                return(View("NeedPermission"));
            }

            FacebookObject Person = Facebook.getPerson(FacebookAccessToken);

            Db.User User = db.ProcessToken(this.UserHash, 1, Person.id, Person.name, FacebookAccessToken, string.Empty, string.Empty, string.Empty).FirstOrDefault();

            //waardes voor de bronframe setten
            this.UserHash = User.Hash;
            Response.Cookies.Add(new HttpCookie("NetworkConnected", "facebook"));

            return(View());
        }
Exemple #2
0
        public static AdapterFacebookObject Create(FacebookObject i_FacebookObj)
        {
            AdapterFacebookObject adapter = null;

            if (i_FacebookObj.GetType() == typeof(Post))
            {
                adapter = new AdapterFacebookPost(i_FacebookObj);
            }
            else if (i_FacebookObj.GetType() == typeof(User))
            {
                adapter = new AdapterFacebookUser(i_FacebookObj);
            }
            else if (i_FacebookObj.GetType() == typeof(Album))
            {
                adapter = new AdapterFacebookAlbum(i_FacebookObj);
            }
            else if (i_FacebookObj.GetType() == typeof(Page))
            {
                adapter = new AdapterFacebookPage(i_FacebookObj);
            }
            else if (i_FacebookObj.GetType() == typeof(Event))
            {
                adapter = new AdapterFacebookEvent(i_FacebookObj);
            }
            else if (i_FacebookObj.GetType() == typeof(Checkin))
            {
                adapter = new AdapterFacebookCheckIn(i_FacebookObj);
            }
            else
            {
                throw new Exception("Illegal type of adapter.");
            }

            return(adapter);
        }
        internal static DescriptivePicture CreateDescriptivePicture(FacebookObject i_FacebookObject, Size i_Size)
        {
            DescriptivePicture descriptivePicture;

            if (i_FacebookObject is Album)
            {
                descriptivePicture = new AlbumEntry(i_FacebookObject as Album, i_Size);
            }
            else if (i_FacebookObject is User)
            {
                descriptivePicture = new FriendDescriptionEntry(i_FacebookObject as User, i_Size);
            }
            else if (i_FacebookObject is Event)
            {
                descriptivePicture = new EventEntry(i_FacebookObject as Event, i_Size);
            }
            else if (i_FacebookObject is Photo)
            {
                descriptivePicture = new DescriptivePhoto(i_FacebookObject as Photo, i_Size);
            }
            else
            {
                throw new ArgumentException(k_WrongArgumentExceptionMessage);
            }

            return(descriptivePicture);
        }
        private void fetchUserRideGroups()
        {
            try
            {
                string        userID       = r_LoggedInUser.Id;
                List <string> rideGroupIDs = r_DBHandler.FetchAllUserRideGroupsIDs(userID);

                foreach (string ID in rideGroupIDs)
                {
                    FacebookObject singleRideGroup = null;

                    try
                    {
                        singleRideGroup = FacebookWrapper.FacebookService.GetObject(ID);
                    }catch (Exception ex)
                    {
                        continue;
                    }

                    string    name      = "";
                    RideGroup rideGroup = null;

                    if (singleRideGroup is Group)
                    {
                        Group group = singleRideGroup as Group;
                        rideGroup = new RideGroup(group.Id, group.Name);
                        rideGroup.AddEvents(group.Events);
                        name = group.Name;
                    }
                    else if (singleRideGroup is FriendList)
                    {
                        FriendList friendList = singleRideGroup as FriendList;

                        rideGroup = new RideGroup(friendList.Name);

                        List <string> eventIds = r_DBHandler.FetchAllGroupRideEvents(friendList.Id);

                        foreach (string eventId in eventIds)
                        {
                            Event friendListEvent = FacebookWrapper.FacebookService.GetObject(eventId);
                            rideGroup.AddEvent(friendListEvent);
                        }

                        name = friendList.Name;
                    }

                    m_UserGroupNameIDMapping[name] = rideGroup;
                }
            }
            catch (Exception ex)
            {
                // ...
            }
        }
Exemple #5
0
 public void AddObject(FacebookObject obj)
 {
     if (objects.ContainsKey(obj.FacebookUserId))
     {
         var o           = objects[obj.FacebookUserId];
         var foundObject = o.FirstOrDefault(oo => oo.FacebookId == obj.FacebookId);
         if (foundObject == null)
         {
             o.Add(obj);
         }
     }
 }
        public ObjectDetails getObjectDetails(FacebookObject i_ObjectModel)
        {
            if (i_ObjectModel.GetType() == typeof(Post))
            {
                return(new PostDetails(i_ObjectModel));
            }
            else if (i_ObjectModel.GetType() == typeof(User))
            {
                return(new FriendDetails(i_ObjectModel));
            }

            return(null);
        }
Exemple #7
0
 public void AdaptFacebookObj(FacebookObject i_PostToAdapt)
 {
     if (i_PostToAdapt is Post)
     {
         this.Name        = (i_PostToAdapt as Post).Name;
         this.Message     = (i_PostToAdapt as Post).Message;
         this.LikedBy     = CollectionAdapter.AdaptCollection <UserAdapter, User>((i_PostToAdapt as Post).LikedBy);
         this.CreatedTime = (i_PostToAdapt as Post).CreatedTime;
     }
     else
     {
         throw new Exception("trying to adapt into a  PostAdapter an object that is not a Facebook Post");
     }
 }
Exemple #8
0
 public void AdaptFacebookObj(FacebookObject i_AlbumToAdapt)
 {
     if (i_AlbumToAdapt is Album)
     {
         this.Name       = (i_AlbumToAdapt as Album).Name;
         this.Message    = (i_AlbumToAdapt as Album).Message;
         this.LikedBy    = CollectionAdapter.AdaptCollection <UserAdapter, User>((i_AlbumToAdapt as Album).LikedBy);
         this.ImageSmall = (i_AlbumToAdapt as Album).ImageSmall;
     }
     else
     {
         throw new Exception("trying to adapt into a  AlbumAdatper an object that is not a Facebook album");
     }
 }
Exemple #9
0
 public void AdaptFacebookObj(FacebookObject i_UserToAdapt)
 {
     if (i_UserToAdapt is User)
     {
         this.Posts       = CollectionAdapter.AdaptCollection <PostAdapter, Post>((i_UserToAdapt as User).Posts);
         this.Albums      = CollectionAdapter.AdaptCollection <AlbumAdapter, Album>((i_UserToAdapt as User).Albums);
         this.Friends     = CollectionAdapter.AdaptCollection <UserAdapter, User>((i_UserToAdapt as User).Friends);
         this.FirstName   = (i_UserToAdapt as User).FirstName;
         this.Name        = (i_UserToAdapt as User).Name;
         this.LastName    = (i_UserToAdapt as User).LastName;
         this.ImageNormal = (i_UserToAdapt as User).ImageNormal;
     }
     else
     {
         throw new Exception("trying to adapt into a User Adapter an object that is not a Facebook User");
     }
 }
Exemple #10
0
        public int UpdateObject(FacebookObject obj)
        {
            if (objects.ContainsKey(obj.FacebookUserId))
            {
                var o = objects[obj.FacebookUserId];
                if (o != null)
                {
                    var foundObject = o.FirstOrDefault(oo => oo.FacebookId == obj.FacebookId);
                    if (foundObject != null)
                    {
                        o.Remove(foundObject);
                    }
                    o.Add(obj);

                    return(1);
                }
            }

            return(0);
        }
Exemple #11
0
            public DataObject(string transactionId,
                              string receiptData,
                              string productId,
                              string productTitle,
                              decimal valueToSum,
                              string currency,
                              string userId = "")
            {
                IsSandbox     = false;
                TransactionId = transactionId;
                AdvertiserId  = Trackbook.AdvertiserId;
                ProductTitle  = productTitle;
                ProductId     = productId;
                ValueToSum    = valueToSum;
                Currency      = currency;
#if UNITY_IOS
                BundleShortVersion = IOSHelper.ShortVersionName;
#endif
                Facebook    = new FacebookObject(userId);
                ReceiptData = receiptData;
            }
 public AdapterFacebookPage(FacebookObject i_FacebookObject) : base(i_FacebookObject)
 {
 }
 public FriendDetails(FacebookObject i_ObjectModel) : base()
 {
     ObjectModel = i_ObjectModel;
     extractDetailsFromObject();
 }
 public AdapterFacebookCheckIn(FacebookObject i_FacebookObject) : base(i_FacebookObject)
 {
 }
 protected AdapterFacebookObject(FacebookObject i_FacebookObject)
 {
     m_FacebookObject = i_FacebookObject;
 }
Exemple #16
0
 public AdapterFacebookUser(FacebookObject i_FacebookObject) : base(i_FacebookObject)
 {
 }
Exemple #17
0
 public AdapterFacebookAlbum(FacebookObject i_FacebookObject) : base(i_FacebookObject)
 {
 }
Exemple #18
0
 public FacebookObjectWrapper(FacebookObject i_FacebookObject)
 {
     m_FacebookObject = i_FacebookObject;
 }
 public void AdaptFacebookObj(FacebookObject i_ObjectToAdapt)
 {
     throw new NotImplementedException();
 }
 public AdapterFacebookEvent(FacebookObject i_FacebookObject) : base(i_FacebookObject)
 {
 }