private void AddButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var op = new FriendsAdd(_id, string.Empty, result =>
            {
                int res = result;

                Debug.WriteLine("FriendsAdd" + _id.ToString() + " " + res.ToString());

                Dispatcher.BeginInvoke(() =>
                {
                    try
                    {
                        if (_isMutual)
                        {
                            var friend = App.Current.EntityService.FriendsMutual.FirstOrDefault(x => x.Uid == _id);

                            if (friend != null)
                            {
                                App.Current.EntityService.FriendsMutual.Remove(friend);
                            }
                        }
                        else
                        {
                            var friend = App.Current.EntityService.FriendsRequests.FirstOrDefault(x => x.Uid == _id);

                            if (friend != null)
                            {
                                App.Current.EntityService.FriendsRequests.Remove(friend);
                                App.Current.EntityService.StateCounter.CountOfRequests = App.Current.EntityService.FriendsRequests.Count;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine("Removing friend request from FriendsRequests failed: " + ex.Message);
                    }

                    App.Current.EntityService.UpdateFriends();

                    NavigationService.Navigate(new Uri(@"/Views/FriendsPage.xaml", UriKind.Relative));
                });
            });

            op.Execute();
        }
Exemple #2
0
        public List <FriendsAdd> GetFriendAddList(System.Guid managerId)
        {
            var database = new SqlDatabase(this.ConnectionString);

            DbCommand commandWrapper = database.GetStoredProcCommand("C_Friend_FriendAddList");

            database.AddInParameter(commandWrapper, "@ManagerId", DbType.Guid, managerId);

            List <FriendsAdd> list = new List <FriendsAdd>();

            using (IDataReader reader = database.ExecuteReader(commandWrapper))
            {
                while (reader.Read())
                {
                    var obj = new FriendsAdd();
                    obj.ManagerId = (System.Guid)reader["ManagerId"];
                    obj.Name      = (System.String)reader["Name"];
                    list.Add(obj);
                }
            }

            return(list);
        }