Beispiel #1
0
 private void Borrar()
 {
     try
     {
         oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300204");
         if (oFuncion.Err)
         {
             MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             return;
         }
         else
         {
             if (MessageBox.Show("Esta seguro de Borrar este Registro", "Atencion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 App_Code.Inventario.Departamentos oRegistro = new App_Code.Inventario.Departamentos(int.Parse(this.lblFicha.Text.ToString()));
                 oRegistro.Borrado = true;
                 oRegistro.Actualizar();
                 this.Nuevo();
                 this.Consulta();
                 MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception)
     {
     }
 }
Beispiel #2
0
        public void Guardar()
        {
            App_Code.Inventario.Departamentos oRegistro = new App_Code.Inventario.Departamentos(int.Parse(this.lblFicha.Text));

            oRegistro.Codigo = this.txtCodigo.Text.ToString().ToUpper();
            oRegistro.Nombre = this.txtNombre.Text.ToString().ToUpper();

            oRegistro.PrecioMayor  = double.Parse(this.txtPrecioMayor.Text.ToString());
            oRegistro.PrecioOferta = double.Parse(this.txtPrecioOferta.Text.ToString());
            oRegistro.PrecioMaximo = double.Parse(this.txtPrecioMaximo.Text.ToString());
            oRegistro.PrecioMinimo = double.Parse(this.txtPrecioMinimo.Text.ToString());

            oRegistro.ComisionVentaPrecioMayor  = double.Parse(this.txtCVPrecioMayor.Text.ToString());
            oRegistro.ComisionVentaPrecioOferta = double.Parse(this.txtCVPrecioOferta.Text.ToString());
            oRegistro.ComisionVentaPrecioMaximo = double.Parse(this.txtCVPrecioMaximo.Text.ToString());
            oRegistro.ComisionVentaPrecioMinimo = double.Parse(this.txtCVPrecioMinimo.Text.ToString());

            oRegistro.ComisionCobranzaPrecioMayor  = double.Parse(this.txtCCPrecioMayor.Text.ToString());
            oRegistro.ComisionCobranzaPrecioOferta = double.Parse(this.txtCCPrecioOferta.Text.ToString());
            oRegistro.ComisionCobranzaPrecioMaximo = double.Parse(this.txtCCPrecioMaximo.Text.ToString());
            oRegistro.ComisionCobranzaPrecioMinimo = double.Parse(this.txtCCPrecioMinimo.Text.ToString());

            if (this.lblNombreFoto.Text == "Nombre")
            {
                oRegistro.Imagen = "Ninguna";
            }
            else
            {
                oRegistro.Imagen = this.lblNombreFoto.Text;
            }



            oRegistro.Borrado   = false;
            oRegistro.UserLogId = frmPrincipal.id_usuario;


            try
            {
                if (!Validar())
                {
                    if (oRegistro.Err)
                    {
                        oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300202");
                        if (oFuncion.Err)
                        {
                            MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }
                        else
                        {
                            oRegistro.Creado     = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt"));
                            oRegistro.Modificado = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt"));
                            oRegistro.Insertar();
                        }
                    }
                    else
                    {
                        oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300203");
                        if (oFuncion.Err)
                        {
                            MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            return;
                        }
                        else
                        {
                            oRegistro.Modificado = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt"));
                            oRegistro.Actualizar();
                        }
                    }
                    MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Consulta();
                    this.Presentar(oRegistro.Id);
                }
            }
            catch (Exception)
            {
            }
        }