public override bool Insert() { bool retorno = false; StringBuilder Comando = new StringBuilder(); try { retorno = con.Ejecutar(String.Format("Insert Into Registro(titulo, Descripcion, Ano, calificacion, IMDB, CategoriaId, Estudio) Values('{0}','{1}', {2}, {3}, {4}, {5}, '{6}')", this.Titulo, this.Descripcion, this.Ano, this.Calificacion, this.IMDB, this.CategoriapId, this.Estudio)); if (retorno) { this.PeliculaId = (int)con.getDatos("Select Max(PeliculaId) as PeliculaId from Registro").Rows[0]["PeliculaId"]; foreach (var autor in this.Actores) { Comando.AppendLine(String.Format("insert into PeliculasActores(PeliculaId,ActorId) Values({0},{1});", this.PeliculaId, autor.ActorId)); } retorno = con.Ejecutar(Comando.ToString()); } return(retorno); } catch (Exception) { return(false); } }
public override bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *from TiposCacao where TipoCacaoId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Descripcion = dt.Rows[0]["Descripcion"].ToString(); } return(dt.Rows.Count > 0); }
public override bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *from DestinosExportes where DestinoId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Pais = dt.Rows[0]["Pais"].ToString(); this.CodigoDestino = dt.Rows[0]["CodigoDestino"].ToString(); this.NombreDestino = dt.Rows[0]["NombreDestino"].ToString(); this.Direccion = dt.Rows[0]["Direccion"].ToString(); this.CodigoPostal = (int)dt.Rows[0]["CodigoPostal"]; } return(dt.Rows.Count > 0); }
public bool Login() { DataTable dt = new DataTable(); try { dt = conexion.getDatos(String.Format("Select NombreUsuario, Contrasena from Usuarios where NombreUsuario='{0}' and Contrasena='{1}'", this.NombreUsuario, this.Contrasena)); this.NombreUsuario = dt.Rows[0]["NombreUsuario"].ToString(); this.Contrasena = dt.Rows[0]["Contrasena"].ToString(); } catch (Exception) { return(false); } return(true); }
public override bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *from Inspecciones where InspeccionId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Fecha = dt.Rows[0]["Fecha"].ToString(); this.Fertilizantes = (int)dt.Rows[0]["Fertilizantes"]; this.MaterialSiembra = dt.Rows[0]["MaterialSiembra"].ToString(); this.CrianzaAnimales = (int)dt.Rows[0]["CrianzaAnimales"]; this.ControlPlagas = dt.Rows[0]["ControlPlagas"].ToString(); this.ResumenInspeccion = dt.Rows[0]["ResumenInspeccion"].ToString(); } return(dt.Rows.Count > 0); }
public override bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *from Socios where SocioId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.Apellido = dt.Rows[0]["Apellido"].ToString(); this.Direccion = dt.Rows[0]["Direccion"].ToString(); this.Cedula = dt.Rows[0]["Cedula"].ToString(); this.CantidadTerreno = (double)dt.Rows[0]["CantidadTerreno"]; this.Fertilizantes = (int)dt.Rows[0]["Fertilizantes"]; } return(dt.Rows.Count > 0); }
public override bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *Recepciones Lotes where RecepcionId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.RecepcionId = (int)dt.Rows[0]["RecepcionId"]; this.SocioId = (int)dt.Rows[0]["SocioId"]; this.CertificacionId = (int)dt.Rows[0]["CertificacionId"]; this.TipoCacaoId = (int)dt.Rows[0]["TipoCacaoId"]; this.Fecha = dt.Rows[0]["Fecha"].ToString(); this.CantidadPesada = (double)dt.Rows[0]["CantidadPesada"]; this.Observacion = dt.Rows[0]["Observacion"].ToString(); this.RecibidoPor = dt.Rows[0]["RecibidoPor"].ToString(); } return(dt.Rows.Count > 0); }
public bool Buscar(int IdBuscado) { DataTable dt; dt = conexion.getDatos(String.Format("select *from Cuentas where CuentaId= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Balance = (double)dt.Rows[0]["Balance"]; this.Descripcion = dt.Rows[0]["Descripcion"].ToString(); } return(dt.Rows.Count > 0); }
public override bool Insertar() { bool retorno = false; StringBuilder Comando = new StringBuilder(); try { retorno = conexion.Ejecutar(String.Format("Insert into Exportaciones(DestinoId, Monto, Fecha, Resumen) values({0}, {1}, '{2}', '{3}')", this.DestinoId, this.Monto, this.Fecha, this.Resumen)); if (retorno) { this.ExportacionId = (int)conexion.getDatos("Select Max(ExportacionId) as ExportacionId from Exportaciones").Rows[0]["ExportacionId"]; foreach (var lote in this.Lotes) { Comando.AppendLine(String.Format("Insert Into LotesExportes(LoteId, CodigoLote, ExportacionId) Values({0},'{1}', {2})", lote.LoteId, lote.CodigoLote, this.ExportacionId)); } retorno = conexion.Ejecutar(Comando.ToString()); } } catch (Exception ex) { throw ex; } return(retorno); }
public DataTable obtener(string Lote) { return(conexion.getDatos(String.Format("select LoteId from Lotes where CodigoLote = {0}", Lote))); }
public override DataTable Listar(string campos, string Filtro) { return(con.getDatos("Select " + campos + " from Generos where " + Filtro)); }