partial void DeleteUser(User instance);
 partial void InsertUser(User instance);
 partial void UpdateUser(User instance);
Exemplo n.º 4
0
        public static void ValidateUser(string ID, SocialConnectionType TypeID, string Token)
        {
            try
            {
                GamervineDataContext dContext = new GamervineDataContext();

                var gvUserId = from usc in dContext.UserSocialConnections
                               where usc.ConnectionUserId == ID && usc.Type == TypeID.GetHashCode()
                               select usc.UserId;

                if (gvUserId.Count() == 0)
                {
                    //User doesn't exist in the system, create new user records
                    User u = new User();
                    u.Email = string.Empty;
                    u.UserId = Guid.NewGuid().ToString();
                    u.State = State.Active.GetHashCode();
                    u.CreatedDate = DateTime.UtcNow;

                    UserSocialConnection usc = new UserSocialConnection();
                    usc.ConnectionUserId = ID;
                    usc.Token = Token;
                    usc.Type = TypeID.GetHashCode();
                    usc.UserId = u.UserId;
                    usc.UserSocialConnectionId = Guid.NewGuid().ToString();

                    dContext.Users.InsertOnSubmit(u);
                    dContext.UserSocialConnections.InsertOnSubmit(usc);

                    dContext.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Exception occurred in bcUser.ValidateUser -> " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }