Пример #1
0
        public bool CreateUser()
        {
            int rowsInserted;

            TabletUser user = new TabletUser()
            {
                Username         = this.Username,
                Password         = this.Password,
                Firstname        = this.Firstname,
                Lastname         = this.Lastname,
                Enabled          = this.Enabled,
                AccountActivated = this.AccountActivated,
                ClientUpdated    = DateTime.Now
            };

            using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            {
                conn.CreateTable <TabletUser>();
                rowsInserted = conn.Insert(user);
            }
            if (rowsInserted > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 public static TabletUser AuthenticateUser(string username, string password)
 {
     try
     {
         using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
         {
             TabletUser user = conn.Get <TabletUser>(username.ToLower());
             if (user.Username.ToLower().Equals(username) && user.Password.Equals(password))
             {
                 return(user);
             }
         }
     }
     catch (Exception)
     {
         return(null);
     }
     return(null);
 }