Esempio n. 1
0
        /// <summary>
        /// Debería devolver un solo registro correspondiente al estado de la factura dado sopType y sopNumbe.
        /// </summary>
        /// <returns></returns>
        public bool TraeEstadoDelIdVentas(String sopnumbe, short soptype, String estadoBase)
        {
            cfdLogFacturaXML log = new cfdLogFacturaXML(_Conexion.ConnStr);

            log.Where.Sopnumbe.Value     = sopnumbe;
            log.Where.Sopnumbe.Operator  = WhereParameter.Operand.Equal;
            log.Where.Soptype.Conjuction = WhereParameter.Conj.And;
            log.Where.Soptype.Value      = soptype;
            log.Where.Soptype.Operator   = WhereParameter.Operand.Equal;
            log.Where.Estado.Conjuction  = WhereParameter.Conj.And;
            log.Where.Estado.Value       = estadoBase;
            log.Where.Estado.Operator    = WhereParameter.Operand.Equal;
            try
            {
                if (log.Query.Load())
                {
                    log.Rewind();

                    do
                    {
                        _compoundedBinStatus = log.EstadoActual;
                        _idxSingleStatus     = log.NoAprobacion;
                    } while (log.MoveNext());
                }
            }
            catch (Exception ePla)
            {
                _sMsj = "Contacte al administrador. Error al obtener log de facturas filtrado por llave. " + ePla.Message + "[LogFacturaXMLService.GetStatus()]";
                _iErr++;
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Inserta datos de una factura en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void RegistraLogDeArchivoXML(short soptype, string sopnumbe, string mensaje, string noAprobacion, string idusuario, string innerxml,
                                            string eBaseNuevo, string eBinarioActual, string mensajeBinActual)
        {
            try
            {
                ultimoMensaje   = "";
                numMensajeError = 0;
                //log de facturas xml emitido y xml anulado
                cfdLogFacturaXML logVenta = new cfdLogFacturaXML(_Conexion.ConnStr);

                logVenta.AddNew();
                logVenta.Soptype            = soptype;
                logVenta.Sopnumbe           = sopnumbe;
                logVenta.Mensaje            = Utiles.Derecha(mensaje, 255);
                logVenta.Estado             = eBaseNuevo;
                logVenta.NoAprobacion       = noAprobacion;
                logVenta.FechaEmision       = DateTime.Now;
                logVenta.IdUsuario          = Utiles.Derecha(idusuario, 10);
                logVenta.IdUsuarioAnulacion = "-";
                logVenta.FechaAnulacion     = new DateTime(1900, 1, 1);
                if (!innerxml.Equals(""))
                {
                    logVenta.ArchivoXML = innerxml;
                }
                logVenta.EstadoActual = eBinarioActual;
                logVenta.MensajeEA    = Utiles.Derecha(mensajeBinActual, 255);
                logVenta.Save();
            }
            catch (Exception eLog)
            {
                ultimoMensaje = "Contacte a su administrador. No se puede registrar la tarea en la Bitácora. [RegistraLogDeArchivoXML] " + eLog.Message;
                numMensajeError++;
            }
        }
        /// <summary>
        /// Inserta datos de una factura en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void RegistraLogDeArchivoXML(short soptype, string sopnumbe, string mensaje, string noAprobacion, string idusuario, string innerxml,
                                            string eBaseNuevo, string eBinarioActual, string mensajeBinActual)
        {
            try
            {
                //log de facturas xml emitido y xml anulado
                cfdLogFacturaXML logVenta = new cfdLogFacturaXML(_Conexion.ConnStr);

                logVenta.AddNew();
                logVenta.Soptype            = soptype;
                logVenta.Sopnumbe           = sopnumbe;
                logVenta.Mensaje            = Utiles.Derecha(mensaje, 255);
                logVenta.Estado             = eBaseNuevo;
                logVenta.NoAprobacion       = noAprobacion;
                logVenta.FechaEmision       = DateTime.Now;
                logVenta.IdUsuario          = Utiles.Derecha(idusuario, 10);
                logVenta.IdUsuarioAnulacion = "-";
                logVenta.FechaAnulacion     = new DateTime(1900, 1, 1);
                if (!string.IsNullOrEmpty(innerxml))
                {
                    logVenta.ArchivoXML = innerxml;
                }
                logVenta.EstadoActual = eBinarioActual;
                logVenta.MensajeEA    = Utiles.Derecha(mensajeBinActual, 255);
                logVenta.Save();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Debería devolver un solo registro correspondiente al trackid del SII
        /// </summary>
        /// <param name="idExterno">trackid del SII</param>
        /// <param name="estado">estado emitido</param>
        /// <returns></returns>
        public bool TraeLlaves(String idExterno, String estado)
        {
            cfdLogFacturaXML log = new cfdLogFacturaXML(_Conexion.ConnStr);

            log.Where.Estado.Value         = estado;
            log.Where.Estado.Operator      = WhereParameter.Operand.Equal;
            log.Where.IdExterno.Conjuction = WhereParameter.Conj.And;
            log.Where.IdExterno.Value      = idExterno;
            log.Where.IdExterno.Operator   = WhereParameter.Operand.Equal;
            bool existe = false;

            try
            {
                if (log.Query.Load())
                {
                    log.Rewind();

                    do
                    {
                        _sopType             = log.Soptype;
                        _sopnumbe            = log.Sopnumbe;
                        _compoundedBinStatus = log.EstadoActual;
                        _idxSingleStatus     = log.NoAprobacion;
                        existe = true;
                    } while (log.MoveNext());
                }
            }
            catch (Exception ePla)
            {
                _sMsj = "Contacte al administrador. Error al obtener log de facturas filtrado por trackid. " + ePla.Message + "[LogFacturaXMLService.TraeLlaves()]";
                _iErr++;
                return(existe);
            }
            return(existe);
        }
Esempio n. 5
0
        public void Delete(short Soptype, string Sopnumbe, string eBinario)
        {
            _sMsj = "";
            _iErr = 0;
            cfdLogFacturaXML xmlEmitido = new cfdLogFacturaXML(_Conexion.ConnStr);

            xmlEmitido.Where.Soptype.Value           = Soptype;
            xmlEmitido.Where.Soptype.Operator        = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Sopnumbe.Conjuction     = WhereParameter.Conj.And;
            xmlEmitido.Where.Sopnumbe.Value          = Sopnumbe;
            xmlEmitido.Where.Sopnumbe.Operator       = WhereParameter.Operand.Equal;
            xmlEmitido.Where.EstadoActual.Conjuction = WhereParameter.Conj.And;
            xmlEmitido.Where.EstadoActual.Value      = eBinario;
            xmlEmitido.Where.EstadoActual.Operator   = WhereParameter.Operand.Equal;
            try
            {
                if (xmlEmitido.Query.Load())
                {
                    xmlEmitido.MarkAsDeleted();
                    xmlEmitido.Save();
                }
                else
                {
                    _sMsj = "No se puede eliminar porque no está en la bitácora.";
                    _iErr++;
                }
            }
            catch (Exception eAnula)
            {
                _sMsj = "Contacte al administrador. Error al acceder a la base de datos. [LogFacturaXMLService.Delete] " + eAnula.Message;
                _iErr++;
                throw;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Actualiza la fecha, estado y observaciones de una factura emitida en el log de facturas.
        /// </summary>
        /// <param name="Soptype"></param>
        /// <param name="Sopnumbe"></param>
        /// <param name="idusuario"></param>
        /// <param name="eBaseAnterior"></param>
        /// <param name="eBaseNuevo"></param>
        /// <param name="eBinarioActual"></param>
        /// <param name="mensajeEA"></param>
        /// <param name="noAprobacion"></param>
        /// <param name="IdxExterno">Si está vacío no lo actualiza</param>
        public void Update(short Soptype, string Sopnumbe, string idusuario, string eBaseAnterior, string eBaseNuevo, string eBinarioActual, string mensajeEA, string noAprobacion,
                           String IdxExterno)
        {
            _sMsj = "";
            _iErr = 0;
            cfdLogFacturaXML xmlEmitido = new cfdLogFacturaXML(_Conexion.ConnStr);

            xmlEmitido.Where.Soptype.Value       = Soptype;
            xmlEmitido.Where.Soptype.Operator    = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Sopnumbe.Conjuction = WhereParameter.Conj.And;
            xmlEmitido.Where.Sopnumbe.Value      = Sopnumbe;
            xmlEmitido.Where.Sopnumbe.Operator   = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Estado.Conjuction   = WhereParameter.Conj.And;
            xmlEmitido.Where.Estado.Value        = eBaseAnterior; // "emitido";
            xmlEmitido.Where.Estado.Operator     = WhereParameter.Operand.Equal;
            try
            {
                if (xmlEmitido.Query.Load())
                {
                    if (!eBaseAnterior.Equals(eBaseNuevo))
                    {
                        xmlEmitido.Estado = eBaseNuevo;         // "anulado";
                    }
                    xmlEmitido.FechaAnulacion     = DateTime.Now;
                    xmlEmitido.IdUsuarioAnulacion = Utiles.Derecha(idusuario, 10);
                    xmlEmitido.EstadoActual       = eBinarioActual;
                    xmlEmitido.MensajeEA          = Utiles.Derecha(mensajeEA, 255);
                    xmlEmitido.NoAprobacion       = noAprobacion;

                    if (!IdxExterno.Equals(String.Empty))
                    {
                        xmlEmitido.IdExterno = IdxExterno;
                    }

                    xmlEmitido.Save();
                }
                else
                {
                    _sMsj = "No se puede actualizar porque no está en la bitácora con estado 'emitido'.";
                    _iErr++;
                }
            }
            catch (Exception eAnula)
            {
                _sMsj = "Contacte al administrador. Error al acceder a la base de datos. [LogFacturaXMLService.Update] " + eAnula.Message;
                _iErr++;
                throw;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Actualiza la fecha, estado y observaciones de una factura emitida en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void Update(string idusuario, string eBaseAnterior, string eBaseNuevo)
        {
            _sMsj = "";
            _iErr = 0;
            cfdLogFacturaXML xmlEmitido = new cfdLogFacturaXML(_Conexion.ConnStr);

            xmlEmitido.Where.Soptype.Value       = _sopType;
            xmlEmitido.Where.Soptype.Operator    = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Sopnumbe.Conjuction = WhereParameter.Conj.And;
            xmlEmitido.Where.Sopnumbe.Value      = _sopnumbe;
            xmlEmitido.Where.Sopnumbe.Operator   = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Estado.Conjuction   = WhereParameter.Conj.And;
            xmlEmitido.Where.Estado.Value        = eBaseAnterior; // "emitido";
            xmlEmitido.Where.Estado.Operator     = WhereParameter.Operand.Equal;
            try
            {
                if (xmlEmitido.Query.Load())
                {
                    if (!eBaseAnterior.Equals(eBaseNuevo))
                    {
                        xmlEmitido.Estado = eBaseNuevo;         // "anulado";
                    }
                    xmlEmitido.FechaAnulacion     = DateTime.Now;
                    xmlEmitido.IdUsuarioAnulacion = Utiles.Derecha(idusuario, 10);
                    xmlEmitido.EstadoActual       = _cicloDeVida.targetBinStatus;
                    xmlEmitido.MensajeEA          = Utiles.Derecha(_cicloDeVida.EstadoEnPalabras(_cicloDeVida.targetBinStatus), 255);
                    xmlEmitido.NoAprobacion       = _cicloDeVida.idxTargetSingleStatus.ToString();
                    xmlEmitido.Save();
                }
                else
                {
                    _sMsj = "No se puede actualizar porque no está en la bitácora con estado base.";
                    _iErr++;
                }
            }
            catch (Exception eAnula)
            {
                _sMsj = "Contacte al administrador. Error al acceder a la base de datos. [LogFacturaXMLService.Update] " + eAnula.Message;
                _iErr++;
                throw;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Actualiza la fecha, estado y observaciones de una factura emitida en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void ActualizaFacturaEmitida(short Soptype, string Sopnumbe, string idusuario, string eBaseAnterior, string eBaseNuevo, string eBinarioActual, string mensajeEA)
        {
            ultimoMensaje   = "";
            numMensajeError = 0;
            cfdLogFacturaXML xmlEmitido = new cfdLogFacturaXML(_Conexion.ConnStr);

            xmlEmitido.Where.Soptype.Value       = Soptype;
            xmlEmitido.Where.Soptype.Operator    = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Sopnumbe.Conjuction = WhereParameter.Conj.And;
            xmlEmitido.Where.Sopnumbe.Value      = Sopnumbe;
            xmlEmitido.Where.Sopnumbe.Operator   = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Estado.Conjuction   = WhereParameter.Conj.And;
            xmlEmitido.Where.Estado.Value        = eBaseAnterior; // "emitido";
            xmlEmitido.Where.Estado.Operator     = WhereParameter.Operand.Equal;
            try
            {
                if (xmlEmitido.Query.Load())
                {
                    if (!eBaseAnterior.Equals(eBaseNuevo))
                    {
                        xmlEmitido.Estado = eBaseNuevo;         // "anulado";
                    }
                    xmlEmitido.FechaAnulacion     = DateTime.Now;
                    xmlEmitido.IdUsuarioAnulacion = Utiles.Derecha(idusuario, 10);
                    xmlEmitido.EstadoActual       = eBinarioActual;
                    xmlEmitido.MensajeEA          = Utiles.Derecha(mensajeEA, 255);
                    xmlEmitido.Save();
                    //ultimoMensaje = "Completado.";
                }
                else
                {
                    ultimoMensaje = "No está en la bitácora con estado 'emitido'.";
                    numMensajeError++;
                }
            }
            catch (Exception eAnula)
            {
                ultimoMensaje = "Contacte al administrador. Error al acceder la base de datos. [ActualizaFacturaEmitida] " + eAnula.Message;
                numMensajeError++;
            }
        }
        /// <summary>
        /// Actualiza la fecha, estado y observaciones de una factura emitida en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void ActualizaFacturaEmitida(short Soptype, string Sopnumbe, string idusuario, string eBaseAnterior, string eBaseNuevo, string eBinarioActual, string mensajeEA, string noAprobacion)
        {
            cfdLogFacturaXML xmlEmitido = new cfdLogFacturaXML(_Conexion.ConnStr);

            xmlEmitido.Where.Soptype.Value       = Soptype;
            xmlEmitido.Where.Soptype.Operator    = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Sopnumbe.Conjuction = WhereParameter.Conj.And;
            xmlEmitido.Where.Sopnumbe.Value      = Sopnumbe;
            xmlEmitido.Where.Sopnumbe.Operator   = WhereParameter.Operand.Equal;
            xmlEmitido.Where.Estado.Conjuction   = WhereParameter.Conj.And;
            xmlEmitido.Where.Estado.Value        = eBaseAnterior; // "emitido";
            xmlEmitido.Where.Estado.Operator     = WhereParameter.Operand.Equal;
            try
            {
                if (xmlEmitido.Query.Load())
                {
                    if (!eBaseAnterior.Equals(eBaseNuevo))
                    {
                        xmlEmitido.Estado = eBaseNuevo;         // "anulado";
                    }
                    xmlEmitido.FechaAnulacion     = DateTime.Now;
                    xmlEmitido.IdUsuarioAnulacion = Utiles.Derecha(idusuario, 10);
                    xmlEmitido.EstadoActual       = eBinarioActual;
                    xmlEmitido.MensajeEA          = Utiles.Derecha(mensajeEA, 255);
                    xmlEmitido.NoAprobacion       = noAprobacion;
                    xmlEmitido.Save();
                    //ultimoMensaje = "Completado.";
                }
                else
                {
                    throw new ArgumentException(Sopnumbe + " No está en la bitácora en estado 'emitido'.");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Inserta datos de una factura en el log de facturas.
        /// </summary>
        /// <returns></returns>
        public void Save(string mensaje, string idusuario, string innerxml, string idExterno)
        {
            try
            {
                _sMsj = "";
                _iErr = 0;
                //log de facturas xml emitido y xml anulado
                cfdLogFacturaXML logVenta = new cfdLogFacturaXML(_Conexion.ConnStr);

                logVenta.AddNew();
                logVenta.Soptype  = _sopType;
                logVenta.Sopnumbe = _sopnumbe;

                logVenta.Estado       = _cicloDeVida.targetSingleStatus;
                logVenta.EstadoActual = _cicloDeVida.targetBinStatus;
                logVenta.NoAprobacion = _cicloDeVida.idxTargetSingleStatus.ToString();
                logVenta.MensajeEA    = Utiles.Derecha(_cicloDeVida.EstadoEnPalabras(_cicloDeVida.targetBinStatus), 255);
                logVenta.Mensaje      = Utiles.Derecha(mensaje, 255);
                if (!innerxml.Equals(""))
                {
                    logVenta.ArchivoXML = innerxml;
                }
                logVenta.IdExterno = idExterno;

                logVenta.FechaEmision       = DateTime.Now;
                logVenta.IdUsuario          = Utiles.Derecha(idusuario, 10);
                logVenta.IdUsuarioAnulacion = "-";
                logVenta.FechaAnulacion     = new DateTime(1900, 1, 1);

                logVenta.Save();
            }
            catch (Exception eLog)
            {
                _sMsj = "Contacte al administrador. No se puede ingresar la tarea en la Bitácora. [LogFacturaXMLService.Save] " + eLog.Message;
                _iErr++;
                throw;
            }
        }