void myButtonClick(object sender, System.EventArgs e) { if (login.Text == "" || password.Text == "" || login.Equals("") || password.Equals("")) { myAlert.SetTitle("Validation Error"); myAlert.SetMessage("Please Enter Your User Name or Password"); myAlert.SetPositiveButton("OK", OkAction); myAlert.SetNegativeButton("Cancel", CancelAction); Dialog myDialog = myAlert.Create(); myDialog.Show(); } else { bool dbValidation = myDbInstance.checkUser(login.Text, password.Text); if (dbValidation) { CrossSecureStorage.Current.SetValue("userIdAuth", "" + myDbInstance.getUserId(login.Text) + ""); Intent welcome = new Intent(this, typeof(TabLib));//PokeballPage will be welcome.PutExtra("username", login.Text); welcome.PutExtra("password", password.Text); StartActivity(welcome); } else { myAlert.SetTitle("User or Password is incorrect"); myAlert.SetMessage("Try again!"); myAlert.SetPositiveButton("OK", OkAction); Dialog myDialog = myAlert.Create(); myDialog.Show(); } } }
public bool PassIsEmpty(EditText passTB) { if (passTB.Equals(String.Empty)) { EmptyPassHint(passTB); return(true); } return(false); }
private async void CreateBoardButton_Click(object sender, EventArgs e) { if (boardTitle.Equals("")) { var alert = new AlertDialog.Builder(this); alert.SetTitle("No Board name"); alert.SetMessage("Please enter a board name."); alert.SetPositiveButton("OK", (senderAlert, args) => { }); alert.Show(); } else { MainBoard mb = new MainBoard(beaconId, username, boardTitle.Text); if (isPrivateCheckbox.Checked) { if (boardPassword.Text.Equals("")) { var alert = new AlertDialog.Builder(this); alert.SetTitle("No password"); alert.SetMessage("Please enter a password to create a private board."); alert.SetPositiveButton("OK", (senderAlert, args) => { }); alert.Show(); return; } else { mb.Password = boardPassword.Text; mb.isPrivateBoard = true; } } bool created = await db_accessBoard.createNewBoard(beaconId, mb); if (created) { var boardActivity = new Intent(this, typeof(BoardActivity)); boardActivity.PutExtra("_boardType", "MainBoard"); boardActivity.PutExtra("_beaconID", beaconId); boardActivity.PutExtra("_username", username); boardActivity.PutExtra("_boardCreator", username); StartActivity(boardActivity); } else { var alert = new AlertDialog.Builder(this); alert.SetTitle("Board Not Created"); alert.SetMessage("The board could not be created"); alert.SetPositiveButton("OK", (senderAlert, args) => { }); alert.Show(); } } }
void myButtonClick(object sender, System.EventArgs e) { myAlert.SetTitle("Validation Error"); myAlert.SetMessage("Please Fill All Fields!"); myAlert.SetPositiveButton("OK", OkAction); bool validation = (firstName.Text == "" || email.Text == "" || password.Text == "" || firstName.Equals("") || email.Equals("") || password.Equals("")) ? true : false; if (validation) { myAlert.SetNegativeButton("Cancel", CancelAction); Dialog myDialog = myAlert.Create(); myDialog.Show(); } else { myDbInstance.insertNewUser(random.Next(), firstName.Text, email.Text, username.Text, password.Text); myAlert.SetTitle("You have created new account successfully!!"); myAlert.SetMessage("Proceed to login page"); myAlert.SetPositiveButton("OK", OkActionDone); Dialog myDialog = myAlert.Create(); myDialog.Show(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); //fatching information from login page myUserName = FindViewById <EditText>(Resource.Id.uname); myUserPasswd = FindViewById <EditText>(Resource.Id.userpassword); myLoginbtn = FindViewById <Button>(Resource.Id.loginBtn); mySignupBtn = FindViewById <Button>(Resource.Id.button1); alert = new Android.App.AlertDialog.Builder(this); myDB = new DBHelperClass(this); //fatching information from signup page mySignupBtn.Click += delegate { Intent newScreen = new Intent(this, typeof(SignUp)); StartActivity(newScreen); }; myLoginbtn.Click += delegate { if (myUserName.Equals("") || myUserPasswd.Equals("")) { alert.SetTitle("Error"); alert.SetMessage("Please Enter Valid Data"); alert.SetPositiveButton("OK", alertOKButton); alert.SetNegativeButton("Cancel", alertOKButton); Dialog myDialog = alert.Create(); myDialog.Show(); } else { var email = myUserName.Text; var myPassword = myUserPasswd.Text; string userValue = myUserName.Text.ToString(); var showResult = FindViewById <TextView>(Resource.Id.emailResult); var emailLoginResult = isValidEmail(userValue); System.Console.WriteLine("Username: ---- > " + email); System.Console.WriteLine("Password: ---- > " + myPassword); //myUserName.Error = "Plase enter Email Id"; c_login = myDB.Validate_LogIn(myUserName.Text); c_login.MoveToFirst(); var uname = c_login.GetString(c_login.GetColumnIndexOrThrow("email")); var upass = c_login.GetString(c_login.GetColumnIndexOrThrow("password")); if (uname == myUserName.Text && myUserPasswd.Text == upass) { Intent newScreen = new Intent(this, typeof(WelcomeScreen)); GlobalClass.Setemail(email); StartActivity(newScreen); } else { alert.SetTitle("Error"); alert.SetMessage("Please Enter Valid Data"); alert.SetPositiveButton("OK", alertOKButton); alert.SetNegativeButton("Cancel", alertOKButton); Dialog myDialog = alert.Create(); myDialog.Show(); } } }; }