public void UpdateTicket(Entities.Ticket ticket) { var ticketRepositary = unitOfWork.GetRepository <Entities.Ticket>(); ticketRepositary.Update(ticket); unitOfWork.SaveChanges(); }
public static Model.Ticket FromCore(this Entities.Ticket ticket) { Model.Ticket result = null; if (ticket != null) { result = new Model.Ticket() { DateOfAccident = ticket.DateOfAccident, Description = ticket.Description, Priority = (int)ticket.Priority, Id = ticket.Id }; if (ticket.Images != null) { var images = new List <Model.Image>(); foreach (var image in ticket.Images) { images.Add(image.FromCore()); } result.Images = images; } } return(result); }
public static Entities.Ticket ToCore(this Model.Ticket ticket) { Entities.Ticket result = null; if (ticket != null) { result = new Entities.Ticket() { DateOfAccident = ticket.DateOfAccident, Description = ticket.Description, Priority = (Entities.PriorityEnum)ticket.Priority, Id = ticket.Id }; if (ticket.Images != null) { foreach (var image in ticket.Images) { result.Images.Add(image.ToCore()); } } } return(result); }
private void UpdateTicketWithImageAndPriority(Entities.Ticket ticket, Entities.Image image) { var existingTicket = _repository.GetBy(ticket.Id); existingTicket.AddImage(image); _repository.UpdatePriority(existingTicket); _repository.AttachImage(ticket, image); }
private void UpdateTicketWithImageAndPriority(Entities.Ticket ticket, Entities.Video video) { var existingTicket = _repository.GetBy(ticket.Id); existingTicket.AddVideo(video); _repository.UpdatePriority(existingTicket); _repository.AttachVideo(ticket, video); }
public Guid ForUser(Entities.User user, Entities.Ticket ticket) { // 1. Validate this.Validate(user); // 2. Save var ticketId = this._repository.Create(ticket); return(ticketId); }
public Entities.Ticket GetBy(Guid id) { Entities.Ticket result = null; using (var context = new TicketingContext()) { var dbEntity = context.Tickets.Include(t => t.Images).FirstOrDefault(t => t.Id == id); if (dbEntity != null) { result = dbEntity.ToCore(); } } return(result); }
public void ForTicket(Entities.Ticket ticket, Entities.Image image) { // 1. validate image - it pictures a damaged vehicle Validate(image); // 2. analyse the image - use AI tool to estimate damage and set priority AssessDamageAndPriority(image); // 3. crop and compress the image CropAndCompress(image); // 4. update ticket UpdateTicketWithImageAndPriority(ticket, image); }
public Guid AddTicket(Entities.Ticket ticket) { // var unitOfWork = UnitWorkFactory.GetUnitOfWork(); var ticketRepositary = unitOfWork.GetRepository <Entities.Ticket>(); ticket.ID = Guid.NewGuid(); ticket.TicketConversations.ElementAt(0).ID = Guid.NewGuid(); ticket.TicketConversations.ElementAt(0).LastUpdatedUserID = ticket.LastUpdatedUserID; ticket.Priority = "NORMAL"; ticket.Status = "OPEN"; ticketRepositary.Add(ticket); unitOfWork.SaveChanges(); return(ticket.ID); }
public Guid Create(Entities.Ticket ticket) { var result = Guid.Empty; using (var context = new TicketingContext()) { var dbEntity = ticket.FromCore(); context.Tickets.Add(dbEntity); context.SaveChanges(); result = dbEntity.Id; } return(result); }
public static List <Entities.Ticket> ListarTicket() { var lista = new List <Entities.Ticket>(); string query = ""; using (var cn = new SqlConnection(conexion.Cadena)) { query = "SELECT wf.[Name] as 'WorkFlow', (SELECT [Name] FROM [EES.BBVA.2018v1].[dbo].[States] WHERE [Id] = (SELECT [StateId] FROM [EES.BBVA.2018v1].[dbo].[StateActions] WHERE [Id] = (SELECT [StateActionId] FROM [EES.BBVA.2018v1].[dbo].[TicketHistories] WHERE [Id] = (SELECT MAX(th.[Id]) FROM [EES.BBVA.2018v1].[dbo].[TicketHistories] th WHERE th.[TicketId] = tk.[Id] AND th.[HistoryType] = 2)))) as 'Ultimo Estado'," + "'Tarea: ' as 'Ticket',tk.[Id],'Exped: ' as 'Exp',tk.[Description],st.[Name],tk.[StateId],tk.[ParentId],tk.[UserId],tk.[RobotVirtualMachineId]" + ",case when((tk.StateId = 1061) or(tk.StateId = 1135)) then concat(datediff(SECOND, dateadd(hour, -5, tk.[CreationDate]), dateadd(hour, -5, tk.[LastModified])) / 60, ':', datediff(SECOND, dateadd(hour, -5, tk.[LastModified]), dateadd(hour, -5, tk.[LastModified])) % 60) Else concat(datediff(SECOND, dateadd(hour, -5, tk.[CreationDate]), getdate()) / 60, ':', datediff(SECOND, dateadd(hour, -5, tk.[CreationDate]), getdate()) % 60) End as 'Inicio' " + ",concat(datediff(SECOND, dateadd(hour, -5, tk.[LastModified]), getdate()) / 60, ':', datediff(SECOND, dateadd(hour, -5, tk.[LastModified]), getdate()) % 60) as 'Ejecucion'" + ",tv.[Value] as 'Error',convert(varchar(20),dateadd(hour,-5, tk.[CreationDate]), 100) as 'CreationDate',convert(varchar(20),dateadd(hour,-5, tk.[LastModified]), 100) as 'LastModified',tk.[Priority] FROM [EES.BBVA.2018v1].[dbo].[Tickets] tk INNER JOIN [EES.BBVA.2018v1].[dbo].[States] st on st.[Id] = tk.[StateId] INNER JOIN [EES.BBVA.2018v1].[dbo].[Workflows] wf on wf.[Id] = st.[WorkflowId] LEFT JOIN [EES.BBVA.2018v1].[dbo].[TicketValues] tv on (tv.[TicketId] = tk.[Id] AND tv.[FieldId] = 34) " + "WHERE wf.[Id] in (9) " + "AND CAST(tk.[CreationDate] AS DATE) >= CAST(GETDATE()-3 AS DATE) " + "ORDER BY tk.id desc "; using (var cmd = new SqlCommand(query, cn)) { cn.Open(); using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { var oTicket = new Entities.Ticket(); oTicket.flujo = Convert.ToString(dr[dr.GetOrdinal("WorkFlow")]); oTicket.ultimo_estado = Convert.ToString(dr[dr.GetOrdinal("Ultimo Estado")]); oTicket.ticket = Convert.ToString(dr[dr.GetOrdinal("Ticket")]); oTicket.id = Convert.ToString(dr[dr.GetOrdinal("Id")]); oTicket.exp = Convert.ToString(dr[dr.GetOrdinal("Exp")]); oTicket.descripcion = Convert.ToString(dr[dr.GetOrdinal("Description")]); oTicket.estado = Convert.ToString(dr[dr.GetOrdinal("Name")]); oTicket.stateid = Convert.ToString(dr[dr.GetOrdinal("StateId")]); oTicket.parentid = Convert.ToString(dr[dr.GetOrdinal("ParentId")]); oTicket.userid = Convert.ToString(dr[dr.GetOrdinal("UserId")]); oTicket.guid = Convert.ToString(dr[dr.GetOrdinal("RobotVirtualMachineId")]); oTicket.inicio = Convert.ToString(dr[dr.GetOrdinal("Inicio")]); oTicket.ejecucion = Convert.ToString(dr[dr.GetOrdinal("Ejecucion")]); oTicket.mensaje = Convert.ToString(dr[dr.GetOrdinal("Error")]); oTicket.creacion = Convert.ToString(dr[dr.GetOrdinal("CreationDate")]); oTicket.modificacion = Convert.ToString(dr[dr.GetOrdinal("LastModified")]); oTicket.prioridad = Convert.ToString(dr[dr.GetOrdinal("Priority")]); lista.Add(oTicket); } } return(lista); } } }
public Guid AttachVideo(Entities.Ticket ticket, Entities.Video video) { var result = Guid.Empty; using (var context = new TicketingContext()) { var dbEntity = video.FromCore(); dbEntity.TicketId = ticket.Id; context.Videos.Add(dbEntity); context.SaveChanges(); result = dbEntity.Id; video.Id = dbEntity.Id; } _storage.StoreVideo(video); return(result); }
public Guid AttachImage(Entities.Ticket ticket, Entities.Image image) { var result = Guid.Empty; using (var context = new TicketingContext()) { var dbEntity = image.FromCore(); dbEntity.TicketId = ticket.Id; context.Images.Add(dbEntity); context.SaveChanges(); result = dbEntity.Id; image.Id = dbEntity.Id; } _storage.StoreImage(image); return(result); }
#pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { BeginContext(30, 2, true); WriteLiteral("\r\n"); EndContext(); #line 3 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" ViewData["Title"] = "Details"; Layout = "~/Views/Shared/_Master.cshtml"; CRM.Entities.Ticket ticket = new Entities.Ticket(); #line default #line hidden BeginContext(179, 56, true); WriteLiteral("\r\n<h2>Details</h2>\r\n\r\n<div>\r\n <h4>Customer</h4>\r\n "); EndContext(); BeginContext(235, 101, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "ede75b43847b40cbbbec4842a98b819c", async() => { BeginContext(315, 17, true); WriteLiteral("Create New Ticket"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_0.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_1.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_1); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 13 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" WriteLiteral(Model.idCustomer); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(336, 72, true); WriteLiteral("\r\n <hr />\r\n <dl class=\"dl-horizontal\">\r\n <dt>\r\n "); EndContext(); BeginContext(409, 46, false); #line 17 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayNameFor(model => model.nmCustomer)); #line default #line hidden EndContext(); BeginContext(455, 43, true); WriteLiteral("\r\n </dt>\r\n <dd>\r\n "); EndContext(); BeginContext(499, 42, false); #line 20 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayFor(model => model.nmCustomer)); #line default #line hidden EndContext(); BeginContext(541, 43, true); WriteLiteral("\r\n </dd>\r\n <dt>\r\n "); EndContext(); BeginContext(585, 43, false); #line 23 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayNameFor(model => model.nuPhone)); #line default #line hidden EndContext(); BeginContext(628, 43, true); WriteLiteral("\r\n </dt>\r\n <dd>\r\n "); EndContext(); BeginContext(672, 39, false); #line 26 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayFor(model => model.nuPhone)); #line default #line hidden EndContext(); BeginContext(711, 43, true); WriteLiteral("\r\n </dd>\r\n <dt>\r\n "); EndContext(); BeginContext(755, 43, false); #line 29 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayNameFor(model => model.adEmail)); #line default #line hidden EndContext(); BeginContext(798, 43, true); WriteLiteral("\r\n </dt>\r\n <dd>\r\n "); EndContext(); BeginContext(842, 39, false); #line 32 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayFor(model => model.adEmail)); #line default #line hidden EndContext(); BeginContext(881, 43, true); WriteLiteral("\r\n </dd>\r\n <dt>\r\n "); EndContext(); BeginContext(925, 46, false); #line 35 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayNameFor(model => model.nuCustomer)); #line default #line hidden EndContext(); BeginContext(971, 43, true); WriteLiteral("\r\n </dt>\r\n <dd>\r\n "); EndContext(); BeginContext(1015, 42, false); #line 38 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayFor(model => model.nuCustomer)); #line default #line hidden EndContext(); BeginContext(1057, 43, true); WriteLiteral("\r\n </dd>\r\n <dt>\r\n "); EndContext(); BeginContext(1101, 43, false); #line 41 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayNameFor(model => model.Address)); #line default #line hidden EndContext(); BeginContext(1144, 43, true); WriteLiteral("\r\n </dt>\r\n <dd>\r\n "); EndContext(); BeginContext(1188, 49, false); #line 44 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" Write(Html.DisplayFor(model => model.Address.nuAddress)); #line default #line hidden EndContext(); BeginContext(1237, 25, true); WriteLiteral("\r\n </dd>\r\n "); EndContext(); BeginContext(1262, 62, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "4436be307cfc4b0bb8603443c1858b12", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_2.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_2); #line 46 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.Address); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1324, 21, true); WriteLiteral("\r\n </dl>\r\n</div>\r\n"); EndContext(); BeginContext(1345, 59, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("partial", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "b9ae79ad86fd461cac1d30841dff5ae0", async() => { } ); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.PartialTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.Name = (string)__tagHelperAttribute_3.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3); #line 49 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.tickets); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNetCore_Mvc_TagHelpers_PartialTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1404, 13, true); WriteLiteral("\r\n<div>\r\n "); EndContext(); BeginContext(1417, 62, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "908ef9661b3c479f9400f851e7da1c07", async() => { BeginContext(1471, 4, true); WriteLiteral("Edit"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_4.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4); if (__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues == null) { throw new InvalidOperationException(InvalidTagHelperIndexerAssignment("asp-route-id", "Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper", "RouteValues")); } BeginWriteTagHelperAttribute(); #line 51 "C:\Users\ishiva\Desktop\CRM\Source\CRM\CRM\Views\Customer\Details.cshtml" WriteLiteral(Model.idCustomer); #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"] = __tagHelperStringValueBuffer; __tagHelperExecutionContext.AddTagHelperAttribute("asp-route-id", __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.RouteValues["id"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1479, 8, true); WriteLiteral(" |\r\n "); EndContext(); BeginContext(1487, 38, false); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "898b32744970479fb7ed3b9a68727a65", async() => { BeginContext(1509, 12, true); WriteLiteral("Back to List"); EndContext(); } ); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper); __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_5.Value; __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { await __tagHelperExecutionContext.SetOutputContentAsync(); } Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); EndContext(); BeginContext(1525, 10, true); WriteLiteral("\r\n</div>\r\n"); EndContext(); }