Пример #1
0
        private void Iniciarsesionbutton_Click(object sender, EventArgs e)
        {
            if (EmailtextBox.Text == "user" && PasswordtextBox.Text == "1234")
            {
                MainForm mnf = new MainForm();
                mnf.Show();
            }
            else
            {
                if (UsuariosBLL.ExisteUsuario(EmailtextBox.Text, PasswordtextBox.Text))
                {
                    MainForm mnf = new MainForm();
                    mnf.Show();
                }
                else
                {
                    ErroreserrorProvider.SetError(EmailtextBox, "El email o clave es incorrecto");
                    ErroreserrorProvider.SetError(PasswordtextBox, "El email o clave es incorrecto");
                    PasswordtextBox.Clear();
                }
            }

            EmailtextBox.Clear();
            PasswordtextBox.Clear();
        }
Пример #2
0
 private void PasswordtextBox_TextChanged(object sender, EventArgs e)
 {
     try
     {
         Convert.ToString(PasswordtextBox.Text);
     }
     catch (Exception)
     {
         if (PasswordtextBox.TextLength > 0)
         {
             MessageBox.Show("Eingabe kann nicht verarbeitet werden");
         }
         PasswordtextBox.Clear();
     }
 }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (NametextBox.Text == "")
     {
         NametextBox.Focus();
     }
     else if (PasswordtextBox.Text == "")
     {
         PasswordtextBox.Focus();
     }
     else
     {   // Sign in process
         int usertype;
         if (radioButton1.Checked == true)
         {
             //User 0
             usertype = 0;
         }
         else
         {
             //Admin 1
             usertype = 1;
         }
         try
         {
             conn.Open();
             // Insert to table
             SqlCommand com = new SqlCommand("INSERT INTO[user] (UserName,Password,UserType,Sign)  VALUES(@UserName,@Password,@UserType,@Sign)", conn);
             com.Parameters.AddWithValue("@UserName", NametextBox.Text);
             com.Parameters.AddWithValue("@Password", PasswordtextBox.Text);
             com.Parameters.AddWithValue("@UserType", usertype);
             com.Parameters.AddWithValue("@Sign", 0);
             com.ExecuteNonQuery();
             conn.Close();
             //After Insert Job :
             FUser_Load(sender, e); // Load again the form to refresh
             NametextBox.Text = PasswordtextBox.Text = "";
             NametextBox.Focus();
             MessageBox.Show("User has been registered", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception)
         {
             MessageBox.Show("This Username has been already exsit!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
 private bool IsFormValidate()
 {
     if (UserNametextBox.Text.Trim() == "")
     {
         MessageBox.Show("User Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         UserNametextBox.Clear();
         UserNametextBox.Focus();
         return(false);
     }
     if (PasswordtextBox.Text.Trim() == "")
     {
         MessageBox.Show("Password is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         PasswordtextBox.Clear();
         PasswordtextBox.Focus();
         return(false);
     }
     return(true);
 }
Пример #5
0
        public bool ValidarCampos()
        {
            if (UsuariotextBox.Text.Trim().Length < 1)
            {
                MessageBox.Show("Favor llenar los campos vacio.");
                UsuariotextBox.Focus();
                return(false);
            }
            if (PasswordtextBox.Text.Trim().Length < 1)
            {
                MessageBox.Show("Favor llenar los campos vacios.");
                PasswordtextBox.Focus();
                return(false);
            }



            return(true);
        }