private void ActualizarEstatusSAT()
 {
     try
     {
         var facturas = ventaController.SelectFacturasPendientesConfirmar();
         if (facturas.Count > 0)
         {
             foreach (var f in facturas)
             {
                 oCFDI.Venta = f;
                 oCFDI.ActualizarStatusSAT();
             }
         }
     }
     catch (Exception ex)
     {
         var error = new DymError();
         error.Message    = ex.Message;
         error.ToString   = ex.ToString();
         error.VentaId    = "NULL";
         error.LoggedUser = Ambiente.LoggedUser.UsuarioId;
         error.CreatedAt  = DateTime.Now;
         dymErrorController.InsertOne(error);
     }
 }
Exemple #2
0
        public void ActualizarStatusSAT()
        {
            Inicializar();
            bool   CrearLog = false;
            string s        = "";

            if (Venta == null || partidas.Count == 0 || empresa == null || cliente == null)
            {
                CrearLog = true;
                s       += "Venta || partidas || empresa || Cliente == null";
            }

            if (cliente.Rfc == null)
            {
                CrearLog = true;
                s       += "/";
                s       += "PROCESO ABORTADO, RFC DEL CLIENTE NO ES VÁLIDO";
            }

            if (cliente.Rfc.Trim().Length == 0)
            {
                CrearLog = true;
                s       += "/";
                s       += "PROCESO ABORTADO, RFC DEL CLIENTE NO ES VÁLIDO";
            }
            if (Venta.UuId == null)
            {
                CrearLog = true;
                s       += "/";
                s       += "Proceso abortado, este documento no es una factura o no está timbrada";
            }


            if (CrearLog)
            {
                var error = new DymError();
                error.Message    = s;
                error.ToString   = s;
                error.VentaId    = Venta == null ? "NULL" : Venta.VentaId.ToString();
                error.LoggedUser = Ambiente.LoggedUser.UsuarioId;
                error.CreatedAt  = DateTime.Now;
                dymErrorController.InsertOne(error);
                return;
            }



            respuestaCFDI = timbradoClient.VerStatus(
                empresa.UserWstimbrado,
                empresa.PassWstimbrado,
                Venta.UuId,
                (double)Math.Round(Venta.Total, 2),
                empresa.Rfc,
                cliente.Rfc);
            Venta.EstatusSat = respuestaCFDI.Mensaje;
            ventaController.UpdateOne(Venta);
        }
Exemple #3
0
 public bool InsertOne(DymError o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Add(o);
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show("Algo salio mal @ " + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }
Exemple #4
0
 public bool Update(DymError o)
 {
     try
     {
         using (var db = new DymContext())
         {
             db.Entry(o).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show("Algo salio mal @ " + GetType().Name + "\n" + ex.ToString());
     }
     return(false);
 }