public void Modificar(Entidades.Ticket Ticket) { try { Entidades.Ticket t = Leer(Ticket.Cuit, Ticket.Service); if (t.Cuit == null) { Crear(Ticket); } else { StringBuilder a = new StringBuilder(string.Empty); a.Append("update Ticket set "); a.Append("Service='" + Ticket.Service + "', "); a.Append("UniqueId='" + Ticket.UniqueId + "', "); a.Append("GenerationTime='" + Ticket.GenerationTime.ToString("yyyyMMdd HH:mm:ss") + "', "); a.Append("ExpirationTime='" + Ticket.ExpirationTime.ToString("yyyyMMdd HH:mm:ss") + "', "); a.Append("Sign='" + Ticket.Sign + "', "); a.Append("Token='" + Ticket.Token + "' "); a.AppendLine("where Cuit='" + Ticket.Cuit + "' and Service = '" + Ticket.Service + "' "); Ejecutar(a.ToString(), TipoRetorno.None, Transaccion.Usa, sesion.CnnStr); } } catch (Exception ex) { Funciones.GrabarLogTexto("Consultar.txt", ex.Message + " " + ex.StackTrace); throw new Exception(ex.Message); } }
private void Crear(Entidades.Ticket Ticket) { StringBuilder a = new StringBuilder(string.Empty); a.Append("Insert Ticket (Cuit, Service, UniqueId, GenerationTime, ExpirationTime, Sign, Token) values ("); a.Append("'" + Ticket.Cuit + "', "); a.Append("'" + Ticket.Service + "', "); a.Append("'" + Ticket.UniqueId + "', "); a.Append("'" + Ticket.GenerationTime.ToString("yyyyMMdd HH:mm:ss") + "', "); a.Append("'" + Ticket.ExpirationTime.ToString("yyyyMMdd HH:mm:ss") + "', "); a.Append("'" + Ticket.Sign + "', "); a.Append("'" + Ticket.Token + "')"); Funciones.GrabarLogTexto("Consultar.txt", "SCRIPT crear Ticket: " + a.ToString()); Ejecutar(a.ToString(), TipoRetorno.None, Transaccion.Usa, sesion.CnnStr); }