Documente Academic
Documente Profesional
Documente Cultură
.NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
/// <summary>
/// </summary>
public ClsConexion()
//
// TODO: Agregar aquí la lógica del constructor
//
string strConeccion =
ConfigurationManager.ConnectionStrings["BibliotecaConnectionString1"].ConnectionStrin
g;
oconecccion.ConnectionString = strConeccion;
oconecccion.Open();
AdaptadorDatos.Fill(Data, tabla);
oconecccion.Close();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// </summary>
this.codigo = codigo;
this.nombre = nombre;
this.tiempo = tiempo;
conectar(tabla);
DataRow fila;
fila = Data.Tables[tabla].NewRow();
fila["areCodigo"] = codigo;
fila["areNombre"] = Nombre;
fila["areTiempo"] = tiempo;
Data.Tables[tabla].Rows.Add(fila);
AdaptadorDatos.Update(Data, tabla);
conectar(tabla);
DataRow fila;
int x = Data.Tables[tabla].Rows.Count - 1;
fila = Data.Tables[tabla].Rows[i];
if (int.Parse(fila["areCodigo"].ToString()) == valor)
fila = Data.Tables[tabla].Rows[i];
fila.Delete();
DataTable tablaborrados;
tablaborrados = Data.Tables[tabla].GetChanges(DataRowState.Deleted);
AdaptadorDatos.Update(tablaborrados);
Data.Tables[tabla].AcceptChanges();
return true;
return false;
}
INGRESO DE LOS LIBROS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
try
are.Codigo = int.Parse(TxtCodigo.Text);
are.Nombre = TxtNombre.Text;
are.Tiempo = int.Parse(TxtTiempo.Text);
are.agregar();
TxtCodigo.Text = "";
TxtNombre.Text = "";
TxtTiempo.Text = "";
catch
}
CONSULTAR AREA
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
SqlDataSourceSelectingEventArgs e)
Eliminacion de areas
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
if (are.eliminar(int.Parse(DropDownList1.Text)))
CLASE LIBROS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// </summary>
public ClsLibros (int codigo, string nombre, int numpag, string autor, string editorial,
int
area)
this.codigo = codigo;
this.nombre = nombre;
this.numpag = numpag;
this.autor = autor;
this.editorial = editorial;
this.area = area;
conectar(tabla);
DataRow fila;
fila = Data.Tables[tabla].NewRow();
fila["libCodigo"] = codigo;
fila["libNombre"] = nombre;
fila["libNumPag"] = numpag;
fila["libAutor"] = autor;
fila["libEditorial"] = editorial;
fila["libArea"] = area;
Data.Tables[tabla].Rows.Add(fila);
AdaptadorDatos.Update(Data, tabla);
conectar(tabla);
DataRow fila;
int x = Data.Tables[tabla].Rows.Count - 1;
fila = Data.Tables[tabla].Rows[i];
if (int.Parse(fila["libCodigo"].ToString()) == valor)
fila = Data.Tables[tabla].Rows[i];
fila.Delete();
DataTable tablaborrados;
tablaborrados = Data.Tables[tabla].GetChanges(DataRowState.Deleted);
AdaptadorDatos.Update(tablaborrados);
Data.Tables[tabla].AcceptChanges();
return true;
return false;
}
INGRESO DE LIBROS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
try
lib.Codigo = int.Parse(TxtCodigoLb.Text);
lib.Nombre = TxtNombreLb.Text;
lib.NumPag = int.Parse(TxtNumPagLb.Text);
lib.Autor = TxtAutorLb.Text;
lib.Editorial = TxtEditorialLb.Text;
lib.Area = int.Parse(DropDownList1.Text);
lib.Agregar();
TxtCodigoLb.Text = "";
TxtNombreLb.Text = "";
TxtNumPagLb.Text = "";
TxtAutorLb.Text = "";
TxtEditorialLb.Text = "";
catch
{
LblEstadoLb.Text = "El Registro ya Existe";
CONSULTAR LIBROS
AutoEventWireup="true" CodeFile="pageConsultarLibros.aspx.cs"
Inherits="pageConsultarLibros" %>
Runat="Server">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
DataSourceID="SqlDataSource1" DataTextField="libNombre"
</asp:DropDownList>
ForeColor="#333333" GridLines="None">
<Columns>
SortExpression="libNombre" />
SortExpression="libNumPag" />
SortExpression="libAutor" />
SortExpression="libEditorial" />
SortExpression="libArea" />
</Columns>
/>
<PagerStyle BackColor="#666666" ForeColor="White"
HorizontalAlign="Center" />
ForeColor="#333333" />
</asp:GridView>
<SelectParameters>
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</asp:Content>
ELIMINAR LIBRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
if (are.eliminar(int.Parse(DropDownList1.Text)))
}
CLASE PRESTAMO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// </summary>
this.codigo = codigo;
this.fecha = fecha;
this.usuario = usuario;
}
conectar(tabla);
DataRow fila;
fila = Data.Tables[tabla].NewRow();
fila["preCodigo"] = codigo;
fila["preFecha"] = Fecha;
fila["preUsuario"] = Usuario;
Data.Tables[tabla].Rows.Add(fila);
AdaptadorDatos.Update(Data, tabla);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// </summary>
public ClsDtpPrestamos(int prestamo, int libro, int cantidad, string fechafin, string
fechadev)
this.prestamo = prestamo;
this.libro = libro;
this.cantidad = cantidad;
this.fechafin = fechafin;
this.fechadev = fechadev;
{
set { fechafin = value; }
conectar(tabla);
DataRow fila;
fila = Data.Tables[tabla].NewRow();
fila["dtpCodigo"] = prestamo;
fila["dtpLibro"] = libro;
fila["dtpCantidad"] = cantidad;
fila["dtpFechaFin"] = fechafin;
fila["dtpFechadev"] = fechadev;
Data.Tables[tabla].Rows.Add(fila);
AdaptadorDatos.Update(Data, tabla);
PRESTAMO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
{
}
try
pre.Codigo = int.Parse(TxtCodigoPre.Text);
pre.Fecha = TxtFechaPre.Text;
pre.Usuario = int.Parse(DropDownList1.Text);
pre.agregar();
TxtCodigoPre.Text = "";
TxtFechaPre.Text = "";
catch
try
dtp.Prestamo = int.Parse(DropDownList3.Text);
dtp.Libro = int.Parse(DropDownList2.Text);
dtp.Cantidad = int.Parse(TxtcantidadDtp.Text);
dtp.Fechafin = TxtLimiteDtp.Text;
dtp.Fechadev = TxtFechaDev.Text;
dtp.agregar();
TxtcantidadDtp.Text = "";
TxtLimiteDtp.Text = "";
TxtFechaDev.Text = "";
catch
CLASE USUARIO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
/// <summary>
/// </summary>
this.documento = documento;
this.nombre = nombre;
this.direccion = direccion;
this.telefono = telefono;
this.correo = correo;
this.estado = estado;
conectar(tabla);
DataRow fila;
fila = Data.Tables[tabla].NewRow();
fila["usuDocumento"] = documento;
fila["usuNombre"] = nombre;
fila["usuDireccion"] = direccion;
fila["usuTelefono"] = telefono;
fila["usuCorreo"] = correo;
fila["usuEstado"] = estado;
Data.Tables[tabla].Rows.Add(fila);
AdaptadorDatos.Update(Data, tabla);
conectar(tabla);
DataRow fila;
int x = Data.Tables[tabla].Rows.Count - 1;
fila = Data.Tables[tabla].Rows[i];
if (int.Parse(fila["usuDocumento"].ToString()) == valor)
fila = Data.Tables[tabla].Rows[i];
fila.Delete();
DataTable tablaborrados;
tablaborrados = Data.Tables[tabla].GetChanges(DataRowState.Deleted);
AdaptadorDatos.Update(tablaborrados);
Data.Tables[tabla].AcceptChanges();
return true;
return false;
USUARIO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
try
usu.Documento= int.Parse(TxtDocumentoUsu.Text);
usu.Nombre = TxtNombreUsu.Text;
usu.Direccion = TxtDireccionUsu.Text;
usu.Telefono = TxtTelefonoUsu.Text;
usu.Correo = TxtCorreoUsu.Text;
usu.Estado = TxtEstadoUsu.Text;
usu.agregar();
TxtDocumentoUsu.Text = "";
TxtNombreUsu.Text = "";
TxtDireccionUsu.Text = "";
TxtTelefonoUsu.Text = "";
TxtCorreoUsu.Text = "";
TxtEstadoUsu.Text = "";
catch
ELIMINAR USUARIO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
if (usu.eliminar(int.Parse(DropDownList1.Text)))