Пример #1
0
        public bool AddUser(string login, string email, string passwordHash)
        {
            try
            {
                Item item = new Item() { Type = Item.UserFolder, IdParent = null, IdFile = null, IdItem = null };
                User user = new User() { Login = login, Email = email, PasswordHash = passwordHash, Surname = "", Name = "", Patronymic = "", BornDate = null, Status = 0, Item = item, IsAdmin = false };

                if (user.CheckOnRegister() && IsLoginEmpty(login) && IsEmailEmpty(email))
                {
                    context.Items.InsertOnSubmit(item);
                    context.Users.InsertOnSubmit(user);
                    context.SubmitChanges();

                    return true;
                }
                else
                {
                    // запись в лог о попытке хака

                    return false;
                }
            }
            catch
            {
                return false;
            }
        }
 partial void DeleteUser(User instance);
 partial void UpdateUser(User instance);
		private void detach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Item = null;
		}
		private void attach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.Item = this;
		}
 partial void InsertUser(User instance);