private void TraerInformacionDelRegisto() { try { EmpresaEN oRegistroEN = new EmpresaEN(); EmpresaLN oRegistroLN = new EmpresaLN(); oRegistroEN.IdEmpresa = IdEmpresa; if (oRegistroLN.ListadoPorIdentificador(oRegistroEN, Program.oDatosDeConexion)) { DataRow Fila = oRegistroLN.TraerDatos().Rows[0]; txtNombre.Text = Fila["Nombre"].ToString(); txtDireccion.Text = Fila["Direccion"].ToString(); txtTelefonos.Text = Fila["Telefonos"].ToString(); txtNRUC.Text = Fila["NRuc"].ToString(); txtCelular.Text = Fila["Celular"].ToString(); txtEmail.Text = Fila["Email"].ToString(); txtSitioWeb.Text = Fila["SitioWeb"].ToString(); txtDescripcion.Text = Fila["Descripcion"].ToString(); if (Fila["Logo"] != DBNull.Value) { pbxImagen.Image = Imagenes.ProcesarImagenToBitMap((object)(Fila["Logo"])); } } } catch (Exception ex) { MessageBox.Show(string.Format("Error: {0} ", ex.Message), "Traer información del Registro", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CargarImagenDesdeLaBD() { try { ProductoImagenesEN oRegistroEN = new ProductoImagenesEN(); ProductoImagenesLN oRegistroLN = new ProductoImagenesLN(); oRegistroEN.oProductoEN.idProducto = ValorLlavePrimariaEntidad; oRegistroEN.Where = string.Format(" and idProducto = {0}", ValorLlavePrimariaEntidad); ListaDeImagenes.Images.Clear(); lvImagenes.Items.Clear(); if (oRegistroLN.Listado(oRegistroEN, Program.oDatosDeConexion)) { if (oRegistroLN.TraerDatos().Rows.Count > 0) { foreach (DataRow Fila in oRegistroLN.TraerDatos().Rows) { if (Fila["Foto"] != DBNull.Value) { Image ImagenDB = Imagenes.ProcesarImagenToBitMap((object)(Fila["Foto"])); ListaDeImagenes.Images.Add(ImagenDB); ListViewItem item = new ListViewItem(""); item.SubItems.Add(Fila["idProductoImagenes"].ToString()); item.ImageIndex = ListaDeImagenes.Images.Count - 1; lvImagenes.Items.Add(item); } } } } else { throw new ArgumentException(oRegistroLN.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Cargar imagenes desde la base de datos.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void LlenarCamposDesdeBaseDatosSegunID() { this.Cursor = Cursors.WaitCursor; LaboratorioEN oRegistrosEN = new LaboratorioEN(); LaboratorioLN oRegistrosLN = new LaboratorioLN(); oRegistrosEN.idLaboratorio = ValorLlavePrimariaEntidad; if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexion)) { if (oRegistrosLN.TraerDatos().Rows.Count > 0) { DataRow Fila = oRegistrosLN.TraerDatos().Rows[0]; txtCodigo.Text = Fila["Codigo"].ToString(); txtNombre.Text = Fila["Nombre"].ToString(); txtDireccion.Text = Fila["Direccion"].ToString(); txtTelefono.Text = Fila["Telefono"].ToString(); txtMovil.Text = Fila["Movil"].ToString(); txtObservaciones.Text = Fila["Observaciones"].ToString(); txtCorreo.Text = Fila["Correo"].ToString(); txtFechaDeCumpleanos.Text = Fila["FechaDeCumpleanos"].ToString(); txtMessenger.Text = Fila["Messenger"].ToString(); txtSkype.Text = Fila["Skype"].ToString(); txtTwitter.Text = Fila["Twitter"].ToString(); txtFaceBook.Text = Fila["Facebook"].ToString(); cmbEstado.Text = Fila["Estado"].ToString(); txtNoRUC.Text = Fila["NoRUC"].ToString(); txtSitioWeb.Text = Fila["SitioWeb"].ToString(); if (Controles.IsNullOEmptyElControl(txtFechaDeCumpleanos) == false) { dtpkFecha.Value = Convert.ToDateTime(txtFechaDeCumpleanos.Text); } if (Fila["Foto"] != DBNull.Value) { pbxImagen.Image = Imagenes.ProcesarImagenToBitMap((object)(Fila["Foto"])); } LLenarCampoDeBaseDeDatosSegundLaboratorio(); LLenarCampoDeBaseDeDatosSegunLaboratorios(); oRegistrosEN = null; oRegistrosLN = null; } else { string Mensaje; Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado." + "\n\r-----Causas---- " + "\n\r1. Este registro pudo haber sido eliminado por otro usuario." + "\n\r2. El listado no está actualizado.", NombreEntidad); MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; this.Close(); } } else { this.Cursor = Cursors.Default; MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); oRegistrosEN = null; oRegistrosLN = null; } this.Cursor = Cursors.Default; }