public static int agregarUsuario(DELusuario nuevo) { int retorno = 0; using (SqlConnection Con = BD.ObtenerConexion()) { SqlCommand Comando = new SqlCommand(string.Format("execute FOUR_STARS.IngresarUsuarios '{0}', '{1}', {2}, '{3}', '{4}', '{5}', {6}, '{7}', '{8}', '{9}', (select cast('{10}' as datetime)) ", nuevo.username, nuevo.password, nuevo.cod_Rol, nuevo.nombre, nuevo.apellido, nuevo.tipoD, nuevo.numeroD, nuevo.mail, nuevo.telefono, nuevo.direccion, nuevo.fechaNac), Con); retorno = Comando.ExecuteNonQuery(); Con.Close(); } return(retorno); }
private void button1_Click(object sender, EventArgs e) { DELusuario nuevo = new DELusuario(); nuevo.username = usernameT.Text; nuevo.password = passwordT.Text; nuevo.cod_Rol = AbmRol.funcionesRol.BuscarCodigo(comboBox1.SelectedItem.ToString()); nuevo.nombre = nombreT.Text; nuevo.apellido = apellidoT.Text; nuevo.tipoD = tipoDT.Text; nuevo.numeroD = Convert.ToInt32(numeroDT.Text); nuevo.mail = mailT.Text; nuevo.telefono = telefonoT.Text; nuevo.direccion = direccionT.Text; nuevo.fechaNac = masked.Text; int exito = funcionesUsuario.agregarUsuario(nuevo); if (exito > 0) { int x = funcionesUsuario.agregarUsuarioHotel(nuevo.username, Globals.codHotel); MessageBox.Show("Guardado con Exito"); } }