public static SupportTicket ToDataModel(this C.SupportTicket model) { if (model == null) return null; var data = new SupportTicket() { FirstName = model.FirstName, LastName = model.LastName, CreatedDate = DateTime.Today, CreatedUserID = model.CreatedByUserID, IssueCategory = model.SupportCategory.ToString(), IssueText = model.IssueText, EmailAddress = model.EmailAddress, ContactPhone = model.ContactPhone }; return data; }
public IHttpActionResult GetSupportTicket([FromUri] GetSupportTicketRequest getSupportTicketRequest) { var responses = new Responses(); try { if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } if (getSupportTicketRequest == null) { getSupportTicketRequest = new GetSupportTicketRequest(); } if (getSupportTicketRequest.PageSize == null) { getSupportTicketRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); } var supportTicket = new SupportTicket() { SupportTicketId = getSupportTicketRequest.SupportTicketId, UserId = (getSupportTicketRequest.IsCurrentUser) ? Utility.UserId : (int?)null, IsForPostQuery = getSupportTicketRequest.IsForPostQuery, TopicId = getSupportTicketRequest.TopicId, SubTopicId = getSupportTicketRequest.SubTopicId, DepartmentId = getSupportTicketRequest.DepartmentId, SearchText = getSupportTicketRequest.SearchText, IsActive = getSupportTicketRequest.IsActive, PageNumber = getSupportTicketRequest.PageNumber, PageSize = Convert.ToInt32(getSupportTicketRequest.PageSize), IsPagingRequired = (getSupportTicketRequest.PageNumber != null) ? true : false, OrderBy = getSupportTicketRequest.OrderBy, OrderByDirection = getSupportTicketRequest.OrderByDirection }; var supportTickets = iSupportTicket.GetSupportTicket(supportTicket); var supportTicketList = new List <GetSupportTicketResponse>(); foreach (var supportTicketDetail in supportTickets) { supportTicketList.Add(new GetSupportTicketResponse() { SupportTicketId = supportTicketDetail.SupportTicketId, UserId = supportTicketDetail.UserId, DepartmentId = supportTicketDetail.DepartmentId, DepartmentName = supportTicketDetail.DepartmentName, TopicId = supportTicketDetail.TopicId, SubTopicId = supportTicketDetail.SubTopicId, TopicName = supportTicketDetail.TopicName, SubTopicName = supportTicketDetail.SubTopicName, QueryTitle = supportTicketDetail.QueryTitle, Query = supportTicketDetail.Query, IsActive = Convert.ToBoolean(supportTicketDetail.IsActive), CreatedBy = supportTicketDetail.CreatedBy, TotalPageCount = supportTicketDetail.TotalPageCount, TotalRecord = supportTicketDetail.TotalRecord }); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Post query retrieved successfully"; responses.Response = supportTicketList; } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while retrieving post query."; Utility.WriteLog("GetSupportTicket", getSupportTicketRequest, "Error while retrieving supportticket. (SupportTicketUserController)", ex.ToString()); } return(Ok(responses)); }
public bool InsertTicket(SupportTicket supportTicket) { return(_supportTicketDataRepository.InsertTicket(supportTicket)); }
public async Task CreateNewTicket(ISocketMessageChannel chan, IUser user, string omsg) { var ticket = new SupportTicket() { DMChannelID = chan.Id, UserID = user.Id, DMTyping = new TypingState() { Typing = false, TypingObject = null } }; var guilduser = client.GetGuild(Global.SwissGuildId).GetUser(user.Id); //create new ticket channel var ticketchan = await client.GetGuild(Global.SwissGuildId).CreateTextChannelAsync($"{user.Username}-{user.Discriminator}", x => x.CategoryId = Global.TicketCategoryID); var logs = ModDatabase.currentLogs.Users.Any(x => x.userId == user.Id) ? ModDatabase.currentLogs.Users.First(x => x.userId == user.Id) : null; var embed = new EmbedBuilder() { Title = $"**New support ticket from {user}**", Description = $"To view ticket snippets, do `!snippets` or `*snippets`", Author = new EmbedAuthorBuilder() { Name = user.ToString(), IconUrl = user.GetAvatarUrl() }, Fields = new List <EmbedFieldBuilder>() { { new EmbedFieldBuilder() { Name = "User", Value = $"Name: {user}\nNickname: {guilduser.Nickname}\nID: {guilduser.Id}\nMention: {guilduser.Mention}\nCreated at: {guilduser.CreatedAt.UtcDateTime.ToString("f")} UTC\nJoined at: {guilduser.JoinedAt.Value.ToString("f")} UTC", } }, { new EmbedFieldBuilder() { Name = "Roles", Value = string.Join("\n", guilduser.Roles.OrderBy(x => x.Position).Select(x => x.Mention)).Length > 1024 ? $"Unable to display all roles, listing top ten:\n{string.Join("\n", guilduser.Roles.OrderBy(x => x.Position).Select(x => x.Mention).Take(10))}" : string.Join("\n", guilduser.Roles.Select(x => x.Mention)) } }, }, Color = Color.DarkPurple }; if (logs == null) { embed.AddField("Modlogs", "None"); } else { string mlogs = "None <3"; foreach (var mlog in logs.Logs.OrderBy(x => x.Date).Reverse()) { if (mlogs == "None <3") { mlogs = ""; } mlogs += $"**{mlog.Action.ToString()}** on **{mlog.Date}**\n**Reason:** {mlog.Reason}\n**Moderator:** <@{mlog.ModeratorID}>\n\n"; } embed.AddField("Modlogs", mlogs.Length > 1024 ? $"Modlogs too long, listing top 5\n\n{string.Join("\n\n", mlogs.Split("\n\n").Take(5))}" : string.Join("\n\n", mlogs.Split("\n\n"))); } await ticketchan.SendMessageAsync("@here", false, embed.Build()); await ticketchan.SendMessageAsync($"**\nV----------------START-OF-TICKET----------------V**\n\n**[Ticketer] {user}** - " + omsg); ticket.TicketChannel = ticketchan.Id; CurrentTickets.Add(ticket); Global.SaveSupportTickets(); }
public IHttpActionResult AddSupportTicket(AddSupportTicketRequest addSupportTicketRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var supportTicket = new SupportTicket() { UserId = Utility.UserId, TopicId = addSupportTicketRequest.TopicId, SubTopicId = addSupportTicketRequest.SubTopicId, QueryTitle = addSupportTicketRequest.QueryTitle, DepartmentId = addSupportTicketRequest.DepartmentId, Query = addSupportTicketRequest.Query, CreatedBy = Utility.UserId }; int result = iSupportTicket.AddSupportTicket(supportTicket); if (result > 0) { bool isSentMail = false; if (addSupportTicketRequest.DepartmentId != null) { var supportTicketEmailHtmlCode = System.IO.File.ReadAllText(string.Format("{0}", HttpContext.Current.Server.MapPath(string.Format("{0}{1}", ConfigurationManager.AppSettings["EmailTemplatePath"], ConfigurationManager.AppSettings["SupportTicketForUserEmailTemplate"])))); var mainTemplateHtmlCode = System.IO.File.ReadAllText(string.Format("{0}", HttpContext.Current.Server.MapPath(string.Format("{0}{1}", ConfigurationManager.AppSettings["EmailTemplatePath"], ConfigurationManager.AppSettings["MainEmailTemplate"])))); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[SITEURL]", ConfigurationManager.AppSettings["SiteUrl"]); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[SITENAME]", ConfigurationManager.AppSettings["SiteName"]); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[PAGECONTENT]", supportTicketEmailHtmlCode); string subject = "Support Ticket | Demystify Fema"; string body = mainTemplateHtmlCode; string displayName = ConfigurationManager.AppSettings["SiteName"]; isSentMail = Utility.SendMail(ConfigurationManager.AppSettings["AdminEmailId"], string.Empty, string.Empty, subject, body, displayName, string.Empty, true); } else { var supportTicketEmailHtmlCode = System.IO.File.ReadAllText(string.Format("{0}", HttpContext.Current.Server.MapPath(string.Format("{0}{1}", ConfigurationManager.AppSettings["EmailTemplatePath"], ConfigurationManager.AppSettings["PostQueryForUserEmailTemplate"])))); var mainTemplateHtmlCode = System.IO.File.ReadAllText(string.Format("{0}", HttpContext.Current.Server.MapPath(string.Format("{0}{1}", ConfigurationManager.AppSettings["EmailTemplatePath"], ConfigurationManager.AppSettings["MainEmailTemplate"])))); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[SITEURL]", ConfigurationManager.AppSettings["SiteUrl"]); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[SITENAME]", ConfigurationManager.AppSettings["SiteName"]); mainTemplateHtmlCode = mainTemplateHtmlCode.Replace("[PAGECONTENT]", supportTicketEmailHtmlCode); string subject = "Post Query | Demystify Fema"; string body = mainTemplateHtmlCode; string displayName = ConfigurationManager.AppSettings["SiteName"]; isSentMail = Utility.SendMail(ConfigurationManager.AppSettings["AdminEmailId"], string.Empty, string.Empty, subject, body, displayName, string.Empty, true); } try { var objSupportTicket = new SupportTicket() { SupportTicketId = result, IsMailSentToAdmin = isSentMail, ModifiedBy = Utility.UserId }; iSupportTicket.UpdateSupportTicketMailSent(objSupportTicket); } catch (Exception ex) { Utility.WriteLog("AddSupportTicket", addSupportTicketRequest, "Error while update supportticket mailsent. (SupportTicketUserController)", ex.ToString()); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Post query added successfully."; } else { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding post query."; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding post query."; Utility.WriteLog("AddSupportTicket", addSupportTicketRequest, "Error while adding supportticket. (SupportTicketUserController)", ex.ToString()); } return(Ok(responses)); }
public void UpdateTicket(SupportTicket supportTicket) { this.context.SupportTickets.Update(supportTicket); }
public void CreateTicket(SupportTicket supportTicket) { this.context.Add(supportTicket); }
// // GET: /SupportTickets/Edit/2 public ActionResult Edit(int id) { SupportTicket supportTicket = supportTicketRepository.GetSupportTicket(id); return(View(supportTicket)); }
public ReporteTicketVo(SupportTicket supportTicket) { Empresa = supportTicket.Empresa != null ? supportTicket.Empresa.RazonSocial : CultureManager.GetLabel("TODOS"); Id = supportTicket.Id; Fecha = supportTicket.Fecha.ToDisplayDateTime(); Categoria = supportTicket.CategoriaObj != null ? supportTicket.CategoriaObj.Descripcion : string.Empty; Subcategoria = supportTicket.Subcategoria != null ? supportTicket.Subcategoria.Descripcion : string.Empty; Nivel = supportTicket.NivelObj != null ? supportTicket.NivelObj.Descripcion : string.Empty; var estadoActual = string.Empty; switch (supportTicket.CurrentState) { case 0: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_1_OPEN"); break; case 1: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_2_WORKING"); break; case 2: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_3_WAITING_USER"); break; case 3: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_4_SOLVED"); break; case 4: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_5_APPROVED"); break; case 5: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_6_REJECTED"); break; case 6: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_7_CLOSED"); break; case 7: estadoActual = CultureManager.GetLabel("SUPPORT_STATE_8_INVALID"); break; } EstadoActual = estadoActual; var tiempoTotal = new TimeSpan(0, 0, 0); var open = new TimeSpan(0, 0, 0); var working = new TimeSpan(0, 0, 0); var waitingUser = new TimeSpan(0, 0, 0); var solved = new TimeSpan(0, 0, 0); var approved = new TimeSpan(0, 0, 0); var rejected = new TimeSpan(0, 0, 0); var closed = new TimeSpan(0, 0, 0); var invalid = new TimeSpan(0, 0, 0); var estados = supportTicket.States.OfType <SupportTicketDetail>().OrderByDescending(d => d.Fecha); SupportTicketDetail last = null; foreach (var estado in estados) { var ts = GetTiempo(last, estado.Fecha, estado.SupportTicket.Empresa, estado.SupportTicket.Linea); switch (estado.Estado) { case 0: open = open.Add(ts); break; case 1: working = working.Add(ts); break; case 2: waitingUser = waitingUser.Add(ts); break; case 3: solved = solved.Add(ts); break; case 4: approved = approved.Add(ts); break; case 5: rejected = rejected.Add(ts); break; case 6: closed = closed.Add(ts); break; case 7: invalid = invalid.Add(ts); break; } tiempoTotal = tiempoTotal.Add(ts); last = estado; } Open = GetString(open); Working = GetString(working); WaitingUser = GetString(waitingUser); Solved = GetString(solved); Approved = GetString(approved); Rejected = GetString(rejected); Closed = GetString(closed); Invalid = GetString(invalid); TiempoTotal = GetString(tiempoTotal); }
public ServerMessage method_21(SupportTicket class111_0, RoomData class27_0, double double_0) { ServerMessage result; using (DatabaseClient @class = Essential.GetDatabase().GetClient()) { DataTable dataTable = @class.ReadDataTable(string.Concat(new object[] { "SELECT user_id,user_name,timestamp,hour,minute,message FROM chatlogs WHERE room_id = '", class27_0.Id, "' AND timestamp >= '", double_0 - 300.0, "' AND timestamp < UNIX_TIMESTAMP() ORDER BY timestamp DESC LIMIT 100" })); ServerMessage Message = new ServerMessage(Outgoing.RoomChatlog); // Updated Message.AppendBoolean(class27_0.IsPublicRoom); Message.AppendInt32((int)class27_0.Id); Message.AppendString(class27_0.Name); if (dataTable != null) { Message.AppendInt32(dataTable.Rows.Count); IEnumerator enumerator = dataTable.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow dataRow = (DataRow)enumerator.Current; string hour = (int)dataRow["hour"].ToString().Length > 1 ? "" + (int)dataRow["hour"] : "0" + (int)dataRow["hour"]; string minute = (int)dataRow["minute"].ToString().Length > 1 ? "" + (int)dataRow["minute"] : "0" + (int)dataRow["minute"]; Message.AppendInt32((int)(double)dataRow["timestamp"]); Message.AppendUInt((uint)dataRow["user_id"]); Message.AppendString((string)dataRow["user_name"]); Message.AppendString((string)dataRow["message"]); Message.AppendString(hour + ":" + minute); } goto IL_186; } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } Message.AppendInt32(0); IL_186: result = Message; } return result; }
public void method_2(DatabaseClient class6_0) { Logging.Write("Loading Current Help Tickets.."); DataTable dataTable = class6_0.ReadDataTable("SELECT Id,score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp FROM moderation_tickets WHERE status = 'open' OR status = 'picked'"); if (dataTable != null) { foreach (DataRow dataRow in dataTable.Rows) { SupportTicket @class = new SupportTicket((uint)dataRow["Id"], (int)dataRow["score"], (int)dataRow["type"], (uint)dataRow["sender_id"], (uint)dataRow["reported_id"], (string)dataRow["message"], (uint)dataRow["room_id"], (string)dataRow["room_name"], (double)dataRow["timestamp"], (uint)dataRow["moderator_id"]); if (dataRow["status"].ToString().ToLower() == "picked") { @class.method_0((uint)dataRow["moderator_id"], false); } this.Tickets.Add(@class); } Logging.WriteLine("completed!", ConsoleColor.Green); } }
public void method_11(SupportTicket class111_0) { Essential.GetGame().GetClientManager().SendToClientsWithFuse(class111_0.Serialize(), "acc_supporttool"); }
public void method_3(GameClient Session, int int_0, uint uint_0, string string_0) { if (Session.GetHabbo().CurrentRoomId > 0u) { RoomData @class = Essential.GetGame().GetRoomManager().method_11(Session.GetHabbo().CurrentRoomId); uint uint_ = 0u; using (DatabaseClient class2 = Essential.GetDatabase().GetClient()) { class2.AddParamWithValue("message", string_0); class2.AddParamWithValue("name", @class.Name); class2.ExecuteQuery(string.Concat(new object[] { "INSERT INTO moderation_tickets (score,type,status,sender_id,reported_id,moderator_id,message,room_id,room_name,timestamp) VALUES (1,'", int_0, "','open','", Session.GetHabbo().Id, "','", uint_0, "','0',@message,'", @class.Id, "',@name,UNIX_TIMESTAMP())" })); class2.ExecuteQuery("UPDATE user_info SET cfhs = cfhs + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1"); uint_ = (uint)class2.ReadDataRow("SELECT Id FROM moderation_tickets WHERE sender_id = '" + Session.GetHabbo().Id + "' ORDER BY Id DESC LIMIT 1")[0]; } SupportTicket class3 = new SupportTicket(uint_, 1, int_0, Session.GetHabbo().Id, uint_0, string_0, @class.Id, @class.Name, Essential.GetUnixTimestamp(), 0u); this.Tickets.Add(class3); this.method_11(class3); } }
// Returns workitem URL. public static string CreateSupportTicket(SupportTicket ticket) { VssConnection connection = new VssConnection(new Uri(collectionUri), new VssBasicCredential("", pat)); WorkItemTrackingHttpClient witClient = connection.GetClient <WorkItemTrackingHttpClient>(); JsonPatchDocument patchDocument = new JsonPatchDocument(); //add fields and their values to your patch document patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.Title", Value = "Support ticket by user: "******"/fields/System.Description", Value = ticket.Description } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/agile2.Area", Value = ticket.AreaOfProblem } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/agile2.Category", Value = ticket.CategoryOfProblem } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/agile2.UserAccount", Value = ticket.AccountUrl } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/agile2.Useremail", Value = ticket.EmailAddress } ); try { WorkItem result = witClient.CreateWorkItemAsync(patchDocument, project, "SupportTicket").Result; return(collectionUri + project + "/_workitems/edit/" + result.Id); } catch (AggregateException ex) { Console.WriteLine("Error creating the support ticket: {0}", ex.InnerException.Message); return(null); } }
public abstract void HandleRequest(SupportTicket ticket);
// constructor for MessageSupportTicket public MessageSupportTicket(DateTime date, string reply, Member member, Staff staff, SupportTicket ticket) { this.date = date; this.reply = reply; this.member = member; this.staff = staff; this.ticket = ticket; }