示例#1
0
 public JObject run(JObject args)
 {
     try {
         int ticketId = args.Value <int>("id");
         if (!storage.containsTicket(ticketId))
         {
             //Does not contain the ticket, send error
             return(new JObject(new JProperty("success", false),
                                new JProperty("failureReason", ComMessages.MethodErrorInvalidArguments)));
         }
         else
         {
             //return retrieved ticket
             bool   success;
             Ticket ticket = storage.getTicket(ticketId, out success);
             if (success)
             {
                 JObject obj = JObject.FromObject(ticket);
                 obj.Add("success", true);
                 obj.Add("failureReason", null);
                 return(obj);
             }
             else
             {
                 return(new JObject(new JProperty("success", false),
                                    new JProperty("failureReason", "Ticket is not in the system")));
             }
         }
     }
     catch (Exception e) {
         return(new JObject(new JProperty("success", false),
                            new JProperty("failureReason", ComMessages.MethodErrorInvalidArguments)));
     }
 }
示例#2
0
        public JObject run(JObject args)
        {
            //"returns" : {
            //"exists" : boolean,
            //Will be NULL
            //"success" : boolean,
            //"failureReason" : String
            int ticketId;

            try {
                ticketId = args.Value <int>("id");
            }
            catch {
                return(new JObject(new JProperty("exists", false),
                                   new JProperty("success", false),
                                   new JProperty("failureReason", "Method contained invalid arguments")));
            }
            if (storage.containsTicket(ticketId))
            {
                return(new JObject(new JProperty("exists", true),
                                   new JProperty("success", true),
                                   new JProperty("failureReason", null)));
            }
            else
            {
                return(new JObject(new JProperty("exists", false),
                                   new JProperty("success", true),
                                   new JProperty("failureReason", null)));
            }
        }
示例#3
0
 public string getTicketLocation(int ticketId)
 {
     if (storage.containsTicket(ticketId))
     {
         bool          success;
         StoredDetails details = storage.getStoredDetails(ticketId, out success);
         return(storage.getAbsoluteFileLocation(details.ticketLocation));
     }
     return(null);
 }