コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (TicketId != null)
         {
             hashCode = hashCode * 59 + TicketId.GetHashCode();
         }
         if (OperationDate != null)
         {
             hashCode = hashCode * 59 + OperationDate.GetHashCode();
         }
         if (TicketTypeId != null)
         {
             hashCode = hashCode * 59 + TicketTypeId.GetHashCode();
         }
         if (OperationTypeId != null)
         {
             hashCode = hashCode * 59 + OperationTypeId.GetHashCode();
         }
         if (StatusId != null)
         {
             hashCode = hashCode * 59 + StatusId.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        public async Task <IActionResult> GetHot()
        {
            ObjectId currentUser = ObjectId.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            DateTime dateTime          = DateTime.UtcNow;
            var      beforeLimit       = dateTime.AddDays(-5);
            var      beforeLimitString = beforeLimit.ToString("yyyy-MM-dd") + "T" + beforeLimit.ToString("HH:mm:ss.ff") + "Z";
            var      query             = _neoContext.Cypher
                                         .Match($"(u:User)-[up:UPVOTED]->(t:Ticket)")
                                         .Where($"(up.Time > datetime('{beforeLimitString}')) AND (NOT (u)-[:CREATED]->(t))")
                                         .Match($"(c)-[:CREATED]->(t)")
                                         .With($"count(up) as ups, c.Username AS username, c.Id as userId, t")
                                         .OptionalMatch($"(u2:User)-[down:DOWNVOTED]->(t)")
                                         .With($"ups, (ups * 10 - coalesce(count(down),0) * 2) as rating, username, userId, t.Id as TicketId, t.Title as title")
                                         .Where("rating >= 0")
                                         .Return((username, rating, userId, TicketId, title) => new
            {
                Username = username.As <string>(),
                Rating   = rating.As <int>(),
                UserId   = userId.As <string>(),
                TicketId = TicketId.As <string>(),
                Title    = title.As <string>()
            })
                                         .OrderByDescending("rating", "ups")
                                         .Limit(5);
            var queryText = query.Query.DebugQueryText;

            return(Ok(await query.ResultsAsync));
        }
コード例 #3
0
        public async Task <Core.Domains.Ticket.Ticket> LoadTicketAsync(string id, CancellationToken cancellationToken)
        {
            var ticketId = new TicketId(id);
            var events   = await _eventStore.LoadAsync(ticketId, cancellationToken);

            return(new Core.Domains.Ticket.Ticket(events));
        }
コード例 #4
0
        public async Task <IActionResult> GetRecommended()
        {
            ObjectId currentUser = ObjectId.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            DateTime dateTime          = DateTime.UtcNow;
            var      beforeLimit       = dateTime.AddDays(-14);
            var      beforeLimitString = beforeLimit.ToString("yyyy-MM-dd") + "T" + beforeLimit.ToString("HH:mm:ss.ff") + "Z";
            var      query             = _neoContext.Cypher
                                         .Match($"(u:User {{Id: '{currentUser}'}})-[:INTEREST]->(rec:Topic)<-[:ON_TOPIC]-(t:Ticket)")
                                         .Where($"(t.Time > datetime('{beforeLimitString}')) AND (NOT (u)-[:CREATED]->(t))")
                                         .Match($"(c)-[:CREATED]->(t)")
                                         .With($"c.Username AS username, c.Id as userId, t.Id as TicketId, t.Title as title")
                                         .Return((username, userId, TicketId, title) => new
            {
                Username = username.As <string>(),
                UserId   = userId.As <string>(),
                TicketId = TicketId.As <string>(),
                Title    = title.As <string>()
            })
                                         .Limit(10);
            var queryText = query.Query.DebugQueryText;


            return(Ok(await query.ResultsAsync));
        }
コード例 #5
0
        public void Handle(RegisterTicket command)
        {
            var id         = _ticketRepository.GetNextId(TicketSeq);
            var ticketId   = new TicketId(id);
            var ticketType = new TicketType(command.Type);
            var schoolId   = new SchoolId(command.SchoolId);
            var ticket     = new Ticket(ticketId, ticketType, schoolId, command.Message);

            _ticketRepository.Create(ticket);
        }
コード例 #6
0
ファイル: Bug.cs プロジェクト: mturchik/NETDBProgramming
 public override void Display()
 {
     Console.WriteLine("===Bug Ticket===\n" +
                       "=TicketID: {0}\n" +
                       "=Summary: {1}\n" +
                       "=Status: {2}\n" +
                       "=Priority: {3}\n" +
                       "=Submitter: {4}\n" +
                       "=Assigned: {5}\n" +
                       "=Watching: {6}\n" +
                       "=Severity: {7}",
                       TicketId.ToString(), Summary, Status, Priority, Submitter, Assigned, Watching, Severity);
 }
コード例 #7
0
        public byte[] Serialize()
        {
            var bytes = new List <byte>();

            bytes.AddRange(Etag.ToBytes(24));
            bytes.AddRange(Station.ToBytes());
            bytes.AddRange(Lane.ToBytes());
            bytes.AddRange(TicketId.ToBytes());
            bytes.AddRange(((int)Status).ToBytes());
            bytes.AddRange(Plate.ToBytes(10));
            bytes.AddRange(ImageCount.ToBytes());
            bytes.AddRange(VehicleLength.ToBytes());
            return(bytes.ToArray());
        }
コード例 #8
0
ファイル: Task.cs プロジェクト: mturchik/NETDBProgramming
 public override void Display()
 {
     Console.WriteLine("===Task Ticket===\n" +
                       "=TicketID: {0}\n" +
                       "=Summary: {1}\n" +
                       "=Status: {2}\n" +
                       "=Priority: {3}\n" +
                       "=Submitter: {4}\n" +
                       "=Assigned: {5}\n" +
                       "=Watching: {6}\n" +
                       "=Project Name: {7}\n" +
                       "=Due Date: {8}/{9}/{10}",
                       TicketId.ToString(), Summary, Status, Priority, Submitter, Assigned, Watching, ProjectName, DueDate.Month, DueDate.Day, DueDate.Year);
 }
コード例 #9
0
 public override void Display()
 {
     Console.WriteLine("===Enhancement Ticket===\n" +
                       "=TicketID: {0}\n" +
                       "=Summary: {1}\n" +
                       "=Status: {2}\n" +
                       "=Priority: {3}\n" +
                       "=Submitter: {4}\n" +
                       "=Assigned: {5}\n" +
                       "=Watching: {6}\n" +
                       "=Software: {7}\n" +
                       "=Cost: ${8}\n" +
                       "=Reason: {9}\n" +
                       "=Estimate: {10}",
                       TicketId.ToString(), Summary, Status, Priority, Submitter, Assigned, Watching, Software, Cost, Reason, Estimate);
 }
コード例 #10
0
        public IActionResult CancelTicket(TicketId ticketId)
        {
            int id = ticketId.Id;
            HttpResponseMessage response = client.GetAsync(client.BaseAddress + "/Ticket/" + id).Result;
            string data = response.Content.ReadAsStringAsync().Result;
            var    ticketsearchresult       = JsonConvert.DeserializeObject <TicketDetails>(data);
            HttpResponseMessage delResponse = client.DeleteAsync(client.BaseAddress + "/Ticket/" + id).Result;

            if (delResponse.IsSuccessStatusCode)
            {
                //return RedirectToAction("Index");
                return(RedirectToAction("CancelTicketStatus", ticketsearchresult));
            }
            else
            {
                return(BadRequest("Link Failure"));
            }
        }
コード例 #11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TicketId.Length != 0)
            {
                hash ^= TicketId.GetHashCode();
            }
            if (Item != 0)
            {
                hash ^= Item.GetHashCode();
            }
            if (exclusiveInfo_ != null)
            {
                hash ^= ExclusiveInfo.GetHashCode();
            }
            return(hash);
        }
コード例 #12
0
        public IActionResult GetTicketInformation(TicketId ticketId)
        {
            int id = ticketId.Id;

            PNR = id;
            HttpResponseMessage response = client.GetAsync(client.BaseAddress + "/Ticket/" + id).Result;

            if (response.IsSuccessStatusCode)
            {
                string data = response.Content.ReadAsStringAsync().Result;
                var    ticketsearchresult = JsonConvert.DeserializeObject <TicketDetails>(data);
                if (ticketsearchresult != null)
                {
                    return(RedirectToAction("TicketInformation", ticketsearchresult));
                }
                return(RedirectToAction("Error"));
            }
            else
            {
                return(BadRequest("Link Failure"));
            }
        }
コード例 #13
0
        /// <summary>
        /// Returns true if TicketFilterResult instances are equal
        /// </summary>
        /// <param name="other">Instance of TicketFilterResult to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TicketFilterResult other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TicketId == other.TicketId ||
                     TicketId != null &&
                     TicketId.Equals(other.TicketId)
                     ) &&
                 (
                     OperationDate == other.OperationDate ||
                     OperationDate != null &&
                     OperationDate.Equals(other.OperationDate)
                 ) &&
                 (
                     TicketTypeId == other.TicketTypeId ||
                     TicketTypeId != null &&
                     TicketTypeId.Equals(other.TicketTypeId)
                 ) &&
                 (
                     OperationTypeId == other.OperationTypeId ||
                     OperationTypeId != null &&
                     OperationTypeId.Equals(other.OperationTypeId)
                 ) &&
                 (
                     StatusId == other.StatusId ||
                     StatusId != null &&
                     StatusId.Equals(other.StatusId)
                 ));
        }
コード例 #14
0
 public override String ToString()
 {
     return($"<Ticket Id: {TicketId.ToString()} Attendee: {Attendee.FirstName} {Attendee.LastName} {(IsPremium ? "Premium" : String.Empty)}>");
 }
コード例 #15
0
ファイル: Bug.cs プロジェクト: mturchik/NETDBProgramming
 public override string ToString() => TicketId.ToString() + "," + Summary + "," + Status + "," + Priority + "," + Submitter + "," + Assigned + "," + Watching + "," + Severity;
コード例 #16
0
 public override string ToString() => TicketId.ToString() + "," + Summary + "," + Status + "," + Priority + "," + Submitter + "," + Assigned + "," + Watching + "," + Software + "," + Cost + "," + Reason + "," + Estimate;
コード例 #17
0
 public AddTicket(TicketId ticketId, int ticketNumber)
 {
     TicketId     = ticketId;
     TicketNumber = ticketNumber;
 }