// Override of the ToString Method public string ToString() { // Serializing Object as CSV return(String.Join(",", ("\"" + Url + "\""), ("\"" + ReferenceDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""), ("\"" + Name.Replace(",", "") + "\" "), ("\"" + Developer.Replace(",", "") + "\""), ("\"" + IsTopDeveloper + "\""), ("\"" + DeveloperURL.Replace(",", "") + "\""), ("\"" + PublicationDate.ToString("yyyy-MM-dd").Replace(",", "") + "\""), ("\"" + Category.Replace(",", "") + "\""), ("\"" + IsFree + "\""), ("\"" + Price + "\""), ("\"" + Reviewers + "\""), ("\"" + Score.Total + "\""), ("\"" + Score.Count + "\""), ("\"" + Score.FiveStars + "\""), ("\"" + Score.FourStars + "\""), ("\"" + Score.ThreeStars + "\""), ("\"" + Score.TwoStars + "\""), ("\"" + Score.OneStars + "\""), ("\"" + LastUpdateDate.ToString("yyyy-MM-dd") + "\""), //("\"" + AppSize + "\""), ("\"" + Instalations.Replace(",", ".") + "\""), ("\"" + CurrentVersion.Replace(",", "") + "\""), ("\"" + MinimumOSVersion.Replace(",", "") + "\""), ("\"" + ContentRating.Replace(",", "") + "\""), ("\"" + HaveInAppPurchases + "\""), ("\"" + DeveloperEmail.Replace(",", "") + "\""), ("\"" + DeveloperWebsite.Replace(",", "") + "\""), ("\"" + DeveloperPrivacyPolicy.Replace(",", "") + "\""), ("\"" + Description.Replace(",", "") + "\""))); }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("xmlns", EspacioNombres.xmlnsVoidedDocuments); writer.WriteAttributeString("xmlns:cac", EspacioNombres.cac); writer.WriteAttributeString("xmlns:cbc", EspacioNombres.cbc); writer.WriteAttributeString("xmlns:ds", EspacioNombres.ds); writer.WriteAttributeString("xmlns:ext", EspacioNombres.ext); writer.WriteAttributeString("xmlns:sac", EspacioNombres.sac); writer.WriteAttributeString("xmlns:xsi", EspacioNombres.xsi); #region UBLExtensions writer.WriteStartElement("ext:UBLExtensions"); { writer.WriteStartElement("ext:UBLExtension"); { writer.WriteStartElement("ext:ExtensionContent"); { #region Signature writer.WriteStartElement("cac:Signature"); { writer.WriteElementString("cbc:ID", Signature.Id); #region SignatoryParty writer.WriteStartElement("cac:SignatoryParty"); writer.WriteStartElement("cac:PartyIdentification"); writer.WriteElementString("cbc:ID", Signature.SignatoryParty.PartyIdentification.Id.Value); writer.WriteEndElement(); #region PartyName writer.WriteStartElement("cac:PartyName"); writer.WriteElementString("cbc:Name", Signature.SignatoryParty.PartyName.Name); writer.WriteEndElement(); #endregion PartyName writer.WriteEndElement(); #endregion SignatoryParty #region DigitalSignatureAttachment writer.WriteStartElement("cac:DigitalSignatureAttachment"); writer.WriteStartElement("cac:ExternalReference"); writer.WriteElementString("cbc:URI", Signature.DigitalSignatureAttachment.ExternalReference.Uri.Trim()); writer.WriteEndElement(); writer.WriteEndElement(); #endregion DigitalSignatureAttachment } writer.WriteEndElement(); #endregion Signature } writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); #endregion UBLExtensions writer.WriteElementString("cbc:UBLVersionID", UblVersionId); writer.WriteElementString("cbc:CustomizationID", CustomizationId); writer.WriteElementString("cbc:ID", Id); writer.WriteElementString("cbc:ReferenceDate", ReferenceDate.ToString("yyyy-MM-dd")); writer.WriteElementString("cbc:IssueDate", IssueDate.ToString("yyyy-MM-dd")); #region Signature writer.WriteStartElement("cac:Signature"); { writer.WriteElementString("cbc:ID", Signature.Id); #region SignatoryParty writer.WriteStartElement("cac:SignatoryParty"); { writer.WriteStartElement("cac:PartyIdentification"); writer.WriteElementString("cbc:ID", Signature.SignatoryParty.PartyIdentification.Id.Value); writer.WriteEndElement(); #region PartyName writer.WriteStartElement("cac:PartyName"); { writer.WriteStartElement("cbc:Name"); writer.WriteCData(Signature.SignatoryParty.PartyName.Name); writer.WriteEndElement(); } writer.WriteEndElement(); #endregion PartyName } writer.WriteEndElement(); #endregion SignatoryParty #region DigitalSignatureAttachment writer.WriteStartElement("cac:DigitalSignatureAttachment"); { writer.WriteStartElement("cac:ExternalReference"); writer.WriteElementString("cbc:URI", Signature.DigitalSignatureAttachment.ExternalReference.Uri.Trim()); writer.WriteEndElement(); } writer.WriteEndElement(); #endregion DigitalSignatureAttachment } writer.WriteEndElement(); #endregion Signature #region AccountingSupplierParty writer.WriteStartElement("cac:AccountingSupplierParty"); { writer.WriteElementString("cbc:CustomerAssignedAccountID", AccountingSupplierParty.CustomerAssignedAccountId); writer.WriteElementString("cbc:AdditionalAccountID", AccountingSupplierParty.AdditionalAccountId); #region Party writer.WriteStartElement("cac:Party"); { #region PartyLegalEntity writer.WriteStartElement("cac:PartyLegalEntity"); { writer.WriteStartElement("cbc:RegistrationName"); writer.WriteCData(AccountingSupplierParty.Party.PartyLegalEntity.RegistrationName); writer.WriteEndElement(); } writer.WriteEndElement(); #endregion PartyLegalEntity } writer.WriteEndElement(); #endregion Party } writer.WriteEndElement(); #endregion AccountingSupplierParty #region VoidedDocumentsLines foreach (var item in VoidedDocumentsLines) { writer.WriteStartElement("sac:VoidedDocumentsLine"); { writer.WriteElementString("cbc:LineID", item.LineId.ToString()); writer.WriteElementString("cbc:DocumentTypeCode", item.DocumentTypeCode); writer.WriteElementString("sac:DocumentSerialID", item.DocumentSerialID); writer.WriteElementString("sac:DocumentNumberID", item.DocumentNumberID.ToString()); writer.WriteStartElement("sac:VoidReasonDescription"); writer.WriteCData(item.VoidReasonDescription); writer.WriteEndElement(); } writer.WriteEndElement(); } #endregion VoidedDocumentsLines }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("xmlns", EspacioNombres.xmlnsSummaryDocuments); writer.WriteAttributeString("xmlns:cac", EspacioNombres.cac); writer.WriteAttributeString("xmlns:cbc", EspacioNombres.cbc); writer.WriteAttributeString("xmlns:ds", EspacioNombres.ds); writer.WriteAttributeString("xmlns:ext", EspacioNombres.ext); writer.WriteAttributeString("xmlns:sac", EspacioNombres.sac); writer.WriteAttributeString("xmlns:xsi", EspacioNombres.xsi); #region UBLExtensions { writer.WriteStartElement("ext:UBLExtensions"); #region UBLExtension { writer.WriteStartElement("ext:UBLExtension"); #region ExtensionContent { writer.WriteStartElement("ext:ExtensionContent"); // En esta zona va el certificado digital. writer.WriteEndElement(); } #endregion ExtensionContent writer.WriteEndElement(); } #endregion UBLExtension writer.WriteEndElement(); } #endregion UBLExtensions writer.WriteElementString("cbc:UBLVersionID", UblVersionId); writer.WriteElementString("cbc:CustomizationID", CustomizationId); writer.WriteElementString("cbc:ID", Id); writer.WriteElementString("cbc:ReferenceDate", ReferenceDate.ToString("yyyy-MM-dd")); writer.WriteElementString("cbc:IssueDate", IssueDate.ToString("yyyy-MM-dd")); #region Signature writer.WriteStartElement("cac:Signature"); writer.WriteElementString("cbc:ID", Signature.Id); #region SignatoryParty writer.WriteStartElement("cac:SignatoryParty"); writer.WriteStartElement("cac:PartyIdentification"); writer.WriteElementString("cbc:ID", Signature.SignatoryParty.PartyIdentification.Id.Value); writer.WriteEndElement(); #region PartyName writer.WriteStartElement("cac:PartyName"); //writer.WriteStartElement("cbc:Name"); //writer.WriteCData(Signature.SignatoryParty.PartyName.Name); //writer.WriteEndElement(); writer.WriteElementString("cbc:Name", Signature.SignatoryParty.PartyName.Name); writer.WriteEndElement(); #endregion PartyName writer.WriteEndElement(); #endregion SignatoryParty #region DigitalSignatureAttachment writer.WriteStartElement("cac:DigitalSignatureAttachment"); writer.WriteStartElement("cac:ExternalReference"); writer.WriteElementString("cbc:URI", Signature.DigitalSignatureAttachment.ExternalReference.Uri.Trim()); writer.WriteEndElement(); writer.WriteEndElement(); #endregion DigitalSignatureAttachment writer.WriteEndElement(); #endregion Signature #region AccountingSupplierParty writer.WriteStartElement("cac:AccountingSupplierParty"); writer.WriteElementString("cbc:CustomerAssignedAccountID", AccountingSupplierParty.CustomerAssignedAccountId); writer.WriteElementString("cbc:AdditionalAccountID", AccountingSupplierParty.AdditionalAccountId); #region Party writer.WriteStartElement("cac:Party"); #region PartyLegalEntity writer.WriteStartElement("cac:PartyLegalEntity"); { writer.WriteStartElement("cbc:RegistrationName"); writer.WriteCData(AccountingSupplierParty.Party.PartyLegalEntity.RegistrationName); writer.WriteEndElement(); } writer.WriteEndElement(); #endregion PartyLegalEntity writer.WriteEndElement(); #endregion Party writer.WriteEndElement(); #endregion AccountingSupplierParty #region SummaryDocumentsLines foreach (var item in SummaryDocumentsLines) { writer.WriteStartElement("sac:SummaryDocumentsLine"); { writer.WriteElementString("cbc:LineID", item.LineId.ToString()); writer.WriteElementString("cbc:DocumentTypeCode", item.DocumentTypeCode); if (!string.IsNullOrEmpty(item.Id)) { writer.WriteElementString("cbc:ID", item.Id); } else { writer.WriteElementString("sac:DocumentSerialID", item.DocumentSerialId); writer.WriteElementString("sac:StartDocumentNumberID", item.StartDocumentNumberId.ToString()); writer.WriteElementString("sac:EndDocumentNumberID", item.EndDocumentNumberId.ToString()); } if (!string.IsNullOrEmpty(item.AccountingCustomerParty.AdditionalAccountId)) { writer.WriteStartElement("cac:AccountingCustomerParty"); { writer.WriteElementString("cbc:CustomerAssignedAccountID", item.AccountingCustomerParty.CustomerAssignedAccountId); writer.WriteElementString("cbc:AdditionalAccountID", item.AccountingCustomerParty.AdditionalAccountId); } writer.WriteEndElement(); } if (!string.IsNullOrEmpty(item.BillingReference.InvoiceDocumentReference.Id)) { writer.WriteStartElement("cac:BillingReference"); { writer.WriteStartElement("cac:InvoiceDocumentReference"); { writer.WriteElementString("cbc:ID", item.BillingReference.InvoiceDocumentReference.Id); writer.WriteElementString("cbc:DocumentTypeCode", item.BillingReference.InvoiceDocumentReference.DocumentTypeCode); } writer.WriteEndElement(); } writer.WriteEndElement(); } if (item.ConditionCode.HasValue) { writer.WriteStartElement("cac:Status"); { writer.WriteElementString("cbc:ConditionCode", item.ConditionCode.Value.ToString()); } writer.WriteEndElement(); } writer.WriteStartElement("sac:TotalAmount"); { writer.WriteAttributeString("currencyID", item.TotalAmount.CurrencyId); writer.WriteValue(item.TotalAmount.Value.ToString(Formatos.FormatoNumerico, Formato)); } writer.WriteEndElement(); foreach (var billing in item.BillingPayments) { writer.WriteStartElement("sac:BillingPayment"); { writer.WriteStartElement("cbc:PaidAmount"); { writer.WriteAttributeString("currencyID", item.TotalAmount.CurrencyId); writer.WriteValue(billing.PaidAmount.Value.ToString(Formatos.FormatoNumerico, Formato)); } writer.WriteEndElement(); writer.WriteElementString("cbc:InstructionID", billing.InstructionId); } writer.WriteEndElement(); } writer.WriteStartElement("cac:AllowanceCharge"); { writer.WriteElementString("cbc:ChargeIndicator", item.AllowanceCharge.ChargeIndicator ? "true" : "false"); writer.WriteStartElement("cbc:Amount"); { writer.WriteAttributeString("currencyID", item.AllowanceCharge.Amount.CurrencyId); writer.WriteValue(item.AllowanceCharge.Amount.Value.ToString(Formatos.FormatoNumerico, Formato)); } writer.WriteEndElement(); } writer.WriteEndElement(); foreach (var taxTotal in item.TaxTotals) { writer.WriteStartElement("cac:TaxTotal"); writer.WriteStartElement("cbc:TaxAmount"); writer.WriteAttributeString("currencyID", taxTotal.TaxAmount.CurrencyId); writer.WriteString(taxTotal.TaxAmount.Value.ToString(Formatos.FormatoNumerico, Formato)); writer.WriteEndElement(); #region TaxSubtotal { writer.WriteStartElement("cac:TaxSubtotal"); writer.WriteStartElement("cbc:TaxAmount"); writer.WriteAttributeString("currencyID", taxTotal.TaxSubtotal.TaxAmount.CurrencyId); writer.WriteString(taxTotal.TaxAmount.Value.ToString(Formatos.FormatoNumerico, Formato)); writer.WriteEndElement(); #region TaxCategory { writer.WriteStartElement("cac:TaxCategory"); #region TaxScheme { writer.WriteStartElement("cac:TaxScheme"); writer.WriteElementString("cbc:ID", taxTotal.TaxSubtotal.TaxCategory.TaxScheme.Id); writer.WriteElementString("cbc:Name", taxTotal.TaxSubtotal.TaxCategory.TaxScheme.Name); writer.WriteElementString("cbc:TaxTypeCode", taxTotal.TaxSubtotal.TaxCategory.TaxScheme.TaxTypeCode); writer.WriteEndElement(); } #endregion TaxScheme writer.WriteEndElement(); } #endregion TaxCategory writer.WriteEndElement(); } #endregion TaxSubtotal writer.WriteEndElement(); } } writer.WriteEndElement(); } #endregion SummaryDocumentsLines }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("xmlns", EspacioNombres.xmlnsSummaryDocuments); writer.WriteAttributeString("xmlns:cac", EspacioNombres.cac); writer.WriteAttributeString("xmlns:cbc", EspacioNombres.cbc); writer.WriteAttributeString("xmlns:ds", EspacioNombres.ds); writer.WriteAttributeString("xmlns:ext", EspacioNombres.ext); writer.WriteAttributeString("xmlns:sac", EspacioNombres.sac); writer.WriteAttributeString("xmlns:xsi", EspacioNombres.xsi); #region UBLExtensions { writer.WriteStartElement("ext:UBLExtensions"); #region UBLExtension { writer.WriteStartElement("ext:UBLExtension"); #region ExtensionContent { writer.WriteStartElement("ext:ExtensionContent"); // En esta zona va el certificado digital. writer.WriteEndElement(); } #endregion writer.WriteEndElement(); } #endregion writer.WriteEndElement(); } #endregion writer.WriteElementString("cbc:UBLVersionID", UBLVersionID); writer.WriteElementString("cbc:CustomizationID", CustomizationID); writer.WriteElementString("cbc:ID", ID); writer.WriteElementString("cbc:ReferenceDate", ReferenceDate.ToString("yyyy-MM-dd")); writer.WriteElementString("cbc:IssueDate", IssueDate.ToString("yyyy-MM-dd")); #region Signature writer.WriteStartElement("cac:Signature"); writer.WriteElementString("cbc:ID", Signature.ID); #region SignatoryParty writer.WriteStartElement("cac:SignatoryParty"); writer.WriteStartElement("cac:PartyIdentification"); writer.WriteElementString("cbc:ID", Signature.SignatoryParty.PartyIdentification.ID.value); writer.WriteEndElement(); #region PartyName writer.WriteStartElement("cac:PartyName"); //writer.WriteStartElement("cbc:Name"); //writer.WriteCData(Signature.SignatoryParty.PartyName.Name); //writer.WriteEndElement(); writer.WriteElementString("cbc:Name", Signature.SignatoryParty.PartyName.Name); writer.WriteEndElement(); #endregion writer.WriteEndElement(); #endregion #region DigitalSignatureAttachment writer.WriteStartElement("cac:DigitalSignatureAttachment"); writer.WriteStartElement("cac:ExternalReference"); writer.WriteElementString("cbc:URI", Signature.DigitalSignatureAttachment.ExternalReference.URI.Trim()); writer.WriteEndElement(); writer.WriteEndElement(); #endregion writer.WriteEndElement(); #endregion #region AccountingSupplierParty writer.WriteStartElement("cac:AccountingSupplierParty"); writer.WriteElementString("cbc:CustomerAssignedAccountID", AccountingSupplierParty.CustomerAssignedAccountID); writer.WriteElementString("cbc:AdditionalAccountID", AccountingSupplierParty.AdditionalAccountID.ToString()); #region Party writer.WriteStartElement("cac:Party"); #region PartyLegalEntity writer.WriteStartElement("cac:PartyLegalEntity"); { writer.WriteElementString("cbc:RegistrationName", AccountingSupplierParty.Party.PartyLegalEntity.RegistrationName); } writer.WriteEndElement(); #endregion writer.WriteEndElement(); #endregion writer.WriteEndElement(); #endregion #region SummaryDocumentsLines foreach (var item in SummaryDocumentsLines) { writer.WriteStartElement("sac:SummaryDocumentsLine"); { writer.WriteElementString("cbc:LineID", item.LineID.ToString()); writer.WriteElementString("cbc:DocumentTypeCode", item.DocumentTypeCode); writer.WriteElementString("sac:DocumentSerialID", item.DocumentSerialID); writer.WriteElementString("sac:StartDocumentNumberID", item.StartDocumentNumberID.ToString()); writer.WriteElementString("sac:EndDocumentNumberID", item.EndDocumentNumberID.ToString()); writer.WriteStartElement("sac:TotalAmount"); { writer.WriteAttributeString("currencyID", item.TotalAmount.currencyID); writer.WriteValue(item.TotalAmount.value.ToString(Constantes.Constantes.FormatoNumerico)); } writer.WriteEndElement(); foreach (var billing in item.BillingPayments) { } } writer.WriteEndElement(); } #endregion }