private void button1_Click(object sender, EventArgs e) { DataTable datos = new DataTable(); datos = log.Logueo(TxtUsu.Text, TxtPass.Text); if (datos.Rows.Count > 0) { if (datos.Rows[0][2].ToString() == TxtUsu.Text && datos.Rows[0][3].ToString() == TxtPass.Text) { MessageBox.Show("Ingreso Correcto", "Inicio", MessageBoxButtons.OK, MessageBoxIcon.Information); Formularios.Main inicio = new Formularios.Main(); Main.idvende = datos.Rows[0][0].ToString(); Main.nombrev = datos.Rows[0][1].ToString(); Main.nivel = datos.Rows[0][4].ToString(); inicio.Show(); this.Close(); } else { MessageBox.Show("Usuario o contraseña incorrecta, intente de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtPass.Clear(); TxtUsu.Clear(); } } else { MessageBox.Show("Error de inicio de sesion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TxtPass.Clear(); TxtUsu.Clear(); } }
private async void Btn_acessar_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtLogin.Text)) { await DisplayAlert("Aviso", "Ops, Algo errado, campo CPF vazio.", "Ok"); TxtLogin.Focus(); return; } if (string.IsNullOrEmpty(TxtPass.Text)) { await DisplayAlert("Aviso", "Ops, Algo errado, campo senha vazio.", "Ok"); TxtPass.Focus(); return; } this.IsBusy = true; await Delay(200); IDictionary <string, string> parametros = new Dictionary <string, string>(); parametros.Add("login", TxtLogin.Text.Replace("-", "").Replace(".", "")); parametros.Add("senha", TxtPass.Text); this.Logar(parametros); }
private void BtnConfirm_Click(object sender, EventArgs e) { if (TxtUser.Text == "" || TxtPass.Text == "") { MessageBox.Show(this, "Eines der Felder ist leer.", "Fehlerhafte Eingabe!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Check LoginData AuthHandler Auth = new AuthHandler(); AuthenticateResponse AuthData = new AuthenticateResponse(); try { AuthData = Auth.Authenticate(TxtUser.Text.ToString().Trim(), TxtPass.Text.ToString().Trim()); } catch (Exception ex) { MessageBox.Show(this, ex.Message.ToString(), "Fehlermeldung von Minecraft.net", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtPass.Focus(); TxtPass.SelectAll(); return; } // Load users.xml Manager U = new Manager(); oUser.accessToken = AuthData.AccessToken; oUser.clientToken = AuthData.ClientToken; U.SaveAccount(oUser); DialogResult = DialogResult.OK; Close(); } }
private void TxtUser_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TxtPass.Focus(); } }
private bool isformvalid() { if (TxtUName.Text == "") { Response.Write("<script> alert ('Kullanıcı Adı Giriniz'); </script>"); TxtUName.Focus(); return(false); } else if (TxtPass.Text != TxtCPass.Text) { Response.Write("<script> alert ('Şifreler Aynı Olmalı'); </script>"); TxtPass.Focus(); return(false); } else if (TxtMail.Text == "") { Response.Write("<script> alert ('Email Adresi Giriniz'); </script>"); TxtMail.Focus(); return(false); } else if (TxtName.Text == "") { Response.Write("<script> alert ('Ad Soyad Giriniz'); </script>"); TxtName.Focus(); return(false); } return(true); }
private void TxtUsuario_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { TxtPass.Focus(); } }
private void Login(string naam, string pass) // inlogknop { api api = new api(); User loginUser = api.GetUser(naam, pass); if (loginUser.Name != null) { GlobalSettings.Id = loginUser.Id; GlobalSettings.Naam = loginUser.Name; GlobalSettings.Email = loginUser.Email; GlobalSettings.Pass = loginUser.Password; char[] seperator = ".".ToCharArray(); GlobalSettings.AllergieList = loginUser.allergies.Split(seperator).ToList(); MainWindow.AppWindow.switchPage(2); MainWindow.AppWindow.EnableButtons(); MainWindow.AppWindow.GetShoppinglist(); } else { MessageBox.Show("Kan gebruiker niet vinden", "Error!", MessageBoxButton.OK); TxtUser.Clear(); TxtPass.Clear(); } }
protected void BtoIngresar_Click(object sender, EventArgs e) { if (TxtUsuario.Text.Length == 0) { LblMensaje.Text = "Campo requerido"; LblMensaje.Visible = true; TxtUsuario.Focus(); } else { if (TxtPass.Text.Length == 0) { LblMensaje.Text = "Campo requerido"; LblMensaje.Visible = true; TxtPass.Focus(); } else { if (TxtClinica.Text.Length == 0) { LblMensaje.Text = "Campo requerido"; LblMensaje.Visible = true; TxtClinica.Focus(); } else { LblMensaje.Text = "listo para ingresar"; LblMensaje.Enabled = true; } } } }
private void BtnLogin_Click(object sender, EventArgs e) { if (TxtUser.Text == "firas") { if (TxtPass.Text == "1234") { MessageBox.Show("Login Successful"); } else { MessageBox.Show("Incorrect Paasword"); } } else { MessageBox.Show("Incorrect Username"); } while (attempt <= MaxAttempts) { if (TxtUser.Text != username) { // username is incorrect MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining"); attempt++; TxtUser.Clear(); TxtPass.Clear(); return; } else { // username is correct // so check password if (TxtPass.Text != "1234") { // Incorrect password attempt++; MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining"); TxtUser.Clear(); TxtPass.Clear(); return; } else { //Both are correct attempt = 0; // reset the number of attempts MessageBox.Show("Login successful"); TxtUser.Clear(); TxtPass.Clear(); BtnLogin.Text = "Logout"; // this.Width = 1600; break; // come out of while loop }//endif }//endif }//end while }
void clear() { TxtId.Clear(); TxtNameUser.Clear(); TxtApellido.Clear(); TxtEdad.Clear(); TxtPass.Clear(); }
void Clear() { TxtId.Clear(); TxtNombre.Clear(); TxtApellido.Clear();; TxtEdad.Clear(); TxtPass.Clear(); }
private void BtnLogin_Click(object sender, EventArgs e) { if (!loggedin) { while (attempt <= MaxAttempts) { if (TxtUser.Text != username) { // username is incorrect MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining"); attempt++; TxtUser.Clear(); TxtPass.Clear(); return; // معناها عودة عشان يسجل دخول مرة ثانية. بدونها بيكمل البرنامج من نفسه ويرفض التسجيل } else { // username is correct // so check password if (TxtPass.Text != "1234") { // Incorrect password MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining"); attempt++; TxtUser.Clear(); TxtPass.Clear(); return; } else { //Both are correct attempt = 0; // reset the number of attempts loggedin = true; // you dont have to declear the variable toice MessageBox.Show(" Hi " + username + " your login successful "); TxtUser.Clear(); TxtPass.Clear(); BtnLogin.Text = "Logout"; //toolStripStatusLabel1.Text = "You are logged in."; هذا مرحلة قادمة // this.Width = 1600; break; // come out of while loop }//endif }//endif }//end while } }
private bool Validate() { if (string.IsNullOrEmpty(Txtnombre.Text)) { DisplayAlert("Error", "Debe ingresar un usuario", "Aceptar"); Txtnombre.Focus(); return(false); } else if (string.IsNullOrEmpty(TxtPass.Text)) { DisplayAlert("Error", "Debe ingresar una Contraseña", "Aceptar"); TxtPass.Focus(); return(false); } return(true); }
protected void TxtUsuario_TextChanged(object sender, EventArgs e) { if (TxtUsuario.Text == String.Empty) { string script = @"<script type='text/javascript'> alert('Campos vacíos...!!');</script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); //MessageBox.Show("Campos Vacíos...!!", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtPass.Text = ""; TxtPass.Enabled = false; } else { TxtUsuario.Text = varios.formatearRutcP(TxtUsuario.Text); TxtPass.Enabled = true; TxtPass.Focus(); } }
private void BtnLogin_Click(object sender, EventArgs e) { while (attempt <= maxattempts) { if (TxtUser.Text != username) { // username is incorrect MessageBox.Show("invalid username," + (maxattempts - attempt) + "attempts remaining"); TxtUser.Clear(); attempt++; return; } else { // username is correct // so check password if (TxtPass.Text != "4724") { attempt++; // incorrect password attempt++; MessageBox.Show("incorrect password" + (maxattempts - attempt) + "attempts remaining"); TxtPass.Clear(); return; } else { // both are correct attempt = 0; // reset the number of attempts MessageBox.Show("Login Successfull"); BtnLogin.Text = "Logout"; // this.width = 1600; break; // come out of while loop }// end if } // end if } // end while }
private bool Validate() { if (string.IsNullOrEmpty(TxtUsername.Text)) { DisplayAlert("Error", "Debe ingresar un nombre de usuario", "Aceptar"); TxtUsername.Focus(); return(false); } else if (string.IsNullOrEmpty(TxtEmail.Text)) { DisplayAlert("Error", "Debe ingresar un Correo Válido", "Aceptar"); TxtEmail.Focus(); return(false); } else if (string.IsNullOrEmpty(TxtPass.Text)) { DisplayAlert("Error", "Debe ingresar una Contraseña", "Aceptar"); TxtPass.Focus(); return(false); } else if (TxtPass.Text != TxtPassC.Text) { DisplayAlert("Error", "Las contraseñas no coinciden", "Aceptar"); TxtPass.Focus(); return(false); } try { MailAddress m = new MailAddress(TxtEmail.Text); } catch (FormatException) { DisplayAlert("Alerta", "Correo electrónico inválido", "Ok"); return(false); } Regex rgx = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$"); if (!rgx.IsMatch(TxtPass.Text)) { DisplayAlert("Error", "La contraseña debe contener de 8-15 caracteres; al menos 1 Mayúscula, Minúscula, Digito y Caracter especial", "OK"); return(false); } return(true); }
private void BtnLogin_Click(object sender, EventArgs e) { if (!loggedIn) { while (attempt <= MaxAttempts) { if (TxtUser.Text != username) { MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining"); attempt++; return; } else { if (TxtPass.Text != myPassword) { attempt++; MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining"); return; } else { attempt = 1; loggedIn = true; MessageBox.Show("Hi " + username + ", your login successful"); BtnLogin.Text = "Logout"; break; } } } } else { BtnLogin.Text = "Login"; loggedIn = false; TxtUser.Clear(); TxtPass.Clear(); } }
// Send server a login request containing user credentials private void BtnLogin_Click(object sender, EventArgs e) { // send a login request if (TxtUser.Text.Length > 3 && TxtPass.Text.Length > 3) { socket.Send(ASCIIEncoding.ASCII.GetBytes("[LOGIN_REQUEST]" + TxtUser.Text + "," + TxtPass.Text)); // set local user/pass variables user = TxtUser.Text; pass = TxtPass.Text; // clear the textboxes TxtPass.Clear(); TxtUser.Clear(); } else { LblStatus.Text = "Please enter a valid user/pass."; } }
private void Ingreso() { string consulta; consulta = "ValidarEntrada"; SqlConnection getconexion = Conexion.Cnn(); scmd = new SqlCommand(consulta, getconexion); scmd.Parameters.AddWithValue("@usu", TxtUser.Text); scmd.Parameters.AddWithValue("@pass", TxtPass.Text); scmd.CommandType = CommandType.StoredProcedure; scmd.ExecuteNonQuery(); sread = scmd.ExecuteReader(); if (sread.Read()) { if (sread["Usuario"].ToString() == TxtUser.Text && sread["Pass"].ToString() == TxtPass.Text) { Usuario.usuario = TxtUser.Text; int valor = p.Preferencia(TxtUser.Text.Trim()); if (valor == 1) { MenuDIC m = new MenuDIC(); this.Hide(); m.ShowDialog(); } else { MenuDOC call = new MenuDOC(); this.Hide(); call.ShowDialog(); } } } else { MessageBox.Show("Datos no coinciden", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtUser.Clear(); TxtPass.Clear(); } getconexion.Close(); }
public bool Validar() { bool retorno = true; if (string.IsNullOrEmpty((CmbInstancia.Text))) { errorP1.SetError(CmbInstancia, "Debe ingresar la instancia."); CmbInstancia.Focus(); retorno = false; } else { errorP1.SetError(CmbInstancia, ""); } if (string.IsNullOrEmpty((TxtBaseDatos.Text))) { errorP1.SetError(TxtBaseDatos, "Debe ingresar la base de datos."); TxtBaseDatos.Focus(); retorno = false; } else { errorP1.SetError(TxtBaseDatos, ""); } if (string.IsNullOrEmpty((TxtPass.Text))) { errorP1.SetError(TxtPass, "Debe ingresar la contraseña."); TxtPass.Focus(); retorno = false; } else { errorP1.SetError(TxtPass, ""); } return(retorno); }
private async void BuscarUsuario(IDictionary <string, string> cpf_buscar) { try { string retorno = CallWS.ChamaWs(cpf_buscar, "BuscarUsuario"); XDocument xml = XDocument.Parse(retorno); var dados = (from s in xml.Descendants("DadosUsuario") select new { dsTipo = s.Element("dsTipo").Value }).ToList(); if (dados.Count == 0) { await Navigation.PushAsync(new usuCad()); } else { if (dados[0].dsTipo == "APP") { await DisplayAlert("Alerta", "Bem vindo novamente, esse CPF já está cadastrado, " + "digite sua senha para acessar sua conta", "Aceitar"); TxtPass.Focus(); } else { await Navigation.PushAsync(new usuCad()); } } } catch { await DisplayAlert("Erro", "Não foi possível iniciar um novo cadastro agora!", "OK"); } }
private void BtRegistrar_Click(object sender, EventArgs e) { try { if (TxtPass.Text == TxtUserName.Text) { MessageBox.Show("El usuario y al contraseña no pueden ser iguales"); TxtUserName.Clear(); TxtPass.Clear(); return; } DataBaseControl DBControl = new DataBaseControl(DataBaseControl.cPath, "ProjectDataBase.mdf"); string[] parameters = { "@userName", "@pass", "cat" }; string[] elements = { TxtUserName.Text, TxtPass.Text, CBCat.SelectedItem.ToString() }; if (DBControl.Insertar("insert into Users values(@userName,@pass,@cat)", parameters, elements)) { string[] para = { "@id" }; string[] val = { System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() }; int activos = int.Parse(DBControl.BuscarElemento("select [registros] from Activos where [ID] = @id", para, val)); para = new string[] { "@id", "@nums" }; string[] nums = { System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(), (++activos).ToString(), }; DBControl.Insertar("update [Activos] set [registros]=@nums where [id]=@id", para, nums); MessageBox.Show("Usuario agregado"); this.Close(); } else { MessageBox.Show("El usuario no pudo ser agregado"); } DBControl.Close(); } catch (Exception) { MessageBox.Show("Por favor, verifique los datos"); } }
public void LimpiarTextBox() { TxtId.Clear(); TxtEmail.Clear(); TxtPass.Clear(); }
private void limpiar() { TxtPass.Clear(); TxtUsu.Clear(); }
protected void BtnReg_Click(object sender, EventArgs e) { if (TxtCity.SelectedValue == "-1") { TxtCity.Focus(); showErrorMwssage(4); } else if (DdlLicensCode.SelectedValue == "-1") { DdlLicensCode.Focus(); showErrorMwssage(5); } else { if (GlobFuncs.IsExist(TxtEmail.Text.ToString()) == true) { TxtEmail.Focus(); showErrorMwssage(6); } else if (checkbox1.Checked != true) { showErrorMwssage(7); } else if (TxtName.Text.Length == 0) { TxtName.Focus(); showErrorMwssage(8); } else if (TxtAddress.Text.Length == 0) { TxtAddress.Focus(); showErrorMwssage(9); } else if (TxtId.Text.Length == 0) { TxtId.Focus(); showErrorMwssage(10); } else if (TxtDateOfBirth.Text.Length == 0) { TxtDateOfBirth.Focus(); showErrorMwssage(11); } else if (TxtLicenseNumber.Text.Length == 0) { TxtLicenseNumber.Focus(); showErrorMwssage(12); } else if (TxtDateOfIssuanceLicense.Text.Length == 0) { TxtDateOfIssuanceLicense.Focus(); showErrorMwssage(13); } else if (TxtEmail.Text.Length == 0) { TxtEmail.Focus(); showErrorMwssage(14); } else if (TxtPass.Text.Length == 0) { TxtPass.Focus(); showErrorMwssage(15); } else if (TxtPhone.Text.Length == 0) { TxtPhone.Focus(); showErrorMwssage(16); } else { string pass = GlobFuncs.Hash(TxtPass.Text.ToString()); Users Us = new Users(-1, TxtName.Text.ToString(), TxtAddress.Text.ToString(), int.Parse(TxtCity.Text.ToString()), TxtId.Text.ToString(), DateTime.Parse(TxtDateOfBirth.Text), TxtLicenseNumber.Text.ToString(), int.Parse(DdlLicensCode.Text.ToString()), DateTime.Parse(TxtDateOfIssuanceLicense.Text), TxtEmail.Text.ToString(), pass, TxtPhone.Text.ToString()); person per = new person(); per = Us.RegUser(); sendRegMessage(per.CustomId, 0.ToString(), per.FullName); Session["Person"] = per; Response.Redirect("PrivateArea.aspx"); } } }
private void BtnSave_Click(object sender, EventArgs e) { if (TxtUser.Text == "" || TxtPass.Text == "") { MessageBox.Show(this, "Eines der Felder ist leer.", "Fehlerhafte Eingabe!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { // Check LoginData AuthHandler Auth = new AuthHandler(); AuthenticateResponse AuthData = new AuthenticateResponse(); try { AuthData = Auth.Authenticate(TxtUser.Text.ToString().Trim(), TxtPass.Text.ToString().Trim()); } catch (MCInvalidCredentialsException ex) { MessageBox.Show(this, ex.Message.ToString(), "Fehlermeldung von Minecraft.net", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtPass.Focus(); TxtPass.SelectAll(); return; } catch (MCUserMigratedException ex) { MessageBox.Show(this, ex.Message.ToString(), "Fehlermeldung von Minecraft.net", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtPass.Focus(); TxtPass.SelectAll(); return; } catch (Exception ex) { MessageBox.Show(this, ex.Message.ToString(), "Verbindungsfehler", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtPass.Focus(); TxtPass.SelectAll(); return; } MCUserAccount newAcc = new MCUserAccount { guid = Guid.NewGuid(), profiles = new List <MCUserAccountProfile>(), accessToken = AuthData.AccessToken, clientToken = AuthData.ClientToken, username = TxtUser.Text.ToString().Trim(), activeProfile = AuthData.SelectedProfile.Id }; for (int i = 0; i < AuthData.AvailableProfiles.Length; i++) { MCUserAccountProfile newprofile = new MCUserAccountProfile { id = AuthData.AvailableProfiles[i].Id, name = AuthData.AvailableProfiles[i].Name, legacy = AuthData.AvailableProfiles[i].Legacy }; newAcc.profiles.Add(newprofile); } Manager U = new Manager(); U.AddAccount(newAcc); // set default user if only one given MCUser user = U.GetAccounts(); if (U.GetNumAccounts() == 1) { U.SetDefault(newAcc.guid); } DialogResult = DialogResult.OK; Close(); } }
private void CmdAceptar_Click(object sender, EventArgs e) { DataTable dtResult = new DataTable(); if (TxtUsuario.Text == "") { MessageBox.Show("¡ Nombre del usuario incorrectos, Ingrese otro !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); TxtUsuario.Focus(); return; } if (TxtPass.Text == "") { MessageBox.Show("¡ Password incorrecto, Ingrese otro !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); TxtPass.Focus(); return; } ObternerBD(n_IdEmpresa); if (intOportunidades <= 3) { CN_sys_usuarios objUsuario = new CN_sys_usuarios(); objUsuario.mysConec = Program.mysConeccion; dtResult = objUsuario.TraerUsuario(TxtUsuario.Text, TxtPass.Text, Convert.ToInt32(Program.STU_SISTEMA.EMPRESAID), Convert.ToInt32(Program.STU_SISTEMA.SYS_UNIUSU)); intOportunidades = intOportunidades + 1; if (dtResult.Rows.Count == 0) { MessageBox.Show("¡ Usuario o Password incorrectos, Ingrese otro !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else { Program.STU_SISTEMA.USUARIOALIAS = TxtUsuario.Text; Program.STU_SISTEMA.USUARIOID = Convert.ToInt32(dtResult.Rows[0]["n_id"].ToString()); Program.STU_SISTEMA.USUARIOPERFIL = Convert.ToInt32(dtResult.Rows[0]["n_idperfil"].ToString()); this.Hide(); this.Close(); FrmSelEmpresa miForm = new FrmSelEmpresa(); miForm.n_VienedelMenu = 0; miForm.mysConec = mysConeccion; miForm.ShowDialog(); //this.Hide(); //this.Close(); //FrmMenu10 xFrmMenu = new FrmMenu10(); //Program.STU_SISTEMA.USUARIOALIAS = TxtUsuario.Text; //Program.STU_SISTEMA.USUARIOID = Convert.ToInt32(dtResult.Rows[0]["n_id"].ToString()); //Program.STU_SISTEMA.USUARIOPERFIL = Convert.ToInt32(dtResult.Rows[0]["n_idperfil"].ToString()); //objTC.mysConec = mysConeccion; //objTC.TraerTC(DateTime.Now.ToString("dd/MM/yyyy"), 151); //dtResult = objTC.dtLista; //if (dtResult.Rows.Count != 0) //{ // Program.STU_SISTEMA.TIPOCAMBIO = Convert.ToDouble(dtResult.Rows[0]["n_impven"]); // objTC = null; //} //else //{ // Program.STU_SISTEMA.TIPOCAMBIO = 0; //} //Program.GuardarIngreso(1); //xFrmMenu.ShowDialog(); } } else { MessageBox.Show("¡ Ha excedido el numero de oportunidades para ingresar al sistema !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); mysConeccion = null; this.Close(); Close(); } }
private void selection_changed(object sender, SelectionChangedEventArgs e) { TxtPass.Clear(); TxtPass.Focus(); }
/// <summary> /// método logout /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Logout(object sender, FormClosedEventArgs e) { TxtNombre.Clear(); TxtPass.Clear(); this.Show(); }