public static frmVistaDetalleCompra getinstancia() { if (_instancia == null) { _instancia = new frmVistaDetalleCompra(); } return(_instancia); }
private void dtgvListado_DoubleClick(object sender, EventArgs e) { try { frmVistaDetalleCompra frm = frmVistaDetalleCompra.getinstancia(); string par1, par2; par1 = Convert.ToString(dtgvListado.CurrentRow.Cells["Codigo"].Value); par2 = Convert.ToString(dtgvListado.CurrentRow.Cells["Nombre"].Value); frm.setterArticulos(par1, par2); this.Hide(); } catch (Exception) { } }
private void btnNuevo_Click(object sender, EventArgs e) { try { ErrorIcono.Clear(); string msgRespuesta = ""; if (txtIDSuplidor.Text == "" || txtSuplidorNombre.Text == "" || txtNCFSuplidor.Text == "" || txtDetalles.Text == "") { MsgError("Debe ingresar los datos correctamente para continuar: "); } if (txtIDSuplidor.Text == string.Empty) { ErrorIcono.SetError(txtSuplidorNombre, "Debe ingresar un Suplidor"); } if (txtNCFSuplidor.Text == string.Empty) { ErrorIcono.SetError(txtNCFSuplidor, "Debe Ingresar un NCF"); } else { if (N == true) { msgRespuesta = NCompras.IngresarCompra(Convert.ToInt32(txtIDSuplidor.Text), txtNCFSuplidor.Text, dtpfecha.Value, txtDetalles.Text); } else { // msgRespuesta = NPresentacion.ModificarPresentacion(Convert.ToInt32(txtCodigo.Text), txtNombre.Text.Trim(), txtDescripcion.Text.Trim()); } if (msgRespuesta.Equals("Ok")) { if (N) { txtCodigoC.Text = NCompras.DevolverIDCompra(); frmVistaDetalleCompra frm = frmVistaDetalleCompra.getinstancia(); frm.ShowDialog(); } else { MsgConfirmacion("Se han editado los datos correctamente"); } N = false; E = false; MostrarDatos(); ErrorIcono.Clear(); } else { MsgError(msgRespuesta); } } } catch (Exception ex) { MsgError(ex.Message + ex.StackTrace); } }