Esempio n. 1
0
 public DAO.Ticket createTicket(DAO.Ticket ticket)
 {
     try
     {
         using (var context = new Node1Context())
         {
             var ticketModel = new EntityNode1.Ticket()
             {
                 AccountId          = ticket.AccountId,
                 CreateDate         = ticket.CreateDate,
                 CustomerName       = ticket.CustomerName,
                 Id                 = ticket.Id,
                 ProblemDescription = ticket.ProblemDescription
             };
             context.Ticket.Add(ticketModel);
             context.SaveChanges();
             ticket.Id = ticketModel.Id;
             return(ticket);
         };
     }
     catch (Exception e)
     {
         Console.WriteLine("Ticket not saved");
         throw;
     }
 }
Esempio n. 2
0
 public Block(int index, string previousHash, DAO.Ticket ticket, string hash)
 {
     this.Index        = index;
     this.PreviousHash = previousHash;
     this.Ticket       = ticket;
     this.Hash         = hash;
 }
Esempio n. 3
0
 public Block(string previousHash, DAO.Ticket ticket)
 {
     Index        = 0;
     PreviousHash = previousHash;
     Ticket       = ticket;
     Hash         = CalculateHash();
 }
Esempio n. 4
0
 public DAO.Ticket getTicket(int id)
 {
     try
     {
         using (var context = new Node1Context())
         {
             var ticketModel = context.Ticket.Where(x => x.Id == id).FirstOrDefault();
             var daoTicket   = new DAO.Ticket(ticketModel.Id, ticketModel.CustomerName, ticketModel.AccountId.Value, ticketModel.CreateDate.Value, ticketModel.ProblemDescription);
             return(daoTicket);
         };
     }
     catch (Exception e)
     {
         Console.WriteLine("Couldn't load ticket");
         throw;
     }
 }
Esempio n. 5
0
 public Blockchain.Block getBlock(int id)
 {
     try
     {
         using (var context = new Node1Context())
         {
             var blockModel  = context.Block.Where(x => x.Id == id).FirstOrDefault();
             var ticketModel = getTicket(blockModel.IdTicket.Value);
             var daoTicket   = new DAO.Ticket(ticketModel.Id, ticketModel.CustomerName, ticketModel.AccountId, ticketModel.CreateDate, ticketModel.ProblemDescription);
             var block       = new Blockchain.Block(blockModel.Id, blockModel.PreviousHash, daoTicket, blockModel.Hash);
             return(block);
         };
     }
     catch (Exception e)
     {
         Console.WriteLine("Couldn't load ticket");
         throw;
     }
 }
Esempio n. 6
0
 //Updates the id of the user who entered the incident.
 public void UpdateTicketUser(Ticket newTicket)
 {
     UpdateDocument(collectionName, "ticket_id", newTicket.Id, "user_id", newTicket.ReportedByUser.id);
 }
Esempio n. 7
0
 public void UpdateTicket(Ticket newTicket)
 {
     UpdateDocument(collectionName, "ticket_id", newTicket.Id, "status", newTicket.GetStatus());
 }
Esempio n. 8
0
 public void AddTicket(Ticket ticket)
 {
     CreateDocument(collectionName, CreateTicketDocument(ticket));
 }