private void btnGuardar_Click(object sender, EventArgs e) { try { string Rpta = ""; if (this.txtNombre.Text == string.Empty || this.txtCiudad.Text == string.Empty || this.txtSuperficie.Text == string.Empty || txtDireccion.Text == string.Empty) { MensajeError("Falta ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtNombre, "Ingrese el nombre"); errorIcono.SetError(txtDireccion, "Ingrese el password"); errorIcono.SetError(txtSuperficie, "Ingrese el usuaurio"); errorIcono.SetError(txtCiudad, "Ingrese el telefono"); errorIcono.SetError(btnAgregarImagen, "Ingrese el telefono"); } else { System.IO.MemoryStream ms = new System.IO.MemoryStream(); this.pxImagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] imagen = ms.GetBuffer(); if (this.IsNuevo) { Rpta = NUrbanizacion.Insertar( this.txtNombre.Text, this.txtDireccion.Text, this.txtCiudad.Text, this.txtSuperficie.Text, imagen ); } else { Rpta = NUrbanizacion.Editar(Convert.ToInt32(this.txtCodigo.Text), this.txtNombre.Text, this.txtDireccion.Text, this.txtCiudad.Text, this.txtSuperficie.Text, imagen ); } if (Rpta.Equals("OK")) { if (this.IsNuevo) { this.MensajeOk("Se insertó de forma correcta el registro"); errorIcono.Clear(); txtCodigo.Visible = true; label10.Visible = true; } else { this.MensajeOk("Se actualizó de forma correcta el registro"); errorIcono.Clear(); } } else { this.MensajeError(Rpta); } this.IsNuevo = false; this.IsEditar = false; this.Botones(); this.Limpiar(); this.Mostrar(); dgvRegistros.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }