예제 #1
0
 private Ticket(Guid guid, DateTime utcNow, string requestedBy)
 {
     Id          = guid;
     GeneratedAt = utcNow;
     GeneratedBy = requestedBy;
     State       = TicketState.New;
 }
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0
                && (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return false;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return true;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return true;
            }

            return false;
        }
        public static bool UpdateTroubleTicketState(int tickedID, TicketState newTicketState)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                SqlCommand command = connection.CreateCommand();

                SqlTransaction transaction = connection.BeginTransaction("UpdateTicketStateTrans");
                command.Connection  = connection;
                command.Transaction = transaction;


                command.CommandText = "UPDATE [TroubleTickets] SET State = @newState WHERE Id = @id";
                command.Parameters.AddWithValue("@newState", (int)newTicketState);
                command.Parameters.AddWithValue("@id", tickedID);
                try
                {
                    command.ExecuteNonQuery();
                    transaction.Commit();
                    Console.WriteLine("Tickets: Ticket state changed to " + newTicketState);
                    return(true);
                }
                catch (SqlException e)
                {
                    transaction.Rollback();
                    Console.WriteLine("ERROR: Changing ticket state");
                    return(false);
                }
            }
        }
예제 #4
0
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0 &&
                (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return(false);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return(true);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return(true);
            }

            return(false);
        }
예제 #5
0
        public ActionResult Edit(TicketInfoViewModel model)
        {
            if (this.ModelState.IsValid && model != null)
            {
                TicketType     type     = (TicketType)Enum.Parse(typeof(TicketType), model.Type);
                TicketPriority priority = (TicketPriority)Enum.Parse(typeof(TicketPriority), model.Priority);
                TicketState    state    = (TicketState)Enum.Parse(typeof(TicketState), model.State);

                if (model.LocationId == null)
                {
                    model.LocationId = this.ticketService
                                       .GetById(model.Id)
                                       .Select(m => m.LocationId)
                                       .FirstOrDefault()
                                       .ToString();
                }

                var ticketId = this.ticketService.Update(
                    model.Id,
                    model.Title,
                    type,
                    state,
                    priority,
                    int.Parse(model.LocationId)).Id;

                model = this.ticketService
                        .GetById(ticketId)
                        .To <TicketInfoViewModel>()
                        .FirstOrDefault();

                return(this.PartialView("_TicketInfo", model));
            }

            return(this.PartialView("_TicketEditInfo", model));
        }
예제 #6
0
        public async Task RefreshAsync(RefreshInfo info)
        {
            switch (info.RefreshType)
            {
            case RefreshType.Event:
            case RefreshType.Session:
                _messageBus.StartEventRefresh();
                EventState state = await RefreshEvent();

                if (_messageBus != null)
                {
                    _messageBus.RefreshEvent(state);
                }
                break;

            case RefreshType.Ticket:
                Guid        ticketId = info.Id;
                TicketState ticket   = await _service.GetTicket(ticketId);

                if (ticket != null)
                {
                    await _cache.PutAsync(ticketId, ticket);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #7
0
        public string TranslateTicketState(TicketState ticketState)
        {
            switch (ticketState)
            {
            case TicketState.New:
                return(Resources.String_New);

            case TicketState.Accepted:
                return(Resources.String_Accepted);

            case TicketState.Closed:
                return(Resources.String_Closed);

            case TicketState.Completed:
                return(Resources.String_Completed);

            case TicketState.InProgress:
                return(Resources.String_InProgress);

            case TicketState.Blocked:
                return(Resources.String_Blocked);

            default:
                return(ticketState.ToString());
            }
        }
 private void bunifuCustomDataGrid1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (state == TicketState.OneWay)
     {
         //marking selected plane and sending to next form
         destinationPlane = (Plane)bunifuCustomDataGrid1.CurrentRow.DataBoundItem;
         Form5 f5 = new Form5(destinationPlane, state);
         this.Hide();
         f5.ShowDialog();
         Close();
     }
     else if (state == TicketState.Return)
     {
         //marking selected plane for dsetination and giving new source to grid view
         if (returnPlaneList != null)
         {
             destinationPlane = (Plane)bunifuCustomDataGrid1.CurrentRow.DataBoundItem;
             bunifuCustomDataGrid1.DataSource = null;
             bunifuCustomDataGrid1.DataSource = returnPlaneList;
             bunifuCustomDataGrid1.Refresh();
             state = TicketState.Done;
         }
     }
     else
     {
         //marking next selected plane and open new form
         nextDestinationPlane = (Plane)bunifuCustomDataGrid1.CurrentRow.DataBoundItem;
         state = TicketState.Return;
         Form5 f5 = new Form5(destinationPlane, nextDestinationPlane, state);//destinationPlane, nextDestinationPlane);
         this.Hide();
         f5.ShowDialog();
         Close();
     }
 }
예제 #9
0
        public async Task <TicketState> ValidateAuthCodeAsync(string code)
        {
            if (_networkMonitor.IsAvailable())
            {
                try{
                    TicketState ticket = await _service.ValidateAuthCode(code);

                    if (ticket == null)
                    {
                        return(null);
                    }

                    _logger.Info("Valid auth code: {0}, user: {1:n}", code, ticket.Id);

                    AppSettings.UserId = ticket.Id;
                    await _cache.PutAsync(ticket.Id, ticket);

                    return(ticket);
                }catch (Exception ex) {
                    _logger.Error(ex);
                }
            }

            return(null);
        }
예제 #10
0
 private void SetTicketState(Ticket ticket, TicketState state, bool batch = false)
 {
     TicketSingle(ticket, batch, t => {
         t.State = state;
         return(t);
     });
 }
예제 #11
0
        public static void TicketContextMenu(TicketContext context, TicketState state, string fileName)
        {
            int choice = Menu.getInput();

            switch (choice)
            {
            case 1:
                Menu.displayMessage(Menu.displaySearchMenu(state));
                int searchChoice = Menu.getInput();
                Menu.displayResults(context.Search(searchChoice));
                break;

            case 2:
                if (state is BugTicketState)
                {
                    var newTicket = Menu.GetBugTicket(state);
                    context.Write(newTicket, fileName);
                }
                else if (state is EnhacementTicketState)
                {
                    var newTicket = GetEnhancementTicket(state);
                    context.Write(newTicket, fileName);
                }
                else if (state is TaskTicketState)
                {
                    var newTicket = GetTaskTicket(state);
                    context.Write(newTicket, fileName);
                }

                break;

            case 3:
                break;
            }
        }
예제 #12
0
        public ActionResult Create(CreateTicketViewModel model)
        {
            if (this.ModelState.IsValid && model != null)
            {
                var            authorId = this.CurrentUser.Id;
                TicketType     type     = (TicketType)Enum.Parse(typeof(TicketType), model.Ticket.Type);
                TicketPriority priority = (TicketPriority)Enum.Parse(typeof(TicketPriority), model.Ticket.Priority);
                TicketState    state    = (TicketState)Enum.Parse(typeof(TicketState), model.Ticket.State);
                var            ticketId = this.ticketService.Create(
                    model.Ticket.Title,
                    type,
                    state,
                    priority,
                    int.Parse(model.Ticket.LocationId),
                    authorId).Id;

                this.ticketMessageService.Create(
                    model.Message.Content,
                    model.Message.PricingUnits,
                    ticketId,
                    authorId);

                return(this.RedirectToAction("Details", "Ticket", new { area = string.Empty, id = ticketId }));
            }

            return(this.View(model));
        }
예제 #13
0
 public static bool IsOpen(this TicketState @this)
 {
     return
         (@this == TicketState.New ||
          @this == TicketState.Accepted ||
          @this == TicketState.InProgress ||
          @this == TicketState.Blocked);
 }
예제 #14
0
파일: Ticket.cs 프로젝트: t-rolfin/trackIt
 public Ticket(Guid projectId, string name, string description, TicketState ticketState, string assignTo)
     : this()
 {
     ProjectId   = projectId;
     Name        = name;
     Description = description;
     TicketState = ticketState;
     AssignTo    = assignTo;
 }
예제 #15
0
 public void LogAcccess(string ipAddress)
 {
     State = TicketState.Accessed;
     AccessedAt.Add(new AccessEntry
     {
         IPAddress  = ipAddress,
         OccurredAt = DateTime.UtcNow
     });
 }
예제 #16
0
 public CreateTicketInput(long openedById, TicketState state, string description, long placeId, string title, DateTime created)
 {
     OpenedById  = openedById;
     State       = state;
     Description = description;
     PlaceId     = placeId;
     Title       = title;
     Created     = created;
 }
예제 #17
0
        public static EnhancementTicket GetEnhancementTicket(TicketState state)
        {
            var listLength = state.TicketList.Count;

            Console.WriteLine("Write summary for ticket:");

            string summary = Console.ReadLine();

            Console.WriteLine("Enter status of ticket(Open, Closed, Pending, Resovled):");

            string status = Console.ReadLine();


            Console.WriteLine("Enter priority of status(High, Medium, Low):");

            string sPriority = Console.ReadLine();

            Console.WriteLine("Who is summiting this ticket:");

            string submitter = Console.ReadLine();

            Console.WriteLine("Who is assigned for this ticket:");

            string assgined = Console.ReadLine();

            Console.WriteLine("Who is watching this ticket(seperated by |):");
            string watchers = Console.ReadLine();

            Console.WriteLine("What is the software:");
            string software = Console.ReadLine();

            Console.WriteLine("What is the cost (ex. 1.00)");
            string sCost = Console.ReadLine();

            Console.WriteLine("What is the reason");
            string reason = Console.ReadLine();

            Console.WriteLine("What is the estimate");
            string estimate = Console.ReadLine();

            var newETicket = new EnhancementTicket {
                TicketID     = state.TicketList[listLength - 1].TicketID + 1,
                Summary      = summary.ToLower(),
                TicketStatus = Enum.TryParse(status, out TicketStatus ticketStatus) ? ticketStatus : TicketStatus.Error, // ticketStatus parser
                Priority     = Enum.TryParse(sPriority, out Priority priority) ? priority : Priority.Error,              // ticketPriority parser
                Submitter    = submitter.ToLower(),
                Assgined     = assgined.ToLower(),
                Watching     = watchers.ToLower().Split('|').ToList(),
                Software     = software.ToLower(),
                Cost         = decimal.TryParse(sCost, out decimal cost) ? cost : 0,
                Reason       = reason.ToLower(),
                Estimate     = estimate.ToLower()
            };

            return(newETicket);
        }
예제 #18
0
        private void bunifuFlatButton2_Click_1(object sender, EventArgs e)
        {
            //getting id of selecting checkbox
            if (sClas == SeatClass.Business)
            {
                getBusTicketNumber();
            }
            else if (sClas == SeatClass.Economics)
            {
                getEcoTicketNumber();
            }
            else if (sClas == SeatClass.Delux)
            {
                getDelTicketNumber();
            }

            //check exact seat been selected or not
            if (countTicketSelection == checkboxSelected)
            {
                //code for oneway passenger
                if (tstate == TicketState.OneWay)
                {
                    getPrice();
                    bunifuGradientPanel1.Visible = false;
                    bunifuGradientPanel2.Visible = false;
                    bunifuGradientPanel3.Visible = false;
                    panel1.Visible = true;
                }
                //code for return and multicity passenger
                else if (tstate == TicketState.Return)
                {
                    loadSeat(nextPlane.planeID);
                    tstate = TicketState.Done;
                    countTicketSelection = 0;
                    this.Invalidate();
                    this.Refresh();
                    this.Update();
                    MessageBox.Show("destination plane seat selected . \n Select next plane seat");
                }
                else
                {
                    getPrice();
                    bunifuGradientPanel1.Visible = false;
                    bunifuGradientPanel2.Visible = false;
                    bunifuGradientPanel3.Visible = false;
                    panel1.Visible = true;
                }
            }
            else
            {
                //if more or less check box being selected
                MessageBox.Show("selected " + countTicketSelection + " seat Insted of selecting " + checkboxSelected + " seat");
                countTicketSelection = 0;
                ticketNumber.Clear();
            }
        }
예제 #19
0
 public TicketRegisteredDomainEvent(string id, string title, string description, TicketType ticketType, TicketState ticketState, TicketPriority ticketPriority, User user)
 {
     Id             = id;
     Title          = title;
     Description    = description;
     TicketType     = ticketType;
     TicketPriority = ticketPriority;
     TicketState    = ticketState;
     User           = user;
 }
        //
        // GET: /TicketStates/Edit/5

        public ActionResult Edit(int id = 0)
        {
            TicketState ticketstate = db.TicketState.Find(id);

            if (ticketstate == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketstate));
        }
 public ActionResult Edit(TicketState ticketstate)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ticketstate).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ticketstate));
 }
예제 #22
0
 public Ticket(int id, string title, string description, string date, TicketState state, string answer, int workerId, int solverId)
 {
     this.id          = id;
     this.title       = title;
     this.description = description;
     this.date        = date;
     this.state       = state;
     this.answer      = answer;
     this.workerId    = workerId;
     this.solverId    = solverId;
 }
예제 #23
0
        private TicketState TicketStateFrom(Guid ticketId)
        {
            if (!_dictionary.TryGetValue(ticketId, out var ticketDetails))
            {
                ticketDetails         = new TicketState();
                _dictionary[ticketId] = ticketDetails;
                _ticketStates.Add(ticketDetails);
            }

            return(ticketDetails);
        }
예제 #24
0
 public UpdateReadTicketCommand(string aggregateRootId, string userId, string userName, string title, TicketState state, TicketPriority priority, TicketType type, int version)
 {
     AggregateRootId = aggregateRootId;
     UserId          = userId;
     UserName        = userName;
     Title           = title;
     TicketState     = state;
     TicketPriority  = priority;
     TicketType      = type;
     Version         = version;
 }
        public ActionResult Create(TicketState ticketstate)
        {
            if (ModelState.IsValid)
            {
                db.TicketState.Add(ticketstate);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ticketstate));
        }
예제 #26
0
 public Ticket(long id, long openedById, TicketState state, string description, long placeId, string title,
               DateTime created)
 {
     Id          = id;
     OpenedById  = openedById;
     State       = state;
     Description = description;
     PlaceId     = placeId;
     Title       = title;
     Created     = created;
     Comments    = new List <TicketComment>();
 }
예제 #27
0
 public Ticket(int teamId, User user, string description, TicketType type, DateTime timeCreated, TicketState state)
 {
     TeamId       = teamId;
     User         = user;
     Description  = description;
     Type         = type;
     TimeCreated  = timeCreated;
     State        = state;
     ChildTickets = new List <Ticket>();
     Comments     = new List <Comment>();
     Logs         = new List <TicketLog>();
 }
예제 #28
0
        public void ChangeState(int id, TicketState state)
        {
            var ticket = GetTicket(id);

            if (ticket is null)
            {
                throw new InvalidOperationException($"Задача с идентификатором {id} не найдена!");
            }

            ticket.State = state;
            _context.Tickets.Update(ticket);
            _context.SaveChanges();
        }
예제 #29
0
 /// <summary>
 /// Convert domain enum TicketState to Api layer TicketState.
 /// </summary>
 /// <param name="value"></param>
 /// <returns></returns>
 public static Features.Ticket.Models.TicketState ToApiTicketState(this TicketState value)
 {
     return(value switch
     {
         TicketState.New => Features.Ticket.Models.TicketState.New,
         TicketState.InProgress => Features.Ticket.Models.TicketState.InProgress,
         TicketState.Resolved => Features.Ticket.Models.TicketState.Resolved,
         TicketState.Done => Features.Ticket.Models.TicketState.Done,
         TicketState.Closed => Features.Ticket.Models.TicketState.Closed,
         TicketState.Removed => Features.Ticket.Models.TicketState.Removed,
         TicketState.Reopen => Features.Ticket.Models.TicketState.Reopened,
         _ => throw new ArgumentOutOfRangeException(nameof(value), value, null)
     });
예제 #30
0
 public TicketDTO(int id, int teamId, User user, string description, TicketType type, string timeCreated, TicketState state, int childCount, int commentsCount)
 {
     Id                = id;
     TeamId            = teamId;
     UserName          = user.Name;
     UserSurname       = user.Surname;
     Description       = description;
     Type              = type;
     TimeCreated       = timeCreated;
     State             = state;
     ChildTicketsCount = childCount;
     CommentsCount     = commentsCount;
 }
예제 #31
0
 public static TicketStateMachineBase GetTicketState(TicketState state)
 {
     return(state switch
     {
         TicketState.New => new NewTicketState(),
         TicketState.InProgress => new InProgressTicketState(),
         TicketState.Resolved => new ResolvedTicketState(),
         TicketState.Done => new DoneTicketState(),
         TicketState.Closed => new ClosedTicketState(),
         TicketState.Removed => new RemovedTicketState(),
         TicketState.Reopen => new ReopenTicketState(),
         _ => new NewTicketState()
     });
        public bool isExpired(TicketState ticketState)
        {
            bool b =
                (bool)
                ticketState.getAuthentication().getAttributes().FirstOrDefault(
                    x => x.Key == typeof(RememberMeCredentials).FullName).Value;

            if (b == null || b.Equals(false))
            {
                return this.sessionExpirationPolicy.isExpired(ticketState);
            }

            return this.rememberMeExpirationPolicy.isExpired(ticketState);
        }
예제 #33
0
파일: Ticket.cs 프로젝트: AndrewM-/Peygir
        internal Ticket(PeygirDatabaseDataSet.TicketsRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            ID = row.ID;
            milestoneID = row.MilestoneID;
            ticketNumber = row.TicketNumber;
            summary = row.Summary;
            reportedBy = row.ReportedBy;
            type = (TicketType)row.Type;
            severity = (TicketSeverity)row.Severity;
            state = (TicketState)row.State;
            assignedTo = row.AssignedTo;
            priority = (TicketPriority)row.Priority;
            description = row.Description;
        }
예제 #34
0
파일: Ticket.cs 프로젝트: AndrewM-/Peygir
        public Ticket(int projectID, int milestoneID)
        {
            if (projectID == InvalidID)
            {
                string message = Resources.String_InvalidProjectID;
                throw new ArgumentException(message, "projectID");
            }
            if (milestoneID == InvalidID)
            {
                string message = Resources.String_InvalidMilestoneID;
                throw new ArgumentException(message, "milestoneID");
            }

            this.milestoneID = milestoneID;
            ticketNumber = 0;
            summary = string.Empty;
            reportedBy = string.Empty;
            type = (TicketType)(-1);
            severity = (TicketSeverity)(-1);
            state = (TicketState)(-1);
            assignedTo = string.Empty;
            priority = (TicketPriority)(-1);
            description = string.Empty;

            // Find max ticket number.
            TicketsTableAdapter tableAdapter = Database.TicketsTableAdapter;
            int? maxTicketNumber = tableAdapter.GetMaxTicketNumber(projectID);
            if (maxTicketNumber.HasValue)
            {
                ticketNumber = maxTicketNumber.Value + 1;
            }
            else
            {
                ticketNumber = 1;
            }
        }
 public bool isExpired(TicketState ticketState)
 {
     return (ticketState == null)
            || (ticketState.getCountOfUses() >= this.numberOfUses)
            || (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds);
 }
예제 #36
0
        private string TranslateTicketState(TicketState ticketState)
        {
            switch (ticketState)
            {
                case TicketState.New:
                    return Resources.String_New;

                case TicketState.Accepted:
                    return Resources.String_Accepted;

                case TicketState.Closed:
                    return Resources.String_Closed;

                case TicketState.Completed:
                    return Resources.String_Completed;

                default:
                    return ticketState.ToString();
            }
        }
        public bool isExpired(TicketState ticketState)
        {
            // Ticket has been used, check maxTimeToLive (hard window)
            if ((System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this._maxTimeToLiveInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since creation being greater than the maxTimeToLiveInMilliSeconds");
                //}
                return true;
            }

            // Ticket is within hard window, check timeToKill (sliding window)
            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this._timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since last use being greater than the timeToKillInMilliseconds");
                //}
                return true;
            }

            return false;
        }
 public bool isExpired(TicketState ticketState)
 {
     return (ticketState == null)
            || (System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this.timeToKillInMilliSeconds);
 }
 public bool isExpired(TicketState ticketState)
 {
     return false;
 }