async void Click_Reg(object sender, EventArgs e)
        {
            if (txtuserid.Text != "")
            {
                RegEntity fileexist = App.Database.GetItem(txtuserid.Text);
                if (fileexist == null)
                {
                    if (txtname.Text != "" && txtpassword.Text != "" && txtuserid.Text != "")
                    {
                        RegEntity OReg = new RegEntity();
                        OReg.Name     = txtname.Text;
                        OReg.Username = txtuserid.Text;
                        OReg.Password = txtpassword.Text;
                        int i = App.Database.SaveItem(OReg);
                        if (i > 0)
                        {
                            await DisplayAlert("Registrtion", "Registrtion Success ... Login and Edit profile ", "OK");

                            await Navigation.PushModalAsync(new MainPage());
                        }
                        else
                        {
                            await DisplayAlert("Registrtion", "Registrtion Fail .. Please try again ", "OK");
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Registrtion Failed", "username already exist .. Please try differnt user name ", "OK");

                    txtuserid.Text = "";
                    txtuserid.Focus();
                }
            }
        }
Beispiel #2
0
 public void GetUserDetail(string userId)
 {
     userDetail       = App.Database.GetItem(userId);
     txtname.Text     = userDetail.Name;
     txtuserid.Text   = userDetail.Username;
     txtpassword.Text = userDetail.Password;
 }
Beispiel #3
0
 public int SaveItem(RegEntity item)
 {
     lock (locker)
     {
         if (item.ID != 0)
         {
             //Update Item
             database.Update(item);
             return(item.ID);
         }
         else
         {
             //Insert item
             return(database.Insert(item));
         }
     }
 }
Beispiel #4
0
        async void Click_Login(object sender, EventArgs e)
        {
            RegEntity userDetail = App.Database.GetItem(txtuserid.Text, txtpassword.Text);

            if (userDetail != null)
            {
                if (txtuserid.Text != userDetail.Username && txtpassword.Text != userDetail.Password)
                {
                    await DisplayAlert("Login", "Login failed .. Please try again ", "OK");
                }
                else
                {
                    await DisplayAlert("Registrtion", "Login Success ... Now Edit your profile ", "OK");

                    await Navigation.PushModalAsync(new Home(txtuserid.Text));
                }
            }
            else
            {
                await DisplayAlert("Login", "Login failed .. Please try again ", "OK");
            }
        }