Class Ticket
Represents a ticket used by the Ticketing Gateway.
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
public class Ticket : IManagerIdentifiableObject<TicketID>, IManagerIdentifiableObject<Guid>, IManagerFilterableObject<Ticket>, CustomDataType, DataType, ITrackLastModified
- Inheritance
-
Ticket
- Implements
- Extension Methods
Examples
private Ticket CreateTicket(TicketFieldResolver resolver)
{
Ticket ticket = new Ticket();
ticket.CustomFieldResolverID = resolver.ID;
ticket.CustomTicketFields["State"] = new GenericEnumEntry<int>() { Name = "Created", Value = 0 };
ticket.CustomTicketFields["Status"] = "Created";
ticket.CustomTicketFields["User"] = "Geoffrey";
ticket.CustomTicketFields["Accnr"] = (long)789456123;
ticket.CustomTicketFields["Mail"] = "Geoffry@KingsLanding.gov";
ticket.CustomTicketFields["Addr"] = "789456123@internal.gov";
ticket.CustomTicketFields["Quality"] = 0.9;
ticket.CustomTicketFields["Score"] = 0x54;
ticket.Links.Add("Links", new TicketLink[]{ new TicketLink(new Skyline.DataMiner.Net.ElementID(123, 456)) });
string error;
if(!Helper.SetTicket(out error, ref ticket))
{
throw new DataMinerException("Something went wrong while creating the ticket: " + error);
}
return ticket;
}
The code snippet shown in the example uses hard-coded values for the ticket fields. In real implementations, these values will be known either by user input or by polling the third-party ticketing system.
Constructors
- Ticket(TicketID)
Initializes a new instance of the Ticket class using the specified ticket ID.
- Ticket(Guid)
Initializes a new instance of the Ticket class using the specified ticket GUID.
Fields
- CreationDate
Gets the creation time of this ticket.
- WasStitched
Gets a value indicating whether this object was stitched.
Properties
- CustomFieldResolverID
Gets or sets the ID of the TicketFieldResolver associated with this ticket.
- CustomTicketFields
Gets or sets the custom ticket fields of this ticket.
- DataTypeID
Gets a string representation of the ticket ID of this ticket.
- ID
Gets or sets the unique identifier of this ticket.
- Module
Gets or sets the module to which a ticket belongs.
- UID
This is the unique identifier of the ticket.
Methods
- AddTicketLink(string, TicketLink)
Adds the specified ticket link to the links set with the specified key.
- Clone()
Creates a new object that is a copy of the current instance.
- Equals(Ticket)
Determines whether the specified Ticket object is equal to the current object.
- Equals(object)
Determines whether the specified object is equal to the current object.
- FiltersTo(Ticket)
Checks if this object qualifies for the specified filter.
- FromIndexedJson(string)
Converts a JSON string to a Ticket object.
- FromJson(string)
Parses the specified JSON string and creates a Ticket object.
- GetChangedProperties(Ticket)
Compares this ticket to another ticket and returns a set of all the properties that are different.
- GetFileFriendlyTicketLinks()
Gets the file-friendly links of this ticket in JSON format.
- GetHashCode()
Calculates the hash code for this object.
- GetTicketField(string)
Gets the TicketField with specified name.
- GetTicketFieldResolver()
Returns the TicketFieldResolver when the Ticket has been stitched
- GetTicketFields()
Gets the fields of this ticket.
- GetTicketLinks()
Gets the links of this ticket.
- GetTicketLinksJson()
Gets the links of this ticket in JSON format.
- MergeWithAlarmProperties(Ticket, TicketFieldResolver, AlarmEventMessage)
Merges the alarm properties from the AlarmEventMessage in the ticket fields when the TicketFieldResolver defines an AlarmFilterField.
- MergeWithOverrideProperties(Ticket, List<TicketFieldOverrideConfig>, TicketFieldResolver, AlarmEventMessage)
Merges the alarm properties and default values in the ticket fields as defined in the override fields.
- RemoveTicketLink(string, TicketLink)
Removes the specified ticket link.
- SetCreationDate(DateTime)
If you are a client. Don't use this!
- Stitch(Func<Guid, TicketFieldResolver>)
Stitches this ticket with the specified ticket provider.
- TicketFieldAsCustomSerializableJson()
Returns a JSONSerializableDictionary instance with the custom ticket fields.
- ToFilter<T>()
Returns a new FilterElement<T> instance based on this ticket.
- ToIndexedJson()
Converts this Ticket to a JSON string
- ToJson()
Converts this ticket to a JSON string.
- ToString()
Returns a string that represents the current object.
- ToStringArray()
Converts this ticket to a string array.
Events
- PropertyChanged
The event that is triggered when a property of the Ticket object changes.