예제 #1
0
        /// <summary>
        /// Submits a ticket to the system
        /// </summary>
        /// <param name="category">The category of the ticket</param>
        /// <param name="description">The description inside the ticket</param>
        /// <returns>Whether the ticket was saved or not</returns>
        public async Task <bool> SubmitTicketAsync(Constants.TicketCategories category, string description)
        {
            TicketRecord ticketRecord = new TicketRecord(TimeUtilityService.CurrentUnixTime(),
                                                         category.ToString(),
                                                         Constants.TicketStatuses.Unresolved.ToString(),
                                                         Constants.TicketFlagColors.None.ToString(),
                                                         description);
            await ticketDAO.CreateAsync(ticketRecord);

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Updates a ticket's category
        /// </summary>
        /// <param name="ticketID">The id of the ticket</param>
        /// <param name="newCategory">The new ticket category to use</param>
        /// <returns>Whether the ticket category succesfully changed or not</returns>
        public async Task <bool> UpdateTicketCategoryAsync(long ticketID, Constants.TicketCategories newCategory)
        {
            // Make sure the ticket exists first
            bool ticketExists = await ticketDAO.CheckTicketExistenceAsync(ticketID);

            if (!ticketExists)
            {
                throw new ArgumentException(Constants.TicketUpdateNotExists);
            }

            // Update the ticket
            TicketRecord ticketRecord = new TicketRecord(ticketID, newCategory.ToString(), null, null, null);
            await ticketDAO.UpdateAsync(ticketRecord);

            return(true);
        }