/// <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();
        }
Ejemplo n.º 2
0
        /// <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 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();
        }