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)); } } } } }
partial void DeletefriendRequest(friendRequest instance);
partial void InsertfriendRequest(friendRequest instance);
partial void UpdatefriendRequest(friendRequest instance);
private void attach_friendRequests(friendRequest entity) { this.SendPropertyChanging(); entity.user = this; }
private void detach_friendRequests1(friendRequest entity) { this.SendPropertyChanging(); entity.user1 = null; }