public void Delete(bool updateToDB) { this.Status = SupportTicketStatus.Deleted; if (updateToDB) { using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("ticketId", this.ID); dbClient.ExecuteQuery("UPDATE moderation_tickets SET status = 'deleted' WHERE id = @ticketId LIMIT 1"); } } }
public void Close(SupportTicketStatus closeStatus, bool updateToDB) { this.Status = closeStatus; if (updateToDB) { using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("ticketId", this.ID); dbClient.AddParamWithValue("status", closeStatus == SupportTicketStatus.Resolved ? "resolved" : closeStatus == SupportTicketStatus.Abusive ? "abusive" : "invalid"); dbClient.ExecuteQuery("UPDATE moderation_tickets SET status = @status WHERE id = @ticketId LIMIT 1"); } } }
public static void SeedSupportTicketStatuses(ApplicationDbContext context) { foreach (var status in Enum.GetValues(typeof(SupportTicketStatusesEnum))) { if (context.SupportTicketStatuses.Where(sts => sts.Name == status.ToString()).FirstOrDefault() == null) { var ticketStatus = new SupportTicketStatus() { Name = status.ToString() }; context.Add(ticketStatus); } } }
public async Task <ActionResult> AdminUpdateTicketStatus(int ticketId, SupportTicketStatus status) { var result = await SupportWriter.UpdateSupportTicketStatus(User.Id(), new UpdateSupportTicketStatusModel { TicketId = ticketId, Status = status }); if (result.HasErrors) { return(ViewMessage(ViewMessageModel.Error("Error", result.FlattenErrors))); } return(RedirectToAction("AdminViewTicket", new { ticketId = ticketId })); }
public void Pick(GameClient picker, bool updateToDB) { this.Status = SupportTicketStatus.Picked; this.PickerID = picker.GetHabbo().ID; this.PickerUsername = picker.GetHabbo().Username; if (updateToDB) { using (DatabaseClient dbClient = Skylight.GetDatabaseManager().GetClient()) { dbClient.AddParamWithValue("ticketId", this.ID); dbClient.AddParamWithValue("pickerId", this.PickerID); dbClient.AddParamWithValue("pickerUsername", this.PickerUsername); dbClient.ExecuteQuery("UPDATE moderation_tickets SET status = 'picked', picker_id = @pickerId WHERE id = @ticketId LIMIT 1"); } } }
public SupportTicket(uint id, int score, int type, SupportTicketStatus status, uint senderId, uint reportedId, uint pickerId, string message, uint roomId, string roomName, double timestamp) { this.ID = id; this.Score = score; this.Type = type; this.Status = status; this.SenderID = senderId; this.ReportedID = reportedId; this.PickerID = pickerId; this.Message = message; this.RoomID = roomId; this.RoomName = roomName; this.Timestmap = timestamp; this.SenderUsername = Skylight.GetGame().GetGameClientManager().GetUsernameByID(this.SenderID); this.ReportedUsername = Skylight.GetGame().GetGameClientManager().GetUsernameByID(this.ReportedID); this.PickerUsername = Skylight.GetGame().GetGameClientManager().GetUsernameByID(this.PickerID); }
public SupportTicket(int ticketId, string reportedUsername, string senderUsername, string message, string moderatorUsername, int moderatorId, int reportedId, int roomId, string roomName, int score, int senderId, SupportTicketStatus ticketStatus, int type, double timestamp, List <string> reportedChatMessages) { _ticketId = ticketId; _reportedUsername = reportedUsername; _senderUsername = senderUsername; _message = message; _moderatorUsername = moderatorUsername; _moderatorId = moderatorId; _reportedId = reportedId; _roomId = roomId; _roomName = roomName; _score = score; _senderId = senderId; _ticketStatus = ticketStatus; _type = type; _timestamp = timestamp; _reportedChatMessages = reportedChatMessages; }
public void PickTicket(int moderatorId, bool updateDatabase) { _ticketStatus = SupportTicketStatus.Picked; _moderatorId = moderatorId; PlayerData moderatorPlayerData; if (PlayerLoader.TryGetDataById(moderatorId, out moderatorPlayerData)) { _moderatorUsername = moderatorPlayerData.Username; } if (updateDatabase) { using (var mysqlConnection = Sahara.GetServer().GetMySql().GetConnection()) { mysqlConnection.OpenConnection(); mysqlConnection.RunQuery("UPDATE `moderation_tickets` SET `status` = 'picked', moderator_id = " + _moderatorId + ", timestamp = '" + UnixTimestampGenerator.GetNow() + "' WHERE id = " + _ticketId + ""); mysqlConnection.CloseConnection(); } } moderatorPlayerData = null; }
public void LoadSupportTickets(DatabaseClient dbClient) { Logging.Write("Loading support tickets... "); DataTable tickets = dbClient.ReadDataTable("SELECT * FROM moderation_tickets"); if (tickets != null && tickets.Rows.Count > 0) { foreach (DataRow dataRow in tickets.Rows) { uint id = (uint)dataRow["id"]; string sStatus = (string)dataRow["status"]; SupportTicketStatus status = SupportTicketStatus.Open; switch (sStatus) { case "open": { status = SupportTicketStatus.Open; break; } case "picked": { status = SupportTicketStatus.Picked; break; } case "resolved": { status = SupportTicketStatus.Resolved; break; } case "abusive": { status = SupportTicketStatus.Abusive; break; } case "invalid": { status = SupportTicketStatus.Invalid; break; } case "deleted": { status = SupportTicketStatus.Deleted; break; } default: { status = SupportTicketStatus.Open; break; } } this.SupportTickets.Add(id, new SupportTicket(id, (int)dataRow["score"], (int)dataRow["type"], status, (uint)dataRow["sender_id"], (uint)dataRow["reported_id"], (uint)dataRow["picker_id"], (string)dataRow["message"], (uint)dataRow["room_id"], (string)dataRow["room_name"], (double)dataRow["timestamp"])); } } Logging.WriteLine("completed!", ConsoleColor.Green); }
public async Task <IWriterResult> UpdateTicketStatus(string adminUserId, int ticketId, SupportTicketStatus status) { using (var context = DataContextFactory.CreateContext()) { var ticket = await context.SupportTicket.Where(t => t.Id == ticketId).FirstNoLockAsync(); var oldStatus = ticket.Status; ticket.Status = status; ticket.LastUpdate = DateTime.UtcNow; context.LogActivity(adminUserId, $"Updated ticket status from {oldStatus} to {status}"); await context.SaveChangesAsync().ConfigureAwait(false); return(new WriterResult(true, $"Ticket - {ticket.Title} status change to {status}")); } }
public void DeleteTicketStatus(SupportTicketStatus supportTicketStatus) { this.context.Remove(supportTicketStatus); }
public void UpdateTicketStatus(SupportTicketStatus supportTicketStatus) { this.context.Update(supportTicketStatus); }
public void CreateTicketStatus(SupportTicketStatus supportTicketStatus) { this.context.Add(supportTicketStatus); }