示例#1
0
        public void SendFriendRequest(string fromUserString, string toUserString)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                using (var db = new OzwegoDataClassesDataContext(connection))
                {
                    var fromUser = GetUserFromEmailAddress(fromUserString);
                    var toUser   = GetUserFromEmailAddress(toUserString);

                    if ((fromUser != null) &&
                        (toUser != null))
                    {
                        var request = new friendRequest
                        {
                            from_user     = fromUser.ID,
                            to_user       = toUser.ID,
                            creation_time = DateTime.UtcNow
                        };

                        db.friendRequests.InsertOnSubmit(request);

                        try
                        {
                            db.SubmitChanges();
                        }
                        catch (Exception e)
                        {
                            Trace.WriteLine(string.Format(
                                                "Exception in Database.SendFriendRequest!\n Exception: {0} \n Callstack: {1}",
                                                e.Message,
                                                e.StackTrace));
                        }
                    }
                }
            }
        }
示例#2
0
 partial void DeletefriendRequest(friendRequest instance);
示例#3
0
        public void SendFriendRequest(string fromUserString, string toUserString)
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                using (var db = new OzwegoDataClassesDataContext(connection))
                {
                    var fromUser = GetUserFromEmailAddress(fromUserString);
                    var toUser = GetUserFromEmailAddress(toUserString);

                    if ((fromUser != null) &&
                       (toUser != null))
                    {
                        var request = new friendRequest
                            {
                                from_user = fromUser.ID,
                                to_user = toUser.ID,
                                creation_time = DateTime.UtcNow
                            };

                        db.friendRequests.InsertOnSubmit(request);

                        try
                        {
                            db.SubmitChanges();
                        }
                        catch (Exception e)
                        {
                            Trace.WriteLine(string.Format(
                                    "Exception in Database.SendFriendRequest!\n Exception: {0} \n Callstack: {1}",
                                    e.Message,
                                    e.StackTrace));
                        }
                    }
                }
            }
        }
示例#4
0
 partial void InsertfriendRequest(friendRequest instance);
示例#5
0
 partial void UpdatefriendRequest(friendRequest instance);
示例#6
0
 private void attach_friendRequests(friendRequest entity)
 {
     this.SendPropertyChanging();
     entity.user = this;
 }
示例#7
0
 private void detach_friendRequests1(friendRequest entity)
 {
     this.SendPropertyChanging();
     entity.user1 = null;
 }
 partial void DeletefriendRequest(friendRequest instance);
 partial void UpdatefriendRequest(friendRequest instance);
 partial void InsertfriendRequest(friendRequest instance);
		private void detach_friendRequests1(friendRequest entity)
		{
			this.SendPropertyChanging();
			entity.user1 = null;
		}
		private void attach_friendRequests(friendRequest entity)
		{
			this.SendPropertyChanging();
			entity.user = this;
		}