private void BtnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtRazon_Social.Text == string.Empty || this.txtNumDocumento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtRazon_Social, "Ingrese un Valor"); errorIcono.SetError(txtNumDocumento, "Ingrese un Valor"); errorIcono.SetError(txtDireccion, "Ingrese un Valor"); } else { if (this.IsNuevo) { rpta = NProveedor.Insertar(this.txtRazon_Social.Text.Trim().ToUpper(), this.cbSector_Comercial.Text, cbTipo_Documento.Text, txtNumDocumento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text, txtUrl.Text); } else { rpta = NProveedor.Editar(Convert.ToInt32(this.txtIdproveedor.Text), this.txtRazon_Social.Text.Trim().ToUpper(), this.cbSector_Comercial.Text, cbTipo_Documento.Text, txtNumDocumento.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text, txtUrl.Text); } if (rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOK("Se insertó de forma correcta el registro"); } else { this.MensajeOK("Se Actualizó de forma correcta el registro"); } } else { this.MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//Metodo buscar Razon social private void BuscarNombreRazonSocial() { this.dataListado.DataSource = NProveedor.BuscarRazonSocial(this.txtBuscar.Text); this.OcultarColumnas(); Listado.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count); this.dataListado.Columns[0].Visible = true; }
//Metodo buscar nro Documento private void BuscarNroDocumento() { this.dataListado.DataSource = NProveedor.BuscarNumDocmuento(this.txtBuscar.Text); this.OcultarColumnas(); Listado.Text = "Total de registros: " + Convert.ToString(dataListado.Rows.Count); this.dataListado.Columns[0].Visible = true; }
private void BtnEliminar_Click(object sender, EventArgs e) { try { DialogResult opciones; opciones = MessageBox.Show("Quieres Eliminar Registro", "Eliminar", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opciones == DialogResult.OK) { string codigo; foreach (DataGridViewRow filas in DgvListado.Rows) { if (Convert.ToBoolean(filas.Cells[0].Value)) { codigo = filas.Cells[1].Value.ToString(); NProveedor.Eliminar_proveedor(Convert.ToInt32(codigo)); } } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); MessageBox.Show("no se pudo eliminar"); } this.mostrar_proveedores(); }
private void BtnEditar_Click(object sender, EventArgs e) { NProveedor proveedor = new NProveedor(Convert.ToInt32(TxtidProveedor.Text), TxtRazon_social.Text, CmbSector_comercial.Text, CmbTipoDocumento.Text, TxtNum_documento.Text, TxtDireccion.Text, TxtTelefono.Text, TxtEmail.Text, TxtURL.Text); proveedor.editar(); this.mostrar_proveedores(); }
private void frmProveedor_Load(object sender, EventArgs e) { try { NProveedor listaPro = new NProveedor(); ListaProveedor = listaPro.ObtenerListaProveedor(); var lista = (from pro in ListaProveedor select new { Nombres = pro.nombres, Apellidos = pro.apellidos, Cedula = pro.cedula, Telefono = pro.telefono, Correo = pro.correo, Direccion = pro.direccion, Estado = pro.estado, pro.idProveedor }).ToList(); dgvProveedor.DataSource = lista; dgvProveedor.Columns["idProveedor"].Visible = false; ActualizarProveedor(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEliminar_Click(object sender, EventArgs e) { MessageBox.Show(NProveedor.Eliminar(Obtener_Id(AuxiliarNombre))); Mostrar(); btnEliminar.Enabled = false; btnEditar.Enabled = false; }
private void btnGuardar_Click(object sender, EventArgs e) { if (Editar == true) { if (Comprobar_Campos() == string.Empty) { if (Obtener_Id(AuxiliarNombre) == 0) { MessageBox.Show("Error: id no encontrado!"); } else { if (AuxiliarNombre == tbNombreProveedor.Text) { MessageBox.Show(NProveedor.Editar(Obtener_Id(tbNombreProveedor.Text), tbNombreProveedor.Text, tbContactoProveedor.Text)); Limpiar_Campos(); Editar = false; } else if (NombreExistente(tbNombreProveedor.Text)) { MessageBox.Show(string.Format("Error: el nombre '{0}' ya se encuentra en uso!", tbNombreProveedor.Text)); } else { MessageBox.Show(NProveedor.Editar(Obtener_Id(AuxiliarNombre), tbNombreProveedor.Text, tbContactoProveedor.Text)); Limpiar_Campos(); Editar = false; } } } else { MessageBox.Show(Comprobar_Campos()); } } else { if (Comprobar_Campos() == string.Empty) { if (NombreExistente(tbNombreProveedor.Text)) { MessageBox.Show(string.Format("Error: el nombre '{0}' ya se encuentra en uso!", tbNombreProveedor.Text)); } else { MessageBox.Show(NProveedor.Insertar(tbNombreProveedor.Text, tbContactoProveedor.Text)); Limpiar_Campos(); } } else { MessageBox.Show(Comprobar_Campos()); } } Mostrar(); }
//metodo guardar datos private void btnGuardar_Click(object sender, EventArgs e) { //insertar datos try { string rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtContacto.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados."); errorIcono.SetError(this.txtNombre, "Ingrese un nombre"); errorIcono.SetError(this.txtContacto, "Ingrese un contacto"); } else { if (this.EsNuevo) { //nombre,descripcion,imagen,activa rpta = NProveedor.Insertar(this.txtNombre.Text.Trim().ToUpper(), this.txtContacto.Text.Trim().ToUpper(), Convert.ToInt32(this.CheckearActivo(chkActivo))); } else { //id,nombre,descripcion,imagen,activa rpta = NProveedor.Editar(Convert.ToInt32(this.txtCodigo.Text), this.txtNombre.Text.Trim().ToUpper(), this.txtContacto.Text.Trim().ToUpper(), Convert.ToInt32(this.CheckearActivo(chkActivo))); } if (rpta.Equals("OK")) { if (this.EsNuevo) { this.MensajeOK("Se inserto de forma correcta el registro."); } else { this.MensajeOK("Se modificó de forma correcta el registro."); } } else { this.MensajeError(rpta); } //preparamos para nuevos datos this.EsNuevo = false; this.EsEditar = false; this.Botones(); this.LimpiarControles(); this.MostrarDatos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnguardar_Click(object sender, EventArgs e) { try { if (modificar) { EProveedor modProveedor = new EProveedor(); modProveedor.idProveedor = Convert.ToInt32(txtnombre.Tag.ToString()); modProveedor.nombres = txtnombre.Text; modProveedor.apellidos = txtapellido.Text; modProveedor.cedula = txtcedula.Text; modProveedor.telefono = Convert.ToInt32(txttelefono.Text); modProveedor.correo = txtcorreo.Text; modProveedor.direccion = txtdireccion.Text; modProveedor.estado = cmbestado.Text; NProveedor gestionarProveedor = new NProveedor(); gestionarProveedor.Modificar(modProveedor); MessageBox.Show("Se modifico correctamente", "Proveedor", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { EProveedor NuevoProveedor = new EProveedor(); NuevoProveedor.nombres = txtnombre.Text; NuevoProveedor.apellidos = txtapellido.Text; NuevoProveedor.cedula = txtcedula.Text; NuevoProveedor.telefono = Convert.ToInt32(txttelefono.Text); NuevoProveedor.correo = txtcorreo.Text; NuevoProveedor.direccion = txtdireccion.Text; NuevoProveedor.estado = cmbestado.Text; NProveedor gestionarProveedor = new NProveedor(); gestionarProveedor.Agregar(NuevoProveedor); MessageBox.Show("Se guardo correctamente", "Proveedor", MessageBoxButtons.OK, MessageBoxIcon.Information); } ActualizarProveedor(); dgvProveedor.DataSource = ListaProveedor; Limpiar(); Deshabilitar(); btncancelar.Enabled = false; btnguardar.Enabled = false; btnmodificar.Enabled = false; btnnuevo.Enabled = true; modificar = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtRazonSocial.Text == string.Empty || this.txtNumDocumento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Falta Ingresar algunos datos, seran remarcados"); errorIcono.SetError(txtRazonSocial, "Ingrese la razon social"); errorIcono.SetError(txtNumDocumento, "Ingrese el numero de documento"); errorIcono.SetError(txtDireccion, "Ingrese la direccion"); } else { if (this.IsNuevo) { rpta = NProveedor.Insertar(this.txtRazonSocial.Text.Trim().ToUpper(), this.cboxSectorComercial.Text, this.cboxTipoDocumento.Text.Trim().ToUpper(), this.txtNumDocumento.Text.Trim(), this.txtDireccion.Text.Trim(), this.txtTelefono.Text.Trim(), this.txtEmail.Text.Trim(), this.txtUrl.Text.Trim()); } else { rpta = NProveedor.Editar(Convert.ToInt32(this.txtIdProveedor.Text.Trim()), this.txtRazonSocial.Text.Trim().ToUpper(), this.cboxSectorComercial.Text, this.cboxTipoDocumento.Text.Trim().ToUpper(), this.txtNumDocumento.Text.Trim(), this.txtDireccion.Text.Trim(), this.txtTelefono.Text.Trim(), this.txtEmail.Text.Trim(), this.txtUrl.Text.Trim()); } if (rpta.Equals("OK")) { if (this.IsNuevo) { MensajeOk("Se inserto de forma correcta el registro"); } else { MensajeOk("Se actualizo de forma correcta el registro"); } } else { MensajeError(rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//guardar private void BtnGuardar_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtRazon_social.Text == string.Empty || this.txtNum_documento.Text == string.Empty || this.txtDireccion.Text == string.Empty) { MensajeError("Falta ingresar algunos datos,seran remarcados"); errorIcono.SetError(txtRazon_social, "Ingrese la rzon social"); errorIcono.SetError(txtNum_documento, "Ingrese el numero de documento"); errorIcono.SetError(txtDireccion, "Ingrese su direccion"); } else { if (this.isNuevo) //si es nuevo { //opcional txtNombre.Text.Trim.Upper rpta = NProveedor.Insertar(this.txtRazon_social.Text, this.cmbSector_comercial.Text, this.cmbTipo_documento.Text, this.txtNum_documento.Text, this.txtDireccion.Text, this.txtTelefono.Text, this.txtEmail.Text, this.txtUrl.Text); } else { rpta = NProveedor.Editar(Convert.ToInt32(this.txtIdproveedor.Text), this.txtRazon_social.Text, this.cmbSector_comercial.Text, this.cmbTipo_documento.Text, this.txtNum_documento.Text, this.txtDireccion.Text, this.txtTelefono.Text, this.txtEmail.Text, this.txtUrl.Text); } if (rpta.Equals("Ok")) { if (this.isNuevo) { this.MensajeOk("Se inserto de forma correcta el registro"); } else { this.MensajeOk("Se actualizo de forma correcta el registro"); } } else { this.MensajeError(rpta); } //despues de editar o guardar dejarlos en false this.isNuevo = false; this.isEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void GetProveedores() { try { NProveedor proveedor = new NProveedor(); var lista = proveedor.MostrarProveedor(); EProveedorBindingSource.DataSource = lista; } catch (Exception e) { MessageBox.Show(e.Message, "Error - Obtener datos de proveedores", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.reportViewer1.RefreshReport(); } }
private void Guardar() { EProveedor be = new EProveedor { Ruc = TxtRuc.Text, RazonSocial = TxtRazonSocial.Text, Ciudad = TxtCiudad.Text, Direccion = TxtDireccion.Text, Email = TxtEmail.Text, Telefono = TxtTelefono.Text }; NProveedor bo = new NProveedor(); if (modificar == 0) { if (bo.Agregar(be)) { Listar(); Frm_Principal.Main.ChangeMessage("Proveedor se guardo correctamente", "Success"); CamposReadOnly(true); BotonesEnables(true); } else { Frm_Principal.Main.ChangeMessage("Ocurrió algún error", "Failed"); } } else if (modificar == 1) { if (bo.Modificar(be)) { Listar(); Frm_Principal.Main.ChangeMessage("Proveedor se modificó correctamente", "Success"); CamposReadOnly(true); BotonesEnables(true); } else { Frm_Principal.Main.ChangeMessage("Ocurrió algún error", "Failed"); } } }
private void TxtRucProveedor_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Enter)) { if (string.IsNullOrEmpty(TxtRucProveedor.Text)) { MessageBox.Show("Ingrese Código del Proveedor", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { NProveedor boProducto = new NProveedor(); EProveedor proveedor = boProducto.Seleccionar(TxtRucProveedor.Text); if (string.IsNullOrEmpty(proveedor.Ruc)) { MessageBox.Show("No Existe Proveedor", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } LblIDProveedor.Text = proveedor.ID.ToString(); TxtRazonSocial.Text = proveedor.RazonSocial; } } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("¿Realmente desea eliminar los registros seleccionados?", "Sistema de Ventas PC Life", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; string respuesta = ""; foreach (DataGridViewRow row in dataListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(row.Cells[1].Value); respuesta = NProveedor.Eliminar(Convert.ToInt32(Codigo)); if (respuesta.Equals("OK")) { this.MensajeOk("Se eliminó correctamente el registro"); } else { this.MensajeError(respuesta); } } } this.Mostrar(); { } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult dialogResult; dialogResult = MessageBox.Show("Realmente Desea Eliminar los registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult == DialogResult.OK) { string Codigo; string rpta = ""; foreach (DataGridViewRow data in dataListado.Rows) { if (Convert.ToBoolean(data.Cells[0].Value)) { Codigo = Convert.ToString(data.Cells[1].Value); rpta = NProveedor.Eliminar(Convert.ToInt32(Codigo)); if (rpta.Equals("OK")) { this.MensajeOk("Se elimino correctamente el registro"); } else { this.MensajeError(rpta); } } } this.Mostrar(); this.dataListado.Columns[0].Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void frmMantenimiento_FormClosing(object sender, FormClosingEventArgs e) { FrmPrincipal.abiertoFrmMantenimiento = false; int CC = 0; int CP = 0; string rpta = ""; try { if ((AuxCategorias.Count > 0) || (AuxProveedores.Count > 0)) { if (AuxCategorias.Count > 0) { for (int i = 0; i < AuxCategorias.Count; i++) { NCategoria.Eliminar(Obtener_Id_Categoria(AuxCategorias[i])); CC++; } rpta += string.Format("Se eliminaron {0} categorias pre-importadas.\n", CC); } if (AuxProveedores.Count > 0) { for (int i = 0; i < AuxProveedores.Count; i++) { NProveedor.Eliminar(Obtener_Id_Proveedor(AuxProveedores[i])); CP++; } rpta += string.Format("Se eliminaron {0} proveedores pre-importados.", CP); } MessageBox.Show(rpta); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//eliminar private void BtnEliminar_Click(object sender, EventArgs e) { try { DialogResult opcion; opcion = MessageBox.Show("Realmente desea eliminar los registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (opcion == DialogResult.OK) { string id; string rpta = ""; foreach (DataGridViewRow row in dataListado.Rows) //recorre las filas { if (Convert.ToBoolean(row.Cells[0].Value)) //la celda 0 convierte a bool { id = Convert.ToString(row.Cells[1].Value); //obtiene su idcategoria rpta = NProveedor.Eliminar(Convert.ToInt32(id)); //envio el id if (rpta.Equals("Ok")) { this.MensajeOk("Se elimino correctamente el registro"); this.chkEliminar.Checked = false;//despues de eliminar deselecciona el check } else { this.MensajeError(rpta); } } } this.Mostrar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//BOTON eliminar CLICK private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("¿Realmente desea eliminar los registros?", "Sistema POS", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Opcion == DialogResult.Yes) { string Codigo; string Rpta = ""; foreach (DataGridViewRow row in dgvProveedor.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(row.Cells[1].Value); Rpta = NProveedor.Eliminar(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOK("Se eliminó correctamente el registro."); } else { this.MensajeError(Rpta); } } } this.MostrarDatos(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//MostrarDatos columnas en DATAGRID private void BuscarNombre(string textoAbuscar) { this.dgvProveedor.DataSource = NProveedor.Buscar(textoAbuscar); this.OcultarColumnas(); this.lblNumElementos.Text = "Elementos: " + Convert.ToString(this.dgvProveedor.Rows.Count); }
//MostrarDatos columnas en DATAGRID private void MostrarDatos() { this.dgvProveedor.DataSource = NProveedor.Mostrar(); this.OcultarColumnas(); this.lblNumElementos.Text = "Elementos: " + Convert.ToString(this.dgvProveedor.Rows.Count); }
private void BuscarRazon_Social() { this.dataListado.DataSource = NProveedor.BuscarRazon_social(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
private void Mostrar() { this.dataListado.DataSource = NProveedor.Mostrar(); this.OcultarColumnas(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
public void ActualizarProveedor() { NProveedor gestionarProveedor = new NProveedor(); ListaProveedor = gestionarProveedor.ObtenerListaProveedor(); }
private void Mostrar() { NProveedor.Mostrar(dgvVistaProveedor); }
private void tbVistaProveedor_TextChanged(object sender, EventArgs e) { NProveedor.BuscarPorNombre(dgvVistaProveedor, tbVistaProveedor.Text); }
private void btnEditar_Click(object sender, EventArgs e) { try { FormPedido frm = new FormPedido(); var t = this.addPedido.getDatos(int.Parse(this.dtLista.SelectedRows[0].Cells[0].Value.ToString())); frm.Opacity = 80; frm.grabar = true; Double desc = 0.0, tot = 0.0; frm.txtCodigo.Text = "" + t.ped_codigo; frm.epedido.Ped_codigo = t.ped_codigo; frm.btnVer.Enabled = true; //MessageBox.Show("" + t.ped_codigo + "--"+t.ped_estado); frm.dtLista.Enabled = false; frm.dtLista.ReadOnly = false; frm.fillDatosProductos(t.ped_codigo); frm.fillDatos(t.prov_codigo); frm.epedido.Prov_codigo = t.prov_codigo; frm.txtTotal.NumeroDecimal = true; var proveedor = new NProveedor().getDatos(t.prov_codigo); frm.txtIdentificacion.Text = proveedor.Identificacion; frm.txtCliente.Text = "" + proveedor.Nombre; frm.epedido.Ped_estado = Convert.ToChar(t.ped_estado); // frm.edpedido.Ped_codigo = t.ped_codigo; frm.rdbCotizacion.Checked = frm.epedido.Ped_estado == 'N' ? true : false; frm.rdbFactura.Checked = frm.epedido.Ped_estado == 'S' ? true : false; if (t.ped_descuento > 0.0) { frm.chkDescuento.Checked = true; } frm.txtSub12.Text = String.Format("{0:C2}", t.ped_subtotal12); frm.txtSub0.Text = String.Format("{0:C2}", t.ped_subtotal0); frm.txtIVA.Text = String.IsNullOrEmpty(String.Format("{0:C2}", t.ped_tiva)) ? "0.0" : String.Format("{0:C2}", t.ped_tiva); frm.txtDescuento.Text = (t.ped_descuento) + ""; desc = Convert.ToDouble(((t.ped_subtotal12 + t.ped_subtotal0 + t.ped_tiva) * t.ped_descuento)); tot = (Convert.ToDouble((t.ped_subtotal12 + t.ped_subtotal0 + t.ped_tiva) - desc)); frm.txtVDescuento.Text = String.Format("{0:C2}", desc); frm.txtTotal.Text = String.Format("{0:C2}", tot); frm.btnNuevo.Text = "Editar"; frm.date = t.ped_fecha.Value; frm.ShowDialog(); this.Lista(); } catch (Exception ex) { Datos.Excepciones.LogExceptions(ex); MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//Metodo buscar numero de documento private void BuscarNum_documento() { this.dataListado.DataSource = NProveedor.BuscarNum_documento(this.txtBuscar.Text); this.OcultarColumnas(); lblTotal.Text = "Total de registros:" + Convert.ToString(dataListado.Rows.Count); }
private void llenar_combobox() { CmbProveedor.DataSource = NProveedor.mostrar_proveedor(); CmbProveedor.ValueMember = "idproveedor"; CmbProveedor.DisplayMember = "razon_social"; }