private void ButtonAceptar_Click(object sender, EventArgs e) { if (this.LabelTitulo.Text == "Registrar Cliente") { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec RegistrarCliente '" + this.TextBoxNombre.Text + "', '" + this.TextBoxDireccion.Text + "', '" + this.TextBoxTelefono.Text + "', '" + this.TextBoxRUC.Text + "', '" + this.TextBoxRazonSocial.Text + "'"); MessageBox.Show("Registro Realiado con éxito", "Finalizado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec EditarCliente '" + this.id_cliente + "', '" + this.TextBoxNombre.Text + "', '" + this.TextBoxDireccion.Text + "', '" + this.TextBoxTelefono.Text + "', '" + this.TextBoxRUC.Text + "', '" + this.TextBoxRazonSocial.Text + "'"); MessageBox.Show("Edicion Realiada con éxito", "Finalizado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void ButtonPagar_Click(object sender, EventArgs e) { try { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec RegistrarVenta '" + this.ComboBoxAlmacen.Text + "', '" + this.ComboBoxDireccion.Text + "', '" + DateTime.Now.ToString("yyyy-MM-dd") + "', " + this.LabelTotalNum.Text + ", " + this.TextBoxPagar.Text); int ID_Venta = (int)ConsultasBaseDeDatos.ObtenerValorEnteroDeBDLuiguiBaretta("Select Max(ID_Venta) from Venta"); for (int x = 0; x < this.DataGridViewVentas.Rows.Count; x++) { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("Exec RegistrarVentaProducto " + ID_Venta + ", '" + this.DataGridViewVentas.Rows[x].Cells[0].Value + "', " + this.DataGridViewVentas.Rows[x].Cells[1].Value + ", " + this.DataGridViewVentas.Rows[x].Cells[2].Value); } } catch (Exception ex) { MessageBox.Show(ex.Message, "A ocurrido un Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { MessageBox.Show("Venta terminada con éxito", "Venta", MessageBoxButtons.OK, MessageBoxIcon.Information); LimpiarVenta(); } }
private void NumericUpDownCantidad_Llenar(object sender, EventArgs e) { if (this.NumericUpDownCantidad.Enabled) { this.NumericUpDownCantidad.Maximum = (decimal)(ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select Cantidad From Producto Where Descripcion Like '" + this.ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + this.ComboBoxTalla.Text + "'") - Valor_paraNumericdecimal()); if (this.NumericUpDownCantidad.Maximum > 0) { this.NumericUpDownCantidad.Minimum = 1; this.LabelCantidadMax.Text = "Max " + this.NumericUpDownCantidad.Maximum; this.LabelError.Visible = false; this.ButtonAnadirVenta.Enabled = true; } else { this.LabelError.Text = "La cantidad del producto seleccionado es 0"; this.LabelCantidadMax.Text = "Max 0"; this.LabelError.Visible = true; this.ButtonAnadirVenta.Enabled = false; } } else { this.NumericUpDownCantidad.Maximum = 0; } }
public void EstablecerFiltro(ref DataGridView vacio, string Cadena) { string salida_de_datos = ""; string[] palabras_busqueda = Cadena.Split(' '); foreach (string palabra in palabras_busqueda) { if (salida_de_datos.Length == 0) { salida_de_datos = "(Cast(ID_Cliente As varchar(30)) Like '%" + palabra + "%' OR " + "Almacen Like '%" + palabra + "%' OR " + "Direccion Like '%" + palabra + "%' OR " + "Telefono Like '%" + palabra + "%' OR " + "RUC Like '%" + palabra + "%')"; } else { salida_de_datos += " And (Cast(ID_Cliente As varchar(30)) Like '%" + palabra + "%' OR " + "Almacen Like '%" + palabra + "%' OR " + "Direccion Like '%" + palabra + "%' OR " + "Telefono Like '%" + palabra + "%' OR " + "RUC Like '%" + palabra + "%')"; } } Filtro = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select * from Cliente where " + salida_de_datos); vacio.DataSource = Filtro; }
private void ButtonActualizarPago_Click(object sender, EventArgs e) { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("exec pago_opc1 '" + TextBoxNuevoPago.Text + "', '" + DatagridViewRegistroDeVentas.CurrentRow.Cells[0].Value.ToString() + "', '" + LabelNumDeuda.Text + "'"); Registro_De_Ventas.EstablecerDatos(ref DatagridViewRegistroDeVentas); MessageBox.Show("Pago Realizado con éxito", "Pago Realizado", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void ButtonAnadirVenta_Click(object sender, EventArgs e) { float Precio = ConsultasBaseDeDatos.ObtenerValorFloatDeBDLuiguiBaretta("Select (PrecioVenta * GrupoPaquete) From Producto Where Descripcion Like '" + ComboBoxDescripcionDelProducto.Text + "' And Talla Like '" + ComboBoxTalla.Text + "'"); Precio *= (float)NumericUpDownCantidad.Value; this.DataGridViewVentas.Rows.Add(ComboBoxDescripcionDelProducto.Text, ComboBoxTalla.Text, NumericUpDownCantidad.Value, Precio); this.ButtonDeshacer.Enabled = true; this.TextBoxPagar.Enabled = true; EstablecerValoresTotales(); }
private void ComboBoxDescripcionDelProducto_Llenar(object sender, EventArgs e) { if (this.ComboBoxDescripcionDelProducto.Enabled) { this.ComboBoxDescripcionDelProducto.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Descripcion From Producto Group By Descripcion"); this.ComboBoxDescripcionDelProducto.DisplayMember = "Descripcion"; } else { this.ComboBoxDescripcionDelProducto.DataSource = null; } }
private void ComboBoxAlmacen_Llenar(object sender, EventArgs e) { if (this.ComboBoxAlmacen.Enabled) { this.ComboBoxAlmacen.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Almacen From Cliente Group By Almacen"); this.ComboBoxAlmacen.DisplayMember = "Almacen"; } else { this.ComboBoxAlmacen.DataSource = null; } }
private void ComboBoxTalla_Llenar(object sender, EventArgs e) { if (this.ComboBoxTalla.Enabled) { this.ComboBoxTalla.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Talla From Producto Where Descripcion Like '" + this.ComboBoxDescripcionDelProducto.Text + "'"); this.ComboBoxTalla.DisplayMember = "Talla"; } else { this.ComboBoxTalla.DataSource = null; } }
private void ComboBoxDireccion_Llenar(object sender, EventArgs e) { if (this.ComboBoxDireccion.Enabled) { this.ComboBoxDireccion.DataSource = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select Direccion From Cliente Where Almacen Like '" + this.ComboBoxAlmacen.Text + "'"); this.ComboBoxDireccion.DisplayMember = "Direccion"; } else { this.ComboBoxDireccion.DataSource = null; } }
public void EstablecerFiltro(ref DataGridView vacio, String Cadena) { string salida_de_datos = ""; string[] palabras_busqueda = Cadena.Split(' '); foreach (string palabra in palabras_busqueda) { if (salida_de_datos.Length == 0) { salida_de_datos = "(Cast(ID_Producto As varchar(30)) Like '%" + palabra + "%' OR " + "Codigo Like '%" + palabra + "%' OR " + "Referencia Like '%" + palabra + "%' OR " + "Descripcion Like '%" + palabra + "%' OR " + "Talla Like '%" + palabra + "%' OR " + "Cast(PrecioVenta As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(GrupoPrimavera As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(CasaFaska As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(Cantidad As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(CantidadPaquete As varchar(30)) Like '%" + palabra + "%')"; } else { salida_de_datos += "And (Cast(ID_Producto As varchar(30)) Like '%" + palabra + "%' OR " + "Codigo Like '%" + palabra + "%' OR " + "Referencia Like '%" + palabra + "%' OR " + "Descripcion Like '%" + palabra + "%' OR " + "Talla Like '%" + palabra + "%' OR " + "Cast(PrecioVenta As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(GrupoPrimavera As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(CasaFaska As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(Cantidad As varchar(30)) Like '%" + palabra + "%' OR " + "Cast(CantidadPaquete As varchar(30)) Like '%" + palabra + "%')"; } } Filtro = ConsultasBaseDeDatos.ObtenerTablaDeBDLuiguibaretta("Select * from Producto where " + salida_de_datos); vacio.DataSource = Filtro; }
private void ButtonAceptar_Click(object sender, EventArgs e) { if (this.LabelTitulo.Text == "Agregar Producto") { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("exec RegistrarProducto '" + this.TextBoxCodigo.Text + "', '" + this.TextBoxReferencia.Text + "', '" + this.TextBoxDescripcion.Text + "', '" + this.TextBoxTalla.Text + "', " + this.TextBoxPrecioVenta.Text + ", " + this.TextBoxGrupoPrimavera.Text + ", " + this.TextBoxCasaFaska.Text + ", " + this.TextBoxCantidad.Text + ", " + this.TextBoxCantidadPaquete.Text + ", " + this.TextBoxGrupoDePaquete.Text); MessageBox.Show("Registro Realiado con éxito", "Finalizado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { ConsultasBaseDeDatos.EjecutarProcedimientoEnBDLuiguiBaretta("exec EditarProducto " + this.ID + ", '" + this.TextBoxCodigo.Text + "', '" + this.TextBoxReferencia.Text + "', '" + this.TextBoxDescripcion.Text + "', '" + this.TextBoxTalla.Text + "', " + this.TextBoxPrecioVenta.Text + ", " + this.TextBoxGrupoPrimavera.Text + ", " + this.TextBoxCasaFaska.Text + ", " + this.TextBoxCantidad.Text + ", " + this.TextBoxCantidadPaquete.Text + ", " + this.TextBoxGrupoDePaquete.Text); MessageBox.Show("Edicion Realiada con éxito", "Finalizado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void login_Load(object sender, EventArgs e) { this.comboboxUser.DataSource = ConsultasBaseDeDatos.loginarametre("select name from master.sys.syslogins where dbname = 'LuiguiBaretta'"); this.comboboxUser.DisplayMember = "name"; }
public Login() { ConsultasBaseDeDatos.Creacion_base_de_datos(); InitializeComponent(); Encendido = false; }