Example #1
0
 public static int eliminarDocRef(CapaEntidad.DocumentoRef p)
 {
     int i = 0;
     try
     {
         CapaEntidad.con.updateSQL("update documentoref set stat = '0' where idDocumento = '" + p.ID1 + "'");
         i = 1;
     }
     catch (Exception e)
     {
         i = 0;
     }
     return i;
 }
Example #2
0
 public static int actualizarDocRef(CapaEntidad.DocumentoRef p)
 {
     int i = 0;
     try
     {
         CapaEntidad.con.updateSQL("update documentoref set serieDocumento = '" + p.Documento1 + "', descripcon = '" + p.Descripcion1 + "', fecha = getdate(), stat = '" + p.Estado + "', MONTO = '" + p.Total + "' where idDocumento = '" + p.ID1 + "'");
         i = 1;
     }
     catch (Exception e)
     {
         i = 0;
     }
     return i;
 }
Example #3
0
 public static int agregarDocRef(CapaEntidad.DocumentoRef p)
 {
     int i = 0;
     try
     {
         CapaEntidad.con.insertSQL("INSERT INTO DOCUMENTOREF VALUES('" + p.Documento1 + "','" + p.Descripcion1 + "',GETDATE(),'" + p.Estado + "','" + p.Total + "')");
         i = 1;
     }
     catch (Exception e)
     {
         i = 0;
     }
     return i;
 }
Example #4
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (estado == "insertar")
     {
         CapaEntidad.DocumentoRef p = new CapaEntidad.DocumentoRef();
         p.Descripcion1 = txtDescripcion.Text;
         p.Documento1   = txtDocumento.Text;
         p.Total        = txtMonto.Text;
         p.Estado       = "1";
         CapaNegocio cn = new CapaNegocio();
         cn.insertarDocRef(p);
         limpiar();
         btnNuevo.Enabled  = true;
         btnEditar.Enabled = btnEliminar.Enabled = btnGuardar.Enabled = btnCancelar.Enabled = txtDescripcion.Enabled = txtMonto.Enabled = txtDocumento.Enabled = false;
     }
     else if (estado == "editar")
     {
         CapaEntidad.DocumentoRef p = new CapaEntidad.DocumentoRef();
         p.Descripcion1 = txtDescripcion.Text;
         p.Documento1   = txtDocumento.Text;
         p.Total        = txtMonto.Text;
         p.Estado       = "1";
         p.ID1          = Sid;
         CapaNegocio cn = new CapaNegocio();
         cn.actualizarDocRef(p);
         btnEditar.Enabled  = btnEliminar.Enabled = btnNuevo.Enabled = true;
         btnGuardar.Enabled = btnCancelar.Enabled = txtDescripcion.Enabled = txtMonto.Enabled = txtDocumento.Enabled = false;
     }
     else if (estado == "eliminar")
     {
         if (MessageBox.Show("Desea eliminar el registro", "Eliminacion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             CapaEntidad.DocumentoRef p = new CapaEntidad.DocumentoRef();
             p.ID1 = Sid;
             CapaNegocio cn = new CapaNegocio();
             cn.eliminarDocRef(p);
             limpiar();
             btnNuevo.Enabled  = true;
             btnEditar.Enabled = btnEliminar.Enabled = btnGuardar.Enabled = btnCancelar.Enabled = txtDescripcion.Enabled = txtMonto.Enabled = txtDocumento.Enabled = false;
         }
     }
 }
Example #5
0
        public void eliminarDocRef(CapaEntidad.DocumentoRef p)
        {
            if (string.IsNullOrWhiteSpace(p.ID1))
            {
                MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int resultado = CapaDatos.eliminarDocRef(p);

                if (resultado > 0)
                {
                    MessageBox.Show("Documento Eliminado Con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo eliminar el Documento", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #6
0
        public void actualizarDocRef(CapaEntidad.DocumentoRef p)
        {
            if (string.IsNullOrWhiteSpace(p.Documento1) || string.IsNullOrWhiteSpace(p.Descripcion1) || string.IsNullOrWhiteSpace(p.Total))
            {
                MessageBox.Show("Hay Uno o mas Campos Vacios!", "Campos Vacios!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                int resultado = CapaDatos.actualizarDocRef(p);

                if (resultado > 0)
                {
                    MessageBox.Show("Documento Editado Con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo editar el Documento", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }