Пример #1
0
 public Ticket(string title, string content, int categoryId, int creatorId, TicketPriority priority)
 {
     this.Title = title;
     this.Content = content;
     this.CategoryId = categoryId;
     this.CreatorId = creatorId;
     this.Priority = priority;
     this.Status = TicketStatus.Open;
     this.DateCreated = DateTime.Now;
     this.LastEdited = DateTime.Now;
     this.Updates = new List<TicketUpdate>();
 }
        // GET: TicketPriorities/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketPriority ticketPriority = db.TicketPriorities.Find(id);

            if (ticketPriority == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketPriority));
        }
Пример #3
0
        public Ticket(string title, TicketPriority priority, User createdBy)
        {
            if(!createdBy.Is<CustomerSupport>())
                throw new Exception("This user is not customer support!");

            CreatedBy = createdBy;

            Title = title;
            TicketPriority = priority;
            _notes = new Collection<TicketNote>();

            TicketStatus = TicketStatus.New;
            Created = DateTime.Now;
        }
Пример #4
0
        public ActionResult Create([Bind(Include = "Id,PriorityName,Description")] TicketPriority ticketPriority)
        {
            if (ModelState.IsValid)
            {
                db.TicketPriorities.Add(ticketPriority);
                var userr = User.Identity.GetUserId();
                if (!rolesHelper.IsDemoUser(userr))
                {
                    db.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            return(View(ticketPriority));
        }
Пример #5
0
 public void Delete(TicketPriority priority)
 {
     using (var context = new PunchClockDbContext())
     {
         var ticketPriority = context.TicketPriorities.FirstOrDefault(x => x.Id == priority.Id);
         if (ticketPriority == null)
         {
             return;
         }
         ticketPriority.ModifiedById    = priority.ModifiedById;
         ticketPriority.ModifiedDateUtc = DateTime.UtcNow;
         ticketPriority.IsDeleted       = true;
         context.SaveChanges();
     }
 }
        public void GetTicketPriority()
        {
            TicketPriorityCollection ticketPriorities = TestSetup.KayakoApiService.Tickets.GetTicketPriorities();

            Assert.IsNotNull(ticketPriorities, "No ticket priorities were returned");
            Assert.IsNotEmpty(ticketPriorities, "No ticket priorities were returned");

            TicketPriority randomTicketPriorityToGet = ticketPriorities[new Random().Next(ticketPriorities.Count)];

            Trace.WriteLine("GetTicketPriority using ticket priority id: " + randomTicketPriorityToGet.Id);

            TicketPriority ticketPriority = TestSetup.KayakoApiService.Tickets.GetTicketPriority(randomTicketPriorityToGet.Id);

            CompareTicketPriorities(ticketPriority, randomTicketPriorityToGet);
        }
Пример #7
0
        public async Task <ActionResult <TicketPriority_TicketPriorityDTO> > Get([FromBody] TicketPriority_TicketPriorityDTO TicketPriority_TicketPriorityDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(TicketPriority_TicketPriorityDTO.Id))
            {
                return(Forbid());
            }

            TicketPriority TicketPriority = await TicketPriorityService.Get(TicketPriority_TicketPriorityDTO.Id);

            return(new TicketPriority_TicketPriorityDTO(TicketPriority));
        }
Пример #8
0
        public Ticket Create(string title, TicketType type, TicketState state, TicketPriority priority, int locationId, string authorId)
        {
            var ticket = new Ticket()
            {
                Title      = title,
                State      = state,
                Type       = type,
                Priority   = priority,
                LocationId = locationId,
                AuthorId   = authorId
            };

            this.BaseRepository.Add(ticket);
            this.BaseRepository.SaveChanges();
            return(ticket);
        }
Пример #9
0
        public Customer_TicketPriorityDTO(TicketPriority TicketPriority)
        {
            this.Id = TicketPriority.Id;

            this.Name = TicketPriority.Name;

            this.OrderNumber = TicketPriority.OrderNumber;

            this.ColorCode = TicketPriority.ColorCode;

            this.StatusId = TicketPriority.StatusId;

            this.Used = TicketPriority.Used;

            this.Errors = TicketPriority.Errors;
        }
        // GET: TicketPriorities/Edit/5
        public ActionResult Edit(int?id)
        {
            var nHelper = new UserNotificationsHelper();

            ViewBag.Notifications = nHelper.filterNotifications(User.Identity.GetUserId());
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketPriority ticketPriority = db.TicketPriorities.Find(id);

            if (ticketPriority == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketPriority));
        }
Пример #11
0
        //CREATE TICKET
        public void createTicket(CreateTicketViewModel model, string userId)
        {
            TicketType     ticketType     = new TicketType(model.TicketTypeName);
            TicketPriority ticketPriority = new TicketPriority(model.Priority);

            TicketTypeRepo.Add(ticketType);
            TicketPriorityRepo.Add(ticketPriority);
            Ticket ticket = new Ticket(model.Title, model.Description, DateTime.Now, model.ProjectId, ticketType.Id,
                                       ticketPriority.Id, userId);

            TicketRepo.Add(ticket);
            var copyTicket = TicketRepo.GetEntity(x => x.Id == ticket.Id);

            TicketHistory history = new TicketHistory(copyTicket.Id, "property", model.Description, model.Description, true, userId);

            TicketHistoryRepo.Add(history);
        }
Пример #12
0
 public TicketPriority Update(TicketPriority priority)
 {
     using (var context = new PunchClockDbContext())
     {
         var ticketPriority = context.TicketPriorities.FirstOrDefault(x => x.Id == priority.Id);
         if (ticketPriority == null)
         {
             return(priority);
         }
         ticketPriority.Name            = priority.Name;
         ticketPriority.Description     = priority.Description;
         ticketPriority.DisplayOrder    = priority.DisplayOrder;
         ticketPriority.ModifiedById    = priority.ModifiedById;
         ticketPriority.ModifiedDateUtc = DateTime.UtcNow;
         context.SaveChanges();
     }
     return(priority);
 }
Пример #13
0
        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;
        }
Пример #14
0
 public Ticket(string title, string description, TicketStatus status, TicketPriority priority, TicketType type, DateTime?dueDate, string resolutionComments, User requestor, User assignedTo, Category category)
 {
     State = new TicketState
     {
         Id                 = SequencialGuidGenerator.NewSequentialGuid(),
         TicketNumber       = new Random().Next(),
         Title              = title,
         Description        = description,
         Status             = status,
         Priority           = priority,
         Type               = type,
         DueDate            = dueDate,
         ResolutionComments = resolutionComments,
         Requestor          = requestor.CreateRequestorSnapShot(),
         RequestedDate      = DateTime.UtcNow,
         AssignedTo         = assignedTo.State,
         Category           = category.State
     };
 }
        public ActionResult Edit(int?id)
        {
            if (User.Identity.GetUserId() == "db9a774b-807c-4b9b-9b22-34c191872996" || User.Identity.GetUserId() == "3eaa1491-7553-40fa-b7e1-b994e05d05e0" || User.Identity.GetUserId() == "5f84068f-4213-4d02-81a4-21936ae10cdc" || User.Identity.GetUserId() == "60f316c5-536c-4f06-83d3-38a555febc29")
            {
                return(RedirectToAction("InvalidAttempt", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketPriority ticketPriority = db.TicketPriorities.Find(id);

            if (ticketPriority == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketPriority));
        }
Пример #16
0
        private TicketPriority ConvertDTOToEntity(TicketPriority_TicketPriorityDTO TicketPriority_TicketPriorityDTO)
        {
            TicketPriority TicketPriority = new TicketPriority();

            TicketPriority.Id          = TicketPriority_TicketPriorityDTO.Id;
            TicketPriority.Name        = TicketPriority_TicketPriorityDTO.Name;
            TicketPriority.OrderNumber = TicketPriority_TicketPriorityDTO.OrderNumber;
            TicketPriority.ColorCode   = TicketPriority_TicketPriorityDTO.ColorCode;
            TicketPriority.StatusId    = TicketPriority_TicketPriorityDTO.StatusId;
            TicketPriority.Used        = TicketPriority_TicketPriorityDTO.Used;
            TicketPriority.Status      = TicketPriority_TicketPriorityDTO.Status == null ? null : new Status
            {
                Id   = TicketPriority_TicketPriorityDTO.Status.Id,
                Code = TicketPriority_TicketPriorityDTO.Status.Code,
                Name = TicketPriority_TicketPriorityDTO.Status.Name,
            };
            TicketPriority.BaseLanguage = CurrentContext.Language;
            return(TicketPriority);
        }
Пример #17
0
        public async Task <bool> ValidateId(TicketPriority TicketPriority)
        {
            TicketPriorityFilter TicketPriorityFilter = new TicketPriorityFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = TicketPriority.Id
                },
                Selects = TicketPrioritySelect.Id
            };

            int count = await UOW.TicketPriorityRepository.Count(TicketPriorityFilter);

            if (count == 0)
            {
                TicketPriority.AddError(nameof(TicketPriorityValidator), nameof(TicketPriority.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
Пример #18
0
        public async Task <bool> Create(TicketPriority TicketPriority)
        {
            TicketPriorityDAO TicketPriorityDAO = new TicketPriorityDAO();

            TicketPriorityDAO.Id          = TicketPriority.Id;
            TicketPriorityDAO.Name        = TicketPriority.Name;
            TicketPriorityDAO.OrderNumber = TicketPriority.OrderNumber;
            TicketPriorityDAO.ColorCode   = TicketPriority.ColorCode;
            TicketPriorityDAO.StatusId    = TicketPriority.StatusId;
            TicketPriorityDAO.Used        = TicketPriority.Used;
            TicketPriorityDAO.CreatedAt   = StaticParams.DateTimeNow;
            TicketPriorityDAO.UpdatedAt   = StaticParams.DateTimeNow;
            DataContext.TicketPriority.Add(TicketPriorityDAO);
            await DataContext.SaveChangesAsync();

            TicketPriority.Id = TicketPriorityDAO.Id;
            await SaveReference(TicketPriority);

            return(true);
        }
        public ActionResult Create()
        {
            TicketPriority tTyp   = db.TicketPriorities.Find(4);
            var            userid = User.Identity.GetUserId();

            //Project List is limited to projects the submitter is assigned to.
            ViewBag.ProjectId = new SelectList(db.Projects
                                               .Where(p => p.ProjectUser
                                                      .Select(pu => pu.Id)
                                                      .Contains(userid)).ToList()
                                               , "Id", "Name");
            ViewBag.TicketStatusId   = new SelectList(db.TicketStatuses, "Id", "Name", 1);
            ViewBag.TicketTypeId     = new SelectList(db.TicketTypes, "Id", "Name");
            ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name", 4);

            Ticket model = new Ticket();

            model.TicketPriorityId = 4;
            return(View(model));
        }
Пример #20
0
        public ApiResponse Update(Guid id, Ticket ticket)
        {
            TicketPriority ticketPrority   = null;
            var            validationError = ValidateUpdate(ticket, (priority, ticketStatus) => {
                ticketPrority = priority;
            });

            if (validationError.Count == 0)
            {
                ticket.TicketPriorityId      = ticketPrority.Id;
                ticket.RequestedByContactId  = base.ContactId;
                ticket.RequestedForContactId = base.ContactId;

                CreateTicketHistory(ticket, "Ticket updated.");
                _faciTechDbContext.SaveChanges();

                return(UpdateResponse(ticket));
            }
            return(new ApiResponse(validationError));
        }
Пример #21
0
        public async Task <bool> Update(TicketPriority TicketPriority)
        {
            TicketPriorityDAO TicketPriorityDAO = DataContext.TicketPriority.Where(x => x.Id == TicketPriority.Id).FirstOrDefault();

            if (TicketPriorityDAO == null)
            {
                return(false);
            }
            TicketPriorityDAO.Id          = TicketPriority.Id;
            TicketPriorityDAO.Name        = TicketPriority.Name;
            TicketPriorityDAO.OrderNumber = TicketPriority.OrderNumber;
            TicketPriorityDAO.ColorCode   = TicketPriority.ColorCode;
            TicketPriorityDAO.StatusId    = TicketPriority.StatusId;
            TicketPriorityDAO.Used        = TicketPriority.Used;
            TicketPriorityDAO.UpdatedAt   = StaticParams.DateTimeNow;
            await DataContext.SaveChangesAsync();

            await SaveReference(TicketPriority);

            return(true);
        }
Пример #22
0
        public async Task <TicketPriority> Update(TicketPriority TicketPriority)
        {
            if (!await TicketPriorityValidator.Update(TicketPriority))
            {
                return(TicketPriority);
            }
            try
            {
                var oldData = await UOW.TicketPriorityRepository.Get(TicketPriority.Id);

                await UOW.Begin();

                await UOW.TicketPriorityRepository.Update(TicketPriority);

                await UOW.Commit();

                TicketPriority = await UOW.TicketPriorityRepository.Get(TicketPriority.Id);

                await Logging.CreateAuditLog(TicketPriority, oldData, nameof(TicketPriorityService));

                return(TicketPriority);
            }
            catch (Exception ex)
            {
                await UOW.Rollback();

                if (ex.InnerException == null)
                {
                    await Logging.CreateSystemLog(ex, nameof(TicketPriorityService));

                    throw new MessageException(ex);
                }
                else
                {
                    await Logging.CreateSystemLog(ex.InnerException, nameof(TicketPriorityService));

                    throw new MessageException(ex.InnerException);
                }
            }
        }
Пример #23
0
            public async Task <Unit> Handle(Command request, CancellationToken cancellationToken)
            {
                var ticketPriority = new TicketPriority
                {
                    Id          = request.Id,
                    Name        = request.Name,
                    Color       = request.Color,
                    IsDefault   = request.IsDefault,
                    CreatedDate = request.CreatedDate,
                    UpdatedDate = request.UpdatedDate
                };

                _context.TicketPriorities.Add(ticketPriority);
                var success = await _context.SaveChangesAsync() > 0;

                if (success)
                {
                    return(Unit.Value);
                }

                throw new Exception("Problem saving the data for the company");
            }
        public CreateTicketRequest(TicketStatus status, TicketPriority priority, TicketSource source, string description, string?requesterName = null,
                                   long?requesterId = null, string?email            = null, string?facebookId = null, string?phoneNumber = null,
                                   string?twitterId = null, string?uniqueExternalId = null, long?responderId  = null, string[]?ccEmails  = null,
                                   Dictionary <string, object>?customFields = null, DateTimeOffset?dueBy = null, long?emailConfigId = null,
                                   DateTimeOffset?firstResponseDueBy        = null, long?groupId = null, long?productId = null, string[]?tags = null,
                                   long?companyId = null, string?subject = null, string?ticketType = null, long?parentTicketId                = null,
                                   IEnumerable <FileAttachment>?files = null)
        {
            if (!requesterId.HasValue && email == null && facebookId == null && phoneNumber == null && twitterId == null && uniqueExternalId == null)
            {
                throw new ArgumentException("You must set at least one of requesterId, email, facebookId, phoneNumber, twitterId, uniqueExternalId to denote the requester");
            }

            Status             = status;
            Priority           = priority;
            Source             = source;
            RequesterName      = requesterName;
            Email              = email;
            FacebookId         = facebookId;
            PhoneNumber        = phoneNumber;
            TwitterId          = twitterId;
            UniqueExternalId   = uniqueExternalId;
            Description        = description;
            RequesterId        = requesterId;
            ResponderId        = responderId;
            CcEmails           = ccEmails;
            CustomFields       = customFields;
            DueBy              = dueBy;
            EmailConfigId      = emailConfigId;
            FirstResponseDueBy = firstResponseDueBy;
            GroupId            = groupId;
            ProductId          = productId;
            Tags           = tags;
            CompanyId      = companyId;
            Subject        = subject;
            TicketType     = ticketType;
            ParentTicketId = parentTicketId;
            Files          = files;
        }
Пример #25
0
        public int MathPriority(TicketPriority pri, Priority resPri)
        {
            if (pri == null || resPri == null)
            {
                return(0);
            }
            int priority = pri.service_quality;

            if (pri.moved_ticket > 0)
            {
                priority += resPri.moved_ticket;
            }
            if (pri.restore_ticket > 0)
            {
                priority += resPri.restore_ticket;
            }
            if (pri.internal_vip_card != null && pri.internal_vip_card.Length > 0)
            {
                priority += resPri.internal_vip_card;
            }
            if (pri.customer_vip_card != null && pri.customer_vip_card.Length > 0)
            {
                priority += resPri.customer_vip_card;
            }
            if (pri.privileged_customer != null && pri.privileged_customer.Length > 0)
            {
                priority += resPri.privileged_customer;
            }
            if (pri.booked_ticket != null && pri.booked_ticket.Length > 0)
            {
                priority += resPri.booked_ticket;
            }
            if (pri.priority_service > 0)
            {
                priority += resPri.priority_service;
            }
            return(priority);
        }
Пример #26
0
        public ApiResponse Create(Ticket ticket)
        {
            TicketPriority ticketPrority   = null;
            var            validationError = ValidateCreate(ticket, (priority, ticketStatus) => {
                ticketPrority       = priority;
                ticket.TicketStatus = ticketStatus;
            });

            if (validationError.Count == 0)
            {
                ticket.Id                    = Guid.NewGuid();
                ticket.Number                = _faciTechDbContext.GenerateSequence("ticket_number");
                ticket.TicketPriorityId      = ticketPrority.Id;
                ticket.RequestedByContactId  = base.ContactId;
                ticket.RequestedForContactId = base.ContactId;
                ticket.TicketStatusId        = BLConstants.DefaultTicketStatus;
                CreateTicketHistory(ticket, "Ticket created.");

                _faciTechDbContext.SaveChanges();
                return(new ApiResponse(new { Id = ticket.Id, Number = ticket.Number }));
            }
            return(new ApiResponse(validationError));
        }
Пример #27
0
 public CreateOutboundEmailRequest(TicketStatus status, TicketPriority priority, string subject, string description,
                                   string email, long emailConfigId, string?requesterName = null, string[]?ccEmails = null,
                                   Dictionary <string, object>?customFields = null, DateTimeOffset?dueBy            = null,
                                   DateTimeOffset?firstResponseDueBy        = null, long?groupId = null, string[]?tags = null,
                                   string?ticketType = null,
                                   IEnumerable <FileAttachment>?files = null)
 {
     Status             = status;
     Priority           = priority;
     RequesterName      = requesterName;
     Email              = email;
     Description        = description;
     CcEmails           = ccEmails;
     CustomFields       = customFields;
     DueBy              = dueBy;
     EmailConfigId      = emailConfigId;
     FirstResponseDueBy = firstResponseDueBy;
     GroupId            = groupId;
     Tags       = tags;
     Subject    = subject;
     TicketType = ticketType;
     Files      = files;
 }
Пример #28
0
        public string TranslateTicketPriority(TicketPriority ticketPriority)
        {
            switch (ticketPriority)
            {
            case TicketPriority.Lowest:
                return(Resources.String_Lowest);

            case TicketPriority.Low:
                return(Resources.String_Low);

            case TicketPriority.Normal:
                return(Resources.String_Normal);

            case TicketPriority.High:
                return(Resources.String_High);

            case TicketPriority.Highest:
                return(Resources.String_Highest);

            default:
                return(ticketPriority.ToString());
            }
        }
Пример #29
0
        private TicketEntry getUpdatedEntry()
        {
            TicketEntry ticketEntry = new TicketEntry();

            ticketEntry.Name        = txtUpdateName.Text;
            ticketEntry.Address     = txtUpdateAddress.Text;
            ticketEntry.PhoneNumber = txtUpdatePhoneNumber.Text;
            TicketPriority priority = TicketPriority.Normal;

            Enum.TryParse(cbUpdatePriority.Text, out priority);
            ticketEntry.Priority    = priority;
            ticketEntry.Category    = cbUpdateCategory.Text;
            ticketEntry.Description = txtUpdateDescription.Text;
            ticketEntry.EntryDate   = entryDate.Value.Date;
            ticketEntry.DueDate     = dueDate.Value.Date;
            ticketEntry.Resolver    = txtUpdateResolver.Text;
            ticketEntry.TicketNo    = txtUpdateTicketNo.Text;
            ticketEntry.Email       = txtUpdateEmail.Text;
            TicketStatus status = TicketStatus.New;

            Enum.TryParse(cbUpdateStatus.Text, out status);
            ticketEntry.Status = status;
            return(ticketEntry);
        }
Пример #30
0
        public async Task <TicketUpdateResult> Update(int id, int assignedTo, TicketPriority priority)
        {
            var ticket = await _dbContext.Tickets.Include(t => t.Product)
                         .Include(t => t.Client).FirstOrDefaultAsync(p => p.Id == id);

            var staffMember = await _dbContext.Staff.FirstOrDefaultAsync(e => e.Id == assignedTo);

            if (staffMember == null && ticket.Employee == null)
            {
                ticket.Priority = priority;
                ticket.Employee = null;
            }
            else if (staffMember == null && ticket.Employee != null)
            {
                ticket.Priority = priority;
            }
            else
            {
                ticket.Priority = priority;
                ticket.Employee = staffMember;
                ticket.Status   = TicketStatus.Inprogress;
            }
            await _dbContext.SaveChangesAsync();

            return(new TicketUpdateResult()
            {
                Summary = ticket.Summary,
                Status = ticket.Status,
                ProductName = ticket.Product.Name,
                ClientName = ticket.Client.Name,
                Priority = ticket.Priority,
                CreateDateTime = ticket.CreateDateTime,
                CloseDate = ticket.CloseDate,
                Id = ticket.Id,
            });
        }
Пример #31
0
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, TicketViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                string fieldName = "CreatedOn";
                var    m         = this.ViewData.ModelState[fieldName];

                if (m != null && m.Errors.Count > 0)
                {
                    this.ViewData.ModelState.Remove(fieldName);
                }
            }

            if (this.ModelState.IsValid && model != null)
            {
                var            authorId = this.CurrentUser.Id;
                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);

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

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

            return(this.Json(new[] { model }.ToDataSourceResult(request, this.ModelState)));
        }
Пример #32
0
        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;
            }
        }
Пример #33
0
 public Ticket CreateNewTicket(string title, string content, int categoryId, TicketPriority priority, int creatorId)
 {
     return new Ticket(title, content, categoryId, creatorId, priority);
 }
Пример #34
0
 public void Save(TicketPriority priority)
 {
     base.Save(priority);
 }
Пример #35
0
        public static void EditByManager(int id, string title, string description, string userId, TicketType ticketType, TicketPriority ticketPriority, TicketStatus ticketStatus)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            Ticket ticket           = GetTicket(id);

            ticket.Title            = title;
            ticket.Description      = description;
            ticket.AssignedToUserId = userId;
            ticket.TicketType       = ticketType;
            ticket.TicketPriority   = ticketPriority;
            ticket.TicketStatus     = ticketStatus;
            ticket.Updated          = DateTime.Now;
            db.Entry(ticket).State  = EntityState.Modified;
            db.SaveChanges();
            db.Dispose();
        }
Пример #36
0
        public static void EditBySubmitter(int id, string title, string description, int projectId, TicketType ticketType, TicketPriority ticketPriority)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            Ticket ticket           = GetTicket(id);

            ticket.Title           = title;
            ticket.Description     = description;
            ticket.ProjectId       = projectId;
            ticket.TicketType      = ticketType;
            ticket.TicketPriority  = ticketPriority;
            ticket.Updated         = DateTime.Now;
            db.Entry(ticket).State = EntityState.Modified;
            db.SaveChanges();
            db.Dispose();
        }
Пример #37
0
        private string TranslateTicketPriority(TicketPriority ticketPriority)
        {
            switch (ticketPriority)
            {
                case TicketPriority.Lowest:
                    return Resources.String_Lowest;

                case TicketPriority.Low:
                    return Resources.String_Low;

                case TicketPriority.Normal:
                    return Resources.String_Normal;

                case TicketPriority.High:
                    return Resources.String_High;

                case TicketPriority.Highest:
                    return Resources.String_Highest;

                default:
                    return ticketPriority.ToString();
            }
        }
Пример #38
0
 public Ticket UpdateTicket(string title, string content, int categoryId, TicketPriority priority, TicketStatus status)
 {
     this.Title = title;
     this.Content = content;
     this.CategoryId = categoryId;
     this.Priority = priority;
     this.Status = status;
     this.LastEdited = DateTime.Now;
     return this;
 }