private bool Valida_Registro() { bool band; if (Id_Socio.Text != "" && Convert.ToInt32(Id_Socio.Text) > 0 && buscaSocio(Convert.ToInt32(Id_Socio.Text)) == 1) { idSocio = Convert.ToInt32(Id_Socio.Text); band = true; } else { MessageBox.Show("Ingrese un valor Valido Para 'Id de Socio' Para Continuar"); Id_Socio.Focus(); band = false; return(band); } if (Id_Producto.Text != "" && Convert.ToInt32(Id_Producto.Text) > 0 && buscaProducto(Convert.ToInt32(Id_Producto.Text)) == 1) { idProducto = Convert.ToInt32(Id_Producto.Text); band = true; } else { MessageBox.Show("Ingrese un valor Valido Para 'Id de Producto' Para Continuar"); Id_Producto.Focus(); band = false; return(band); } return(band); }
private void Cobrar_Click(object sender, EventArgs e) { try { if (this.dataGridView1.RowCount > 0) { this.ventasTableAdapter.Alta_Venta(idVenta, idSocio, fechaVenta, total); this.ventasTableAdapter.Update(this.gym_Manager1DataSet.Ventas); this.ventasTableAdapter.Fill(this.gym_Manager1DataSet.Ventas); this.detalle_VentaTableAdapter.Limpia_Detalle(idVenta); this.detalle_VentaTableAdapter.Update(this.gym_Manager1DataSet.Detalle_Venta); this.detalle_VentaTableAdapter.Fill(this.gym_Manager1DataSet.Detalle_Venta); idVenta++; Id_de_Venta.Text = idVenta.ToString(); Total.Text = "$0.00"; Id_Socio.Clear(); Id_Socio.Enabled = true; Id_Socio.Focus(); } else { MessageBox.Show("Ingrese por lo menos un detalle de Venta Para Continuar"); } } catch (DBConcurrencyException ex) { MessageBox.Show(ex.Message); } }
private void Id_Socio_TextChanged(object sender, EventArgs e) { int datoT = 0, claveAux = 0; this.sociosTableAdapter.Update(this.gym_Manager1DataSet.Socios); if (Id_Socio.Text != "") { claveAux = int.Parse(Id_Socio.Text); if (buscaSocio(claveAux) != 1) { MessageBox.Show("El Id de Socio " + claveAux + " No Existe en la base de Datos, Ingrese un Id de Socio Valido"); Limpia_Registro_Socio(); Id_Socio.Focus(); } else { foreach (DataGridViewRow row in dataGridView4.Rows) { datoT = Convert.ToInt32(row.Cells["numeroSocioDataGridViewTextBoxColumn"].Value); if (datoT == claveAux) { Id_Socio.Text = Convert.ToString(row.Cells["numeroSocioDataGridViewTextBoxColumn"].Value); Nombre_Socio.Text = Convert.ToString(row.Cells["nombreDataGridViewTextBoxColumn"].Value); Apellido_Paterno.Text = Convert.ToString(row.Cells["apellidoPaternoDataGridViewTextBoxColumn"].Value); Apellido_Materno.Text = Convert.ToString(row.Cells["apellidoMaternoDataGridViewTextBoxColumn"].Value); } } } } else { Limpia_Registro_Socio(); Id_Socio.Focus(); } }