Beispiel #1
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;
                //valido los campos:
                if (this.NombretextBox.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados.");
                    ErrorIconoerrorProvider.SetError(NombretextBox, "Ingrese Nombre.....");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        respuesta = NPresentacion.Insertar(this.NombretextBox.Text.Trim().ToUpper(), this.DescripciontextBox.Text.Trim().ToUpper());
                    }
                    else
                    {
                        respuesta = NPresentacion.Editar(Convert.ToInt32(IdPresentaciontextBox.Text),
                                                         NombretextBox.Text.Trim().ToUpper(),
                                                         DescripciontextBox.Text.Trim().ToUpper());
                    }

                    if (respuesta.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(respuesta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #2
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;
                //valido los campos:
                if (
                    this.NombretextBox.Text == string.Empty ||
                    this.IdCategoriatextBox.Text == string.Empty ||
                    this.codigoVentastextBox.Text == string.Empty
                    )
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados.");
                    ErrorIconoerrorProvider.SetError(NombretextBox, "Ingrese Nombre.....");
                    ErrorIconoerrorProvider.SetError(codigoVentastextBox, "Ingrese un VAlor.....");
                    ErrorIconoerrorProvider.SetError(NombreCAtegoriatextBox, "Ingrese un Valor.....");
                }
                else
                {
                    //Guardar imagen en un BUffer:
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    this.ImagenpictureBox.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                    //Del Buffer a un Arreglo;
                    byte[] imagen = ms.GetBuffer();


                    if (this.IsNuevo)
                    {
                        respuesta = NArticulo.Insertar(
                            this.codigoVentastextBox.Text,
                            this.NombretextBox.Text.Trim().ToUpper(),
                            this.DescripciontextBox.Text.Trim().ToUpper(),
                            imagen,
                            Convert.ToInt32(this.IdCategoriatextBox.Text),
                            Convert.ToInt32(this.PresentacioncomboBox.SelectedValue)
                            );
                    }
                    else
                    {
                        respuesta = NArticulo.Editar(
                            Convert.ToInt32(this.IdArticulotextBox.Text),
                            this.codigoVentastextBox.Text,
                            this.NombretextBox.Text.Trim().ToUpper(),
                            this.DescripciontextBox.Text.Trim().ToUpper(),
                            imagen,
                            Convert.ToInt32(this.IdCategoriatextBox.Text),
                            Convert.ToInt32(PresentacioncomboBox.SelectedValue)
                            );
                    }

                    if (respuesta.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(respuesta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #3
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;
                //valido los campos:
                if (this.RazonSocialtextBox.Text == string.Empty || this.NumeroDocumentotextBox.Text == string.Empty ||
                    this.DirecciontextBox.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados.");
                    ErrorIconoerrorProvider.SetError(this.RazonSocialtextBox, "Ingrese un Valoe.....");
                    ErrorIconoerrorProvider.SetError(this.NumeroDocumentotextBox, "Ingrese un Valoe.....");
                    ErrorIconoerrorProvider.SetError(this.DirecciontextBox, "Ingrese un Valoe.....");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        respuesta = NProveedor.Insertat(
                            this.RazonSocialtextBox.Text.Trim().ToUpper(),
                            this.SectorComercialcomboBox.Text,
                            this.TipoDocumentocomboBox.Text,
                            this.NumeroDocumentotextBox.Text,
                            this.DirecciontextBox.Text,
                            this.TelefonotextBox.Text,
                            this.EmailtextBox.Text,
                            this.UrltextBox.Text
                            );
                    }
                    else
                    {
                        respuesta = NProveedor.Editar(
                            Convert.ToInt32(IdProveedortextBox.Text),
                            this.RazonSocialtextBox.Text.Trim().ToUpper(),
                            this.SectorComercialcomboBox.Text,
                            this.TipoDocumentocomboBox.Text,
                            this.NumeroDocumentotextBox.Text,
                            this.DirecciontextBox.Text,
                            this.TelefonotextBox.Text,
                            this.EmailtextBox.Text,
                            this.UrltextBox.Text
                            );
                    }

                    if (respuesta.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(respuesta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
Beispiel #4
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;
                //valido los campos:
                if (this.NombretextBox.Text == string.Empty || this.NumeroDocumentotextBox.Text == string.Empty ||
                    this.ApellidostextBox.Text == string.Empty || this.DirecciontextBox.Text == string.Empty ||
                    this.UsuariotextBox.Text == string.Empty || this.PasswordtextBox.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados.");
                    ErrorIconoerrorProvider.SetError(this.NombretextBox, "Ingrese un Valor.....");
                    ErrorIconoerrorProvider.SetError(this.NumeroDocumentotextBox, "Ingrese un Valor.....");
                    ErrorIconoerrorProvider.SetError(this.DirecciontextBox, "Ingrese un Valor.....");
                    ErrorIconoerrorProvider.SetError(this.ApellidostextBox, "Ingrese un Valor.....");
                    ErrorIconoerrorProvider.SetError(this.UsuariotextBox, "Ingrese un Valor.....");
                    ErrorIconoerrorProvider.SetError(this.PasswordtextBox, "Ingrese un Valor.....");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        respuesta = NTrabajador.Insertar(
                            this.NombretextBox.Text.Trim().ToUpper(),
                            this.ApellidostextBox.Text.Trim().ToUpper(),
                            this.SexocomboBox.Text,
                            this.fechaNacimientodateTimePicker.Value,
                            this.NumeroDocumentotextBox.Text,
                            this.DirecciontextBox.Text,
                            this.TelefonotextBox.Text,
                            this.EmailtextBox.Text,
                            this.accesocomboBox.Text,
                            this.UsuariotextBox.Text,
                            this.PasswordtextBox.Text
                            );
                    }
                    else
                    {
                        respuesta = NTrabajador.Editar(Convert.ToInt32(IdTrabajadortextBox.Text),
                                                       this.NombretextBox.Text.Trim().ToUpper(),
                                                       this.ApellidostextBox.Text.Trim().ToUpper(),
                                                       this.SexocomboBox.Text,
                                                       this.fechaNacimientodateTimePicker.Value,
                                                       this.NumeroDocumentotextBox.Text,
                                                       this.DirecciontextBox.Text,
                                                       this.TelefonotextBox.Text,
                                                       this.EmailtextBox.Text,
                                                       this.accesocomboBox.Text,
                                                       this.UsuariotextBox.Text,
                                                       this.PasswordtextBox.Text
                                                       );
                    }

                    if (respuesta.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(respuesta);
                    }
                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }