Пример #1
0
        /// <summary>
        /// Compares two ServiceTicket identifications for equality.
        /// </summary>
        /// <param name="ServiceTicketReference">A service ticket identification to compare with.</param>
        /// <returns>True if both match; False otherwise.</returns>
        public Boolean Equals(ServiceTicketReference ServiceTicketReference)
        {
            if ((Object)ServiceTicketReference == null)
            {
                return(false);
            }

            return(Id.Equals(ServiceTicketReference.Id));// &&
//                   Status.Equals(ServiceTicketReference.Status);
        }
Пример #2
0
        /// <summary>
        /// Compares two instances of this object.
        /// </summary>
        /// <param name="ServiceTicketReference">An object to compare with.</param>
        public Int32 CompareTo(ServiceTicketReference ServiceTicketReference)
        {
            if ((Object)ServiceTicketReference == null)
            {
                throw new ArgumentNullException(nameof(ServiceTicketReference), "The given ServiceTicketReference must not be null!");
            }

            // Compare ServiceTicket Ids
            var _Result = Id.CompareTo(ServiceTicketReference.Id);

            //// If equal: Compare ServiceTicket status
            //if (_Result == 0)
            //    _Result = Description.CompareTo(ServiceTicketReference.Description);

            return(_Result);
        }
Пример #3
0
        /// <summary>
        /// Try to parse the given service ticket change set JSON.
        /// </summary>
        /// <param name="JSONObject">A JSON object.</param>
        /// <param name="ServiceTicketReference">The parsed service ticket reference.</param>
        /// <param name="ErrorResponse">An error message.</param>
        public static Boolean TryParseJSON(JObject JSONObject,
                                           out ServiceTicketReference ServiceTicketReference,
                                           out String ErrorResponse)
        {
            try
            {
                ServiceTicketReference = null;

                if (JSONObject?.HasValues != true)
                {
                    ErrorResponse = "The given JSON object must not be null or empty!";
                    return(false);
                }

                #region Parse Context           [mandatory]

                if (JSONObject.ParseOptional("@context",
                                             "JSON-LD context information",
                                             out String Context,
                                             out ErrorResponse))
                {
                    if (ErrorResponse != null)
                    {
                        return(false);
                    }

                    if (Context != JSONLDContext)
                    {
                        ErrorResponse = @"The given JSON-LD ""@context"" information '" + Context + "' is not supported!";
                        return(false);
                    }
                }

                #endregion

                #region Parse ServiceTicketId   [mandatory]

                if (!JSONObject.ParseMandatory("serviceTicketId",
                                               "service ticket identification",
                                               ServiceTicket_Id.TryParse,
                                               out ServiceTicket_Id ServiceTicketId,
                                               out ErrorResponse))
                {
                    return(false);
                }

                #endregion

                #region Parse Comment           [optional]

                if (JSONObject.ParseOptional("comment",
                                             "comment",
                                             out I18NString Comment,
                                             out ErrorResponse))
                {
                    if (ErrorResponse != null)
                    {
                        return(false);
                    }
                }

                #endregion


                ServiceTicketReference = new ServiceTicketReference(ServiceTicketId,
                                                                    Comment);

                ErrorResponse = null;
                return(true);
            }
            catch (Exception e)
            {
                ErrorResponse          = e.Message;
                ServiceTicketReference = null;
                return(false);
            }
        }