public override bool Editar() { bool retornar = false; DbVentana cone = new DbVentana(); try { retornar = cone.Ejecutar(String.Format("Update Usuarios set Contrasena='{0}',UserName='******',Nombre='{2}',Restriccion = {3}, Imagenes ='{4}' WHERE UsuariosId = {5}", this.Contrasena, this.UserName, this.Nombre, this.Restriccion, this.Imagenes, this.UsuarioId)); } catch (Exception ex) { throw ex; } return(retornar); }
public override bool Insertar() { DbVentana cone = new DbVentana(); bool retornar = false; try { retornar = cone.Ejecutar(String.Format("Insert into Usuarios(Contrasena,UserName,Restriccion,Nombre,Imagenes) Values('{0}','{1}', {2},'{3}','{4}')", this.Contrasena, this.UserName, this.Restriccion, this.Nombre, this.Imagenes)); } catch (Exception ex) { throw ex; } return(retornar); }
public override DataTable Listado(string Campos, string Condicion, string Orden) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); string campo = " '{0}'"; string OrdenFinal = ""; if (!Orden.Equals("")) { OrdenFinal = "Order by " + Orden; } return(dt = cone.ObtenerDatos(String.Format("Select " + Campos + " from Clientes " + Condicion + campo, Orden))); }
public override bool Insertar() { DbVentana cone = new DbVentana(); bool Retornar = false; try { Retornar = cone.Ejecutar(String.Format("Insert into Materiales(Detalle,Unidad,Cantidad,Precio) Values('{0}','{1}',{2},{3})", this.Detalle, this.Unidad, this.Cantidad, this.Precio)); cone.Ejecutar(String.Format("Insert into TotalMateriales(Total) Values({0}", this.Precio)); } catch (Exception ex) { throw ex; } return(Retornar); }
public void ObtenerProducto(string Producto) { DataTable dt = new DataTable(); DbVentana cone = new DbVentana(); try { dt = cone.ObtenerDatos(String.Format("Select * from Productos where Descripcion = '{0}'", Producto)); if (dt.Rows.Count > 0) { this.ProductoId = (int)dt.Rows[0]["ProductoId"]; } }catch (Exception ex) { throw ex; } }
protected void BuscarButton_Click(object sender, EventArgs e) { DbVentana cone = new DbVentana(); int id = convertirId(); if (string.IsNullOrWhiteSpace(IdTextBox.Text)) { Response.Write("<script>alert('Introdusca Id')</script>"); } else { DataSet ds = GetData(); Repeater1.DataSource = ds; Repeater1.DataBind(); } }
public void ObtenerValor(string Material) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); try { dt = cone.ObtenerDatos(String.Format("Select * from Materiales where Detalle ='{0}'", Material)); if (dt.Rows.Count > 0) { this.Cantidad = Convert.ToSingle(dt.Rows[0]["Cantidad"]); this.MaterialId = (int)dt.Rows[0]["MaterialId"]; } } catch (Exception ex) { throw ex; } }
public string ValidarCliente(string Nombre) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); string nombre = ""; dt = cone.ObtenerDatos(String.Format("Select Nombre from Clientes where Nombre = '{0}'", Nombre)); if (dt.Rows.Count > 0) { nombre = dt.Rows[0]["Nombre"].ToString(); } else { nombre = "no"; } return(nombre); }
protected void BuscarButton_Click(object sender, EventArgs e) { DbVentana cone = new DbVentana(); Usuario usu = new Usuario(); DataTable dt = new DataTable(); string Text = ""; string orden = ""; if (string.IsNullOrWhiteSpace(BuscarTextBox.Text) && UsuarioDropDownList.Text != "Todos los Usuarios") { Utilitarios.ShowToastr(this, "Error Campo Incorrecto", "Mensaje", "error"); } else { if (UsuarioDropDownList.Text == "Nombre") { Text = "Where Nombre = "; orden = BuscarTextBox.Text; } else if (UsuarioDropDownList.Text == "Todos los Usuarios") { Text = "--"; orden = "--"; } else if (UsuarioDropDownList.Text == "Nombre de Usuario") { Text = " where UserName = "******"Id") { Text = " where UsuariosId = "; orden = BuscarTextBox.Text; } DataSet ds = cone.GetData(usu.Listado("*", Text, orden)); Repeater.DataSource = ds; Repeater.DataBind(); // UsuarioImagen.Visible = false; } }
public override bool Buscar(int IdBuscado) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); bool Retornar = true; try { dt = cone.ObtenerDatos(String.Format("Select * from Materiales where idMaterial = {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.Detalle = dt.Rows[0]["Detalle"].ToString(); this.Unidad = dt.Rows[0]["Unidad"].ToString(); this.Cantidad = Convert.ToSingle(dt.Rows[0]["Cantidad"]); this.Precio = Convert.ToSingle(dt.Rows[0]["Precio"]); } } catch (Exception ex) { throw ex; } return(Retornar); }
public override DataTable Listado(string Campos, string Condicion, string Orden) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); string campo = " '{0}'"; string OrdenFinal = ""; if (!Orden.Equals("")) { OrdenFinal = "Order by " + Orden; } dt = cone.ObtenerDatos(String.Format("Select " + Campos + " from Usuarios " + Condicion + campo, Orden)); if (dt.Rows.Count > 0) { this.Restriccion = (int)dt.Rows[0]["Restriccion"]; this.UserName = dt.Rows[0]["UserName"].ToString(); } return(dt); }
public override bool Editar() { bool Retornar = false; DbVentana cone = new DbVentana(); try { Retornar = cone.Ejecutar(String.Format("Update Productos set Descripcion='{0}',Pie={1},MinimoPie={2} where ProductoId={3}", this.Descripcion, this.Pie, this.MinimoPie, this.ProductoId)); if (Retornar) { cone.Ejecutar(String.Format("Delete from ProductosDetalle where ProductoId={0}", this.ProductoId)); foreach (ProductosDetalle item in this.Detalle) { cone.Ejecutar(String.Format("Insert into ProductosDetalle(ProductoId,MaterialId,Asociacion) Values({0},{1},{2})", this.ProductoId, item.MaterialId, item.Asociacion)); } } }catch (Exception ex) { throw ex; } return(Retornar); }
public override bool Buscar(int IdBuscado) { DbVentana cone = new DbVentana(); DataTable dt = new DataTable(); bool Retornar = true; try { dt = cone.ObtenerDatos(String.Format("Select * from Usuario where IdUsuario = {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.IdUsuario = (int)dt.Rows[0]["IdUsuario"]; this.Contrasena = dt.Rows[0]["Contrasena"].ToString(); this.UserName = dt.Rows[0]["UserName"].ToString(); this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.Restriccion = (int)dt.Rows[0]["Restriccion"]; } } catch (Exception ex) { throw ex; } return(Retornar); }
public override bool Buscar(int IdBuscado) { DataTable dt = new DataTable(); DbVentana cone = new DbVentana(); bool Retornar = false; try { dt = cone.ObtenerDatos(String.Format("Select * from Cliente where IdCliente= {0}", IdBuscado)); if (dt.Rows.Count > 0) { this.IdCliente = (int)dt.Rows[0]["IdCliente"]; this.Nombre = dt.Rows[0]["Nombre"].ToString(); this.Telefono = dt.Rows[0]["Telefono"].ToString(); this.Cedula = dt.Rows[0]["Cedula"].ToString(); this.Direccion = dt.Rows[0]["Direccion"].ToString(); this.Email = dt.Rows[0]["Email"].ToString(); } }catch (Exception ex) { throw ex; } return(Retornar); }