private void cargarTipoCliente() { cbProducto.DataSource = NTipoCliente.Mostrar(); cbProducto.ValueMember = "Codigo"; cbProducto.DisplayMember = "TipoCliente"; cbProducto.SelectedIndex = -1; }
private void cargarTipoCliente() { cbTipoCliente.DataSource = NTipoCliente.Mostrar(); cbTipoCliente.ValueMember = "Codigo"; cbTipoCliente.DisplayMember = "TipoCliente"; cbTipoCliente.SelectedIndex = -1; //lblPrueba.Text = cbCategoria.SelectedValue.ToString(); }
private void Guardar() { try { string rpta = ""; if (this.txtNombre.Text.Trim() == string.Empty) { MensajeError("Ingrese el tipo de cliente"); errorIcono.SetError(txtNombre, "Ingrese el nombre"); } else { if (this.IsNuevo) { DataTable dtOrden = NCategoria.MostrarOrdenCategoria(); int orden = Convert.ToInt32(dtOrden.Rows[0][0].ToString()); rpta = NTipoCliente.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtDescripcion.Text.Trim()); } else { rpta = NTipoCliente.Editar(Convert.ToInt32(this.txtIdCategoria.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtDescripcion.Text.Trim()); } if (rpta.Equals("OK")) { if (this.IsNuevo) { } else { } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); this.tbInfo.SelectedIndex = 0; this.txtBuscar.Clear(); this.txtBuscar.Select(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void Mostrar() { this.dataListado.DataSource = NTipoCliente.Mostrar(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); if (this.dataListado.Rows.Count == 0) { this.dataListado.Visible = false; } else { this.dataListado.Visible = true; this.ocultarColumnas(); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("Está seguro de eliminar los registros?", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string codigo; string rpta = ""; foreach (DataGridViewRow row in dataListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { codigo = Convert.ToString(row.Cells[1].Value); rpta = NTipoCliente.Eliminar(Convert.ToInt32(codigo)); } } if (rpta.Equals("OK")) { //this.MensajeOK("Se eliminó correctamente el registro"); } else { this.MensajeError(rpta); } this.Mostrar(); this.Limpiar(); this.btnEliminar.Enabled = false; this.btnCancelar.Enabled = false; this.txtBuscar.Clear(); this.txtBuscar.Select(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardarCliente_Click(object sender, EventArgs e) { string rpta = NTipoCliente.GuardarCliente(lblMonto.Text, "00.00", lblBanderaComprobante.Text, txtDocumento.Text, cbTipoCliente, isNuevo, txtNombre.Text, txtDireccion.Text, txtIdCliente.Text); if (isNuevo && rpta != null) { this.txtIdCliente.Text = rpta; this.txtNombre.ReadOnly = true; this.txtDireccion.ReadOnly = true; this.btnGuardarCliente.Enabled = false; this.btnNuevo.Enabled = false; } else if (rpta == "OK") { this.txtNombre.ReadOnly = true; this.txtDireccion.ReadOnly = true; this.btnGuardarCliente.Enabled = false; this.btnNuevo.Enabled = false; } }
private void Buscar() { this.dataListado.DataSource = NTipoCliente.Buscar(this.txtBuscar.Text.Trim()); this.ocultarColumnas(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }