//Agregando datos de Socio public static int AgregarSocio(Socio xSocio) { int retorno = 0; using (SqlConnection Conex = DBConex.Conexion()) { SqlCommand Comando = new SqlCommand(string.Format("Insert Into Socio (Cedula, Nombre, TelefonoCasa, TelefonoCell, Direccion, Correo) values ('{0}','{1}','{2}','{3}','{4}','{5}')", xSocio.Cedula, xSocio.Nombre, xSocio.Telefono_Casa, xSocio.Telefono_Cell, xSocio.Direccion, xSocio.Correo), Conex); retorno = Comando.ExecuteNonQuery(); } return(retorno); }
//Agregando prestamo public static int Prestarlibro(Libro xLibro, Socio xSocio, Prestamo xPrestamo) { int retorno = 0; using (SqlConnection Conex = DBConex.Conexion()) { SqlCommand Comando = new SqlCommand(string.Format("Insert Into Prestamo (FechaInicio, FechaFin, IDSocio, IDlibro) values ('{0}','{1}','{2}','{3}')", xPrestamo.Fecha_Inicio, xPrestamo.Fecha_Fin, xSocio.Cedula, xLibro.ID), Conex); retorno = Comando.ExecuteNonQuery(); } return(retorno); }
private void btnGuardar_Click(object sender, EventArgs e) { Socio xSocio = new Socio(); xSocio.Nombre = txtNombre.Text; xSocio.Cedula = txtCedula.Text; xSocio.Telefono_Casa = txtCasa.Text; xSocio.Telefono_Cell = txtCell.Text; xSocio.Correo = txtCorreo.Text; xSocio.Direccion = richDireccion.Text; int respuesta = DataBaseRegister.AgregarSocio(xSocio); if (respuesta > 0) { MessageBox.Show("Socio Guardado Exitosamente", "Guardando ...", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Hubo problemas, Verifique nuevamente", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnGuardar_Click(object sender, EventArgs e) { Libro libro = new Libro(); Socio socio = new Socio(); Prestamo prestamo = new Prestamo(); libro.Titulo = cmbLibro.SelectedText; //socio.Nombre = listSocios. prestamo.Fecha_Inicio = txtInicio.Text; prestamo.Fecha_Fin = txtFin.Text; int respuesta = DataBaseRegister.Prestarlibro(libro, socio, prestamo); if (respuesta > 0) { MessageBox.Show("Socio Guardado Exitosamente", "Guardando ...", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Hubo problemas, Verifique nuevamente", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }