Exemplo n.º 1
0
        private void btn_guardad_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txt_fechaRealDevolucion.Text != "") {
                    Prestamo unPrestamo = new Prestamo(Convert.ToInt32(txt_id.Text), Convert.ToInt32(txt_idBibliotecario.Text), Convert.ToInt32(txt_idUsuario.Text), txt_fechaPrestamo.Text, txt_fechaDevolucion.Text, txt_fechaRealDevolucion.Text, txt_estadoPrestamo.Text);
                    Atraso.agregar(new Atraso(0,Convert.ToInt32(txt_id.Text),txt_Sancion.Text,txt_estado.Text));
                    Validaciones.limpiaTextbox(this);
                }
                else
                {
                    MessageBox.Show("Debe ingresar la fecha de devolución");
                }

            }
            catch (Exception ex)
            {

            }
        }
Exemplo n.º 2
0
 public static void modificar(Prestamo elPrestamo)
 {
     Datos datos = new Datos();
     string sql = "UPDATE " + tabla + " SET fechaPrestamo='" + elPrestamo.FechaPrestamo + "',apellidfechaDevolucion" + elPrestamo.FechaDevolucion + "',fechaRealDevolucion='" + elPrestamo.FechaRealDevolucion + "',estadoPrestamo='" + elPrestamo.EstadoPrestamo + "' WHERE id='" + elPrestamo.Id + "'";
     datos.insertar(sql);
 }
Exemplo n.º 3
0
        public static void agregar(Prestamo elPrestamo)
        {
            Datos datos = new Datos();

            string sql = "INSERT INTO " + tabla + " (fechaPrestamo, fechaDevolucion, fechaRealDevolucion, estadoPrestamo) values('" + elPrestamo.FechaPrestamo + "','" + elPrestamo.FechaDevolucion+ "','" + elPrestamo.FechaRealDevolucion+ "','" + elPrestamo.EstadoPrestamo + "')";
            datos.insertar(sql);
        }
Exemplo n.º 4
0
        public static Prestamo buscar(int id)
        {
            Datos datos = new Datos();
            String sql = "SELECT * FROM " + tabla + " WHERE id='" + id + "'";
            SqlDataReader row = datos.buscar(sql);
            if (!row.Read())
            {
                datos.cn.Close();
                return null;
            }

            var unPrestamo = new Prestamo((int)row["id"],(int)row["idBibliotecario"],(int)row["idUsuario"],(String)row["fechaPrestamo"], (String)row["fechaDevolucion"], (String)row["fechaRealDevolucion"], (String)row["estadoPrestamo"]);

            datos.cn.Close();
            return unPrestamo;
        }