Exemplo n.º 1
0
        public IHttpActionResult Post(Dto.Ticket ticket)
        {
            Dmn.Ticket newTicket = new Dmn.Ticket(ticket.ClientId, ticket.Title, ticket.Description, ticket.TicketType);

            Context.Tickets.Add(newTicket);
            Context.SaveChanges();
            return Created(this.Request.RequestUri.AbsolutePath + "/" + ticket.Id, TicketConverter.ToDto(newTicket));
        }
        public static Dto.Ticket PostTicket(
            Dmn.Priority prio,
            string devnotes,
            string name,
            string email,
            string phoneNumber,
            string message,
            string twitterHandle,
            string facebookName,
            string contactMethod,
            string url,
            string website,
            string webpage,
            List<Dto.Developer> devs,
            string teamName,
            int teamId, 
            bool isBroken, 
            string featureName)
        {
            List<Dmn.Developer> dmnDevs = new List<Domain.Developer>();

            foreach (Dto.Developer dev in devs)
            {
                dmnDevs.Add(new Dmn.Developer(dev.Name, dev.PhoneNumber, dev.Email));
            }
            Dmn.WebLocation location = new Dmn.WebLocation(url, website, webpage);
            Dmn.DeveloperTeam team = new Dmn.DeveloperTeam(teamId, dmnDevs, teamName);
            Dmn.TicketInformation info = new Dmn.TicketInformation(prio, devnotes);
            Dmn.Customer customer = new Dmn.Customer(name, email, phoneNumber, message, twitterHandle, facebookName, contactMethod);
            Dmn.Feature feature = new Dmn.Feature(location, team, isBroken, featureName);

            Dmn.Ticket ticket = new Dmn.Ticket(info, customer, feature);
            Dmn.DummyDatabase.Tickets.Add(ticket);
            return TicketConverter.ToDto(ticket);
        }
Exemplo n.º 3
0
 public static void Insert(Ticket Ticket)
 {
     DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO Tickets (Title, Content, CategoryId, CreatorId, TicketPriorityId, TicketStatusId, DateCreated, LastEdited) VALUES ('{0}', '{1}', {2}, {3}, {4}, {5}, '{6}', '{7}');", Ticket.Title, Ticket.Content, Ticket.CategoryId, Ticket.CreatorId, (int)Ticket.Priority, (int)Ticket.Status, Ticket.DateCreated, Ticket.LastEdited));
     db.ExecuteNonQuery(cmd);
 }
Exemplo n.º 4
0
 public static void Update(Ticket Ticket)
 {
     DbCommand cmd = db.GetStoredProcCommand("dbo.UpdateTicketCategory");
     db.AddInParameter(cmd, "@Title", DbType.String, Ticket.Title);
     db.AddInParameter(cmd, "@CategoryId", DbType.Int32, Ticket.CategoryId);
     db.AddInParameter(cmd, "@TicketPriorityId", DbType.Int32, Ticket.Priority);
     db.AddInParameter(cmd, "@TicketStatusId", DbType.Int32, Ticket.Status);
     db.AddInParameter(cmd, "@LastEdited", DbType.DateTime2, Ticket.LastEdited);
     db.AddInParameter(cmd, "@TicketId", DbType.Int32, Ticket.Id);
     db.ExecuteNonQuery(cmd);
 }
Exemplo n.º 5
0
 public AvailableCounters SetServingTicketFor(CounterName counterName, Ticket t)
 {
     Counters.MaybeEntityWith(counterName).Value.SetServingTicket(t);
     return(this);
 }