protected void btn_comprasCosolas_Click(object sender, EventArgs e) { listarcompras(); double iva = 13; try { this.cp = new Compras(); this.cp.fecha_compra = DateTime.Today; this.cp.Departamento = "Consolas"; //this.cp.Articulo = nombreA; this.cp.Descripcion = Descripcion; this.cp.Precio = precio; this.cp.Cantidad = int.Parse(this.txtcantidad.Text); this.cp.Codigo_Articulo = codigo; this.cp.Descuento = double.Parse(precio) * 0.1; this.cp.Subtotal = double.Parse(precio) - this.cp.Descuento; this.cp.IVA = iva; this.cp.Usuario = Usuarios.Usuario; this.cp.Total_pagar = double.Parse(this.txtcantidad.Text) * this.cp.Subtotal; this.cp.Opc = 1; this.cph = new ComprasHelper(cp); this.cph.InsertarCompras(); EnviarCorreo(); this.lbl_estado.Text = "compra exitosa"; } catch (Exception ex) { this.lbl_estado.Text = ex.Message; } }
protected void btningresar_Click(object sender, EventArgs e) { //double descuento = int.Parse(precio) * 0.5; //double subtotal =int.Parse(precio)-descuento; listarcompras(); double iva = 13; try { this.cp = new Compras(); this.cp.fecha_compra = DateTime.Now; this.cp.Departamento = "Video Juegos"; //this.cp.Articulo =nombreA; this.cp.Descripcion = Descripcion; this.cp.Precio = precio; this.cp.Cantidad = int.Parse(this.txtcantidad.Text); this.cp.Codigo_Articulo = codigo; this.cp.Descuento = double.Parse(precio) * 0.5; this.cp.Subtotal = double.Parse(precio) - this.cp.Descuento; this.cp.IVA = iva; this.cp.Usuario = Usuarios.Usuario; this.cp.Total_pagar = double.Parse(this.txtcantidad.Text) * this.cp.Subtotal; this.cp.Opc = 1; this.cph = new ComprasHelper(cp); this.cph.InsertarCompras(); EnviarCorreo(); this.lbl_estado.Text = "compra exitosa"; //Response.Redirect("Factura.aspx"); } catch (Exception ex) { this.lbl_estado.Text = ex.Message; } }
protected void Bbusqueda_Click(object sender, EventArgs e) { try { datos = (DataTable)Gridfactura.DataSource; this.cp = new Compras(); this.cp.buscarfactura = this.txtbuscar.Text; this.cp.Opc = 1; this.cpH = new ComprasHelper(cp); this.datos = new DataTable(); Gridfactura.DataSource = this.cpH.BuscarFactura(); Gridfactura.DataBind(); } catch (Exception ex) { this.lblmensaje.Text = ex.Message; } }
private void listarcompras() { try { this.cp = new Compras(); this.cp.Opc = 1; this.cph = new ComprasHelper(cp); this.datos = new DataTable(); this.datos = this.cph.CargarCompras(); if (datos.Rows.Count >= 0) { DataRow fila = datos.Rows[0]; factura = int.Parse(fila["Numero_Factura"].ToString()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void listar() { try { this.cp = new Compras(); this.cp.opc = 1; this.cpH = new ComprasHelper(cp); this.datos = new DataTable(); this.datos = this.cpH.Cargar_Factura(); if (datos.Rows.Count >= 0) { this.Gridfactura.DataSource = datos; } } catch (Exception ex) { this.lblmensaje.Text = ex.Message; } }