Exemplo n.º 1
0
 private void Btn_New_Click(object sender, EventArgs e)
 {
     _User.Nick         = Txt_Nick.Text.ToString();
     _User.Password     = "******";
     _User.Name         = Txt_Name.Text.ToString();
     _User.Surname      = Txt_Surname.Text.ToString();
     _User._userType.Id = Convert.ToInt32(((DataRowView)cbprofile.SelectedItem)["Id"]);
     if (Txt_Nick.Text.Trim() != "")
     {
         Error.Clear();
         if (Txt_Name.Text.Trim() != "")
         {
             Error.Clear();
             if (Txt_Surname.Text.Trim() != "")
             {
                 Error.Clear();
                 var uschk = _User.CheckUser(Txt_Nick.Text);
                 if (uschk == true)
                 {
                     Error.SetError(Txt_Nick, "El nombre de usuario " + _User.Nick + " ya existe en el sistema.\nPor favor ingrese otro para continuar.");
                     Txt_Nick.Clear();
                 }
                 else
                 {
                     _User.NewUser(_User);
                     MessageBox.Show("El usuario fue creado correctamente", "Registro de usuario", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     Txt_Surname.Clear();
                     Txt_Name.Clear();
                     Txt_Pass.Clear();
                     Txt_RPass.Clear();
                     Txt_Pass.Clear();
                     Txt_RPass.Clear();
                     Txt_Nick.Clear();
                     Txt_Nick.Clear();
                     L.Action     = "El usuario " + Users.CacheUser.Nick + " registró un nuevo usuario: " + _User.Nick;
                     L.ActionDate = DateTime.Now;
                     L._users.Id  = Users.CacheUser.Id;
                     L.WriteLog(L);
                 }
             }//Apellido
             else
             {
                 Error.SetError(Txt_Surname, "Debe ingresar el apellido");
             }
         }//Name
         else
         {
             Error.SetError(Txt_Name, "Debe ingresar el nombre");
         }
     }//Nick
     else
     {
         Error.SetError(Txt_Nick, "Debe ingresar el nick del usuario");
     }
 }//BTN
Exemplo n.º 2
0
        private void Btn_UserPass_Click_1(object sender, EventArgs e)
        {
            frmMenu  frm      = new frmMenu();
            frmLogin frmLogin = new frmLogin();
            int      flag     = 0;

            if (Txt_Pass.Text == "")
            {
                Error.SetError(Txt_Pass, "Debe ingresar una contraseña");
                flag = 1;
            }
            if (Txt_Pass.TextLength >= 1 && Txt_Pass.TextLength < 6)
            {
                Txt_Pass.Clear();
                Txt_RPass.Clear();
                Txt_Pass.Focus();
                Error.SetError(Txt_Pass, "La contraseña debe tener 6 caractéres como mínimo");
                flag = 1;
            }
            if (Txt_Pass.Text != Txt_RPass.Text && flag == 0)
            {
                Error.SetError(Txt_Pass, "Las contraseñas escritas no son iguales");
                Error.SetError(Txt_RPass, "Las contraseñas escritas no son iguales");
                flag = 1;
            }

            if (Txt_Pass.Text == Txt_RPass.Text && flag == 0)
            {
                Error.Clear();
                _User.Nick     = Txt_Nick.Text.ToString();
                _User.Password = Txt_Pass.Text.ToString();
                _User.UpdatePass(_User);
                MessageBox.Show("La contraseña ha sido modificada exitósamente.\nDeberá volver a abir la aplicación", "Contraseña modificada", MessageBoxButtons.OK, MessageBoxIcon.Information);
                L.Action     = "El usuario " + Users.CacheUser.Nick + " modificó su contraseña";
                L.ActionDate = DateTime.Now;
                L._users.Id  = Users.CacheUser.Id;
                L.WriteLog(L);
                Application.Exit();
            }
        }
Exemplo n.º 3
0
 private void Txt_Pass_Enter(object sender, EventArgs e)
 {
     Lbl_ErrorPass.ResetText();
     Txt_Pass.ResetText();
 }