Esempio n. 1
0
        private Guid GetUserId()
        {
            // Create or find user
            var windowsAccount = Environment.UserDomainName + "\\" + Environment.UserName;
            using (WorkTrackDataContext dataContext = CreateDataContext())
            {
                var user =
                    (from dataUser in dataContext.Users
                     where dataUser.WindowsAccount == windowsAccount
                     select dataUser).FirstOrDefault();

                if (user == null)
                {
                    user = new User
                    {
                        Id = Guid.NewGuid(),
                        Active = true,
                        WindowsAccount = windowsAccount,
                        FullName = windowsAccount
                    };
                    dataContext.Users.InsertOnSubmit(user);
                    dataContext.SubmitChanges();
                }

                return user.Id;
            }
        }
Esempio n. 2
0
 partial void UpdateUser(User instance);
Esempio n. 3
0
 partial void DeleteUser(User instance);
Esempio n. 4
0
 partial void InsertUser(User instance);