示例#1
0
        public async void Login()
        {
            //using(SQLiteConnection connection = new SQLiteConnection(DatabaseHelper.dbFile))
            //{
            //	connection.CreateTable<Users>();

            //	var user = connection.Table<Users>().Where(usr => usr.UserName == User.UserName).FirstOrDefault();

            //	if(user.Password == User.Password)
            //	{
            //		App.UserId = user.Id;
            //		HasLoggedIn?.Invoke(this, new EventArgs());
            //	}
            //}

            try
            {
                var user = (await App.MobileServiceClient.GetTable <Users>().Where(u => User.UserName == u.UserName)
                            .ToListAsync()).FirstOrDefault();

                if (user.Password == User.Password)
                {
                    App.UserId = user.Id;
                    HasLoggedIn?.Invoke(this, new EventArgs());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#2
0
        public async void Register()
        {
            //using (SQLiteConnection connection = new SQLiteConnection(DatabaseHelper.dbFile))
            //{
            //	connection.CreateTable<User>();

            //	var result = DatabaseHelper.Insert(User);

            //	if(result)
            //	{
            //		App.UserId = User.Id.ToString();
            //		HasLoggedIn?.Invoke(this, new EventArgs());
            //	}
            //}

            try
            {
                await App.MobileServiceClient.GetTable <Users>().InsertAsync(User);

                App.UserId = User.Id.ToString();
                HasLoggedIn?.Invoke(this, new EventArgs());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#3
0
        public void Register()
        {
            var result = DatabaseHelper.Insert <User>(User);

            if (result)
            {
                App.UserId = User.Id.ToString();
                HasLoggedIn?.Invoke(this, new EventArgs());
            }
        }
示例#4
0
 public void Register()
 {
     using (SQLiteConnection connection = new SQLiteConnection(DataBaseHelper.dbFile))
     {
         connection.CreateTable <User>();
         var result = DataBaseHelper.Insert(User);
         if (result)
         {
             App.UserId = User.Id.ToString();
             HasLoggedIn?.Invoke(this, new EventArgs());
         }
     }
 }
示例#5
0
 public void Login()
 {
     using (SQLiteConnection connection = new SQLiteConnection(DataBaseHelper.dbFile))
     {
         connection.CreateTable <User>();
         var user = connection.Table <User>().Where(x => x.UserName == User.UserName).FirstOrDefault();
         if (user.Password == User.Password)
         {
             App.UserId = user.Id.ToString();
             HasLoggedIn?.Invoke(this, new EventArgs());
         }
     }
 }