public Boolean Put(ref string error, Cotizacion cotizacion) { cotizacion.CantidadEnLetra = ServicioNumeroLetra.Convertir(cotizacion.Total.ToString("F"), true); this._contexto.Entry(cotizacion).State = EntityState.Modified; try { this._contexto.SaveChanges(); return(true); } catch (Exception e) { this._logger.EscribirError(e.ToString()); error = "Ocurrio un error al guardar cotización"; return(false); } }
public void Put(ref string error, ref Modelo.Factura factura, XmlDocument xmlDocumento) { try { XmlNodeList nodoss = xmlDocumento.GetElementsByTagName("tfd:TimbreFiscalDigital"); XmlAttributeCollection nodos = nodoss[0].Attributes; factura.FechaTimbrado = nodos["FechaTimbrado"].InnerText; factura.FolioFiscal = nodos["UUID"].InnerText; factura.NoCertificadoSat = nodos["NoCertificadoSAT"].InnerText; factura.SelloCfd = nodos["SelloCFD"].InnerText; factura.SelloSat = nodos["SelloSAT"].InnerText; factura.VersionTimbrado = nodos["Version"].InnerText; factura.Estatus = "Timbrada"; factura.CantidadEnLetra = ServicioNumeroLetra.Convertir(factura.Total.ToString("F"), true); } catch (Exception e) { this._logger.EscribirError(e.ToString()); } }
public Boolean Post(ref string error, Cotizacion cotizacion) { cotizacion.Fecha = DateTime.Now; var _servicioRelacion = new ServicioRelaciones(this._logger, this._contexto); cotizacion.CantidadEnLetra = ServicioNumeroLetra.Convertir(cotizacion.Total.ToString("F"), true); _servicioRelacion.SanitizarCotizacion(ref cotizacion); this._contexto.Cotizaciones.Add(cotizacion); try { this._contexto.SaveChanges(); return(true); } catch (Exception e) { this._logger.EscribirError(e.ToString()); error = "Ocurrio un error al guardar cotización"; return(false); } }