/// <summary> /// Ritorna la rappresentazione Xml. /// </summary> /// <param name="function"></param> /// <returns></returns> public string ToXml() { using (XmlWrite xw = new XmlWrite()) { if (XmlFunction == null) { //Crea Xml Standard xw.WriteStartElement("MESSAGELIST"); try { for (int i = 0; i < this.Count; i++) { xw.WriteRaw(this[i].ToXml()); } } finally { xw.WriteEndElement(); } } else { //Utilizza la funzione specificata XmlFunction(this, xw); } return(xw.ToString()); } }
/// <summary> /// Ritorna rappresentazione Xml del pager /// </summary> /// <returns></returns> public string ToXml() { using (XmlWrite xw = new XmlWrite()) { if (this.XmlFunction == null) { //Formattazione standard xw.WriteStartElement("Pager"); try { xw.WriteElementString("Position", this.Position.ToString()); xw.WriteElementString("Offset", this.Offset.ToString()); xw.WriteElementString("Page", this.Page.ToString()); xw.WriteElementString("TotRecords", this.TotRecords.ToString()); xw.WriteElementString("TotPages", this.TotPages.ToString()); } finally { xw.WriteEndElement(); } } else { this.XmlFunction(this, xw); } return(xw.ToString()); } }
/// <summary> /// Ritorna Xml con dati oggetti. E' possibile specificare un delegato per poter manipolare /// l'xml di ogni oggetto con altri dati. Utilizzando rewriteAll viene soppresso l'output Xml standard /// dell'oggetto /// </summary> /// <param name="function"> /// Delegato ad una funzione (e.s. AggiornaXmlUtente(Utente ut, Xmlwrite xw)) per la manipolazione dell'xml /// </param> /// <param name="rewriteAll"> /// Impostato a true disabilita l'output xml standard dell'oggetto /// </param> /// <param name="args"> /// Dati esterni da inviare alla funzione di scrittura xml /// </param> /// <returns></returns> public string ToXml(XmlFunction function, bool rewriteAll, params object[] args) { DataObjectBase o; using (XmlWrite xw = new XmlWrite()) { for (int i = 0; i < this.Count; i++) { o = this[i]; xw.WriteStartElement(o.mClassSchema.ClassName); try { if (!rewriteAll) { xw.WriteRaw(o.ToXml()); } //Se fornita funzione allora la richiama if (function != null) { function((T)o, xw, args); } } finally { xw.WriteEndElement(); } } return(xw.ToString()); } }
/// <summary> /// Rimpiazza i contatori nell'header /// </summary> /// <param name="dispTot"></param> /// <param name="importoTot"></param> /// <returns></returns> /// <remarks></remarks> private string SCT_ReplaceGrpHdr_SEPA(int dispTot, decimal importoTot) { // [[[NBOFTXS]]] string asdcXml = sdcXml.ToString().Replace(NBOFTXS, dispTot.ToString()); // [[[CTRLSUM]]] asdcXml = asdcXml.Replace(CTRLSUM, Numeri.DecimalToStringUNIV(importoTot)); return(asdcXml); }
/// <summary> /// Scrive Xml con possibilita' di integrazione dati attraverso la specifica di una funzione /// di manipolazione /// </summary> /// <param name="function"></param> /// <param name="rewriteAll"> /// Se true allora non emette l'Xml standard dell'oggetto /// </param> /// <param name="args"></param> /// <returns></returns> public string ToXml(XmlFunction function, bool rewriteAll, params object[] args) { using (XmlWrite xw = new XmlWrite()) { //Se deve riscrivere if (!rewriteAll) { xw.WriteRaw(this.ToXml(1)); } //Se fornita funzione allora la richiama if (function != null) { function((T)this, xw, args); } return(xw.ToString()); } }
/// <summary> /// Ritorna Xml contenente i valori delle proprieta' in input /// </summary> /// <param name="propertyNames"></param> /// <returns></returns> public string ToXml(params string[] propertyNames) { //Controllo array if (propertyNames == null || propertyNames.Length == 0) { throw new ObjectException("{0} - L'elenco di proprieta' fornite e' vuoto"); } using (XmlWrite xw = new XmlWrite()) { for (int i = 0; i < propertyNames.Length; i++) { //Verifica proprietà una per una in base al tipo this.mClassSchema.Properties.GetPropertyByName(propertyNames[i]).WriteXml(xw, this, 0); } return(xw.ToString()); } }
/// <summary> /// Scrive xml lista /// </summary> /// <param name="depht"></param> /// <returns></returns> public string ToXml(int depht) { using (XmlWrite xw = new XmlWrite()) { for (int i = 0; i < this.mInnerList.Count; i++) { xw.WriteStartElement(this.mObjSchema.ClassName); try { xw.WriteRaw(this.getItem(i).ToXml(depht)); } finally { xw.WriteEndElement(); } } return(xw.ToString()); } }
/// <summary> /// Rappresentazione XML del messaggio /// </summary> /// <returns></returns> public string ToXml() { using (XmlWrite xw = new XmlWrite()) { xw.WriteStartElement("MESSAGE"); try { xw.WriteElementString("CODE", this.Code.ToString()); xw.WriteElementString("TEXT", this.Text); xw.WriteElementString("SEVERITY", this.Severity.ToString().ToUpper()); xw.WriteElementString("UIFIELD", this.UiField); //Se presenti parametri li inserisce if (this.Params.Count > 0) { foreach (var item in this.Params) { xw.WriteStartElement("PARAMS"); try { xw.WriteElementString("KEY", item.Key); xw.WriteElementString("VALUE", item.Value); } finally { xw.WriteEndElement(); } } } } finally { xw.WriteEndElement(); } return(xw.ToString()); } }
/// <summary> /// Ritorna rappresentazione Xml dell oggetto fornendo il livello di profondita' (navigazione sotto-oggetti) /// 0 indica non navigare nei sotto-oggetti /// Prestare attenzione ad eventuali riferimenti circolari /// </summary> /// <param name="depth"></param> /// <returns></returns> public virtual string ToXml(int depth) { Property oProp; using (XmlWrite xw = new XmlWrite()) { for (int k = 0; k < this.mClassSchema.Properties.Count; k++) { //Verifica proprietà una per una in base al tipo oProp = this.mClassSchema.Properties[k]; //Verifica se esclusa da Xml if (oProp.ExcludeXml) { continue; } oProp.WriteXml(xw, this, depth); } return(xw.ToString()); } }
/// <summary> /// Ritorna Xml per la gestione della paginazione /// </summary> /// <returns></returns> public string GetPagingXml() { DataPager pager = this.Pager ?? new DataPager(); using (XmlWrite xw = new XmlWrite()) { //Formattazione standard xw.WriteStartElement("Paginazione"); try { xw.WriteElementString("Offset", pager.Offset.ToString()); xw.WriteElementString("Pagina", pager.Page.ToString()); xw.WriteElementString("TotRecord", pager.TotRecords.ToString()); xw.WriteElementString("TotPagine", pager.TotPages.ToString()); } finally { xw.WriteEndElement(); } return(xw.ToString()); } }