/// <summary> /// Serializes the specified writer. /// </summary> /// <param name="writer"> /// The writer. /// </param> public void Serialize(UPSerializer writer) { int count = this.NumberOfRecordIds(); writer.WriteElementStart("Row"); writer.WriteAttributeValue("record", this.RecordIdentificationAtIndex(0)); var serializationInfo = this.Result?.SerializationInfo; for (int i = 1; i < count; i++) { var recordIdentification = this.RecordIdentificationAtIndex(i); if (!string.IsNullOrEmpty(recordIdentification)) { writer.WriteAttributeValue(serializationInfo?.RecordIdAttributeAtIndex(i), recordIdentification); } } count = serializationInfo?.NumberOfColumns ?? 0; for (int i = 0; i < count; i++) { var value = this.ReportValueAtIndex(i); if (string.IsNullOrEmpty(value)) { continue; } var columnInfo = serializationInfo?.ColumnInfoAtIndex(i); var attributeDictionary = columnInfo?.HasAttributes ?? false ? new Dictionary <string, string>(3) : null; var functionName = columnInfo?.FunctionName; if (string.IsNullOrEmpty(functionName)) { attributeDictionary.SetObjectForKey(columnInfo?.IndexAttributeName, "idx"); } if (columnInfo?.ReportRawValue ?? false) { var rawValue = this.RawValueAtIndex(i); attributeDictionary.SetObjectForKey(rawValue, "value"); if (columnInfo.ReportExternalKey) { var extKeyValue = columnInfo.ExternalKeyForRawValue(rawValue); if (!string.IsNullOrEmpty(extKeyValue)) { attributeDictionary.SetObjectForKey(extKeyValue, "extKey"); } } } writer.WriteElementValueAttributes( !string.IsNullOrEmpty(functionName) ? functionName : "Value", value, attributeDictionary); } writer.WriteElementEnd(); }
/// <summary> /// Serializes the specified writer. /// </summary> /// <param name="writer"> /// The writer. /// </param> public void Serialize(UPSerializer writer) { writer.WriteElementStart("Value"); writer.WriteAttributeIntegerValue("fieldId", this.FieldId); writer.WriteElementValue("New", this.Value); if (!string.IsNullOrEmpty(this.OldValue)) { writer.WriteElementValue("Old", this.OldValue); } writer.WriteElementEnd(); }
/// <summary> /// Serializes the specified writer. /// </summary> /// <param name="writer"> /// The writer. /// </param> public void Serialize(UPSerializer writer) { if (writer == null) { return; } writer.WriteElementStart("Link"); writer.WriteAttributeValue("infoAreaId", this.InfoAreaId); writer.WriteAttributeIntegerValue("linkId", this.LinkId); writer.WriteElementStringValue(this.RecordId); writer.WriteElementEnd(); }
/// <summary> /// Serializes the name of the root element. /// </summary> /// <param name="writer"> /// The writer. /// </param> /// <param name="rootElementName"> /// Name of the root element. /// </param> public void SerializeRootElementName(UPSerializer writer, string rootElementName) { int count = this.RowCount; writer.WriteElementStart(rootElementName); writer.WriteAttributeValue("online", this.IsServer ? "true" : "false"); writer.WriteElementStart("Rows"); for (int i = 0; i < count; i++) { writer.WriteObject(this.ResultRowAtIndex(i) as UPSerializable); } writer.WriteElementEnd(); if (this.MetaInfo != null) { var _serializationInfo = this.SerializationInfo; writer.WriteElementStart("Columns"); count = _serializationInfo.NumberOfColumns; for (int i = 0; i < count; i++) { var columnInfo = _serializationInfo.ColumnInfoAtIndex(i); var label = columnInfo.Label; if (!string.IsNullOrEmpty(columnInfo.FunctionName)) { writer.WriteElementValue(columnInfo.FunctionName, label); } else { var attributes = new Dictionary <string, string> { { "idx", columnInfo.IndexAttributeName } }; writer.WriteElementValueAttributes("Column", label, attributes); } } writer.WriteElementEnd(); } writer.WriteElementEnd(); }
/// <summary> /// Serializes the specified writer. /// </summary> /// <param name="writer"> /// The writer. /// </param> public void Serialize(UPSerializer writer) { this.SerializeRootElementName(writer, "Result"); }
/// <summary> /// Serializes the specified writer. /// </summary> /// <param name="writer">The writer.</param> public void Serialize(UPSerializer writer) { if (!this.Loaded) { this.LoadFromOfflineStorage(); } writer.WriteElementStart("Request"); writer.WriteAttributeValue("clientVersion", Constants.CRMPAD_CLIENTVERSION); writer.WriteAttributeIntegerValue("id", this.RequestNr); writer.WriteAttributeValue("type", this.ProcessType.ToString()); writer.WriteAttributeIntegerValue("mode", (int)this.RequestMode); writer.WriteAttributeIntegerValue("serverRequestNumber", this.ServerRequestNumber); writer.WriteElementValue("title", this.TitleLine); if (!string.IsNullOrEmpty(this.Error)) { writer.WriteElementValue("ServerError", this.Error); } if (!string.IsNullOrEmpty(this.ServerDateTime)) { writer.WriteElementValue("dateTime", this.ServerDateTime); } if (!string.IsNullOrEmpty(this.ServerSessionId)) { writer.WriteElementValue("sessionId", this.ServerSessionId); } if (!string.IsNullOrEmpty(this.Response)) { writer.WriteElementValue("ServerResponse", this.Response); } if (this.BaseErrorCode != 0) { writer.WriteElementValue("BaseErrorCode", this.BaseErrorCode.ToString()); } if (!string.IsNullOrEmpty(this.ApplicationVersion)) { writer.WriteElementValue("Version", this.ApplicationVersion); } string username = ServerSession.CurrentSession.UserName; if (!string.IsNullOrEmpty(username)) { writer.WriteElementValue("username", username); } this.SerializeDetails(writer); if (this.RelatedInfoDictionary?.Count > 0) { writer.WriteElementStart("relatedInfo"); foreach (string key in this.RelatedInfoDictionary.Keys) { object v = this.RelatedInfoDictionary[key]; writer.WriteElementValue(key, v.ToString()); } writer.WriteElementEnd(); } var dependentRequests = this.DependentRequests; if (dependentRequests.Count > 0) { writer.WriteElementStart("DependentRequests"); foreach (UPOfflineRequest dependentRequest in dependentRequests) { dependentRequest.Serialize(writer); } writer.WriteElementEnd(); } writer.WriteElementEnd(); }
/// <summary> /// Serializes the details. /// </summary> /// <param name="writer">The writer.</param> void SerializeDetails(UPSerializer writer) { }