public void Repository_Ticket_deveria_gravar_um_novo_ticket() { //Arrange Ticket result = _repository.Add(_ticket); result.Id.Should().BeGreaterThan(0); }
public async Task <TicketDTO> Add(TicketDTO ticket) { ticket.CreatedBy = User.Identity.Name; ticket.UpdatedBy = User.Identity.Name; ticket.CreatedDate = currentDateTime; ticket.UpdatedDate = currentDateTime; //ticket.TicketOwnerId = currentUserId; ticket.TicketOwnerId = ticket.TicketOwnerId == null ? currentUserId : ticket.TicketOwnerId; var newTicket = await _dataProvider.Add(ticket); return(newTicket); }
public IActionResult Post([FromBody] TicketForCreationDto ticket) { if (ticket == null) { return(BadRequest()); } var finalTicket = Mapper.Map <Entities.Ticket>(ticket); // set ticket as 'new' status finalTicket.Status = "new"; // Default values until Clients & Agent API is mocked finalTicket.ClientId = 0; finalTicket.AgentId = 0; finalTicket.Opened = DateTime.Now; _ticketRepository.Add(finalTicket); if (!_ticketRepository.Save()) { return(BadRequest()); } var createdTicket = Mapper.Map <Models.TicketDto>(finalTicket); return(CreatedAtRoute("GetTicket", new { id = createdTicket.Id }, createdTicket)); }
public Ticket NewTicket(TicketData ticket) { var newTicket = new Ticket() { ProjectId = ticket.ProjectId, TicketNumber = null, AreaId = ticket.AreaId, PriorityId = ticket.PriorityId, CategoryId = ticket.CategoryId, TicketStatusId = (int)TicketStatus.Open, Title = ticket.Title, Details = ticket.Content, IsHtml = true, CreatedBy = ticket.CreatedBy, CreatedDate = DateTime.Now, AssignedTo = ticket.UserId, LastUpdateBy = ticket.CreatedBy, LastUpdateDate = DateTime.Now, OwnerUserId = ticket.CreatedBy, ParentTicketId = null, EditionMarkAsDeleted = false, IsLastDetail = true, IsBillable = ticket.IsBillable, HasFiles = ticket.HasFiles, }; TicketRepository.Add(newTicket); Save(); newTicket.TicketNumber = newTicket.TicketDetailId; Save();// TODO:Use a stored procedure to insert ? return(newTicket); }
public void AddEvent(params Event[] events) { foreach (Event e in events) { var tickets = e.Ticket; e.Ticket = new HashSet <Ticket>(); _eventRepository.Add(events); List <Ticket> toAdd = new List <Ticket>(tickets); foreach (Ticket t in toAdd) { t.EventId = e.Id; } _ticketRepository.Add(toAdd.ToArray()); } }
public TicketDto Add(TicketDto item) { item.OpenDateTime = DateTime.Now.ToString(); Ticket ticket = _converter.DtoToModel(item); TicketDto ticketDto = _converter.ModelToDto(_repository.Add(ticket)); return(ticketDto); }
public IActionResult NewTicket(TicketModel ticketModel) { if (ModelState.IsValid) { _ticketRepository.Add(ticketModel); return(RedirectToAction("Details", ticketModel.Id)); } return(View(ticketModel)); }
public async Task <TicketDTO> Add(TicketDTO ticket) { //ticket.CreatedBy = currentUser; //ticket.UpdatedBy = currentUser; //ticket.CreatedDate = currentDateTime; //ticket.UpdatedDate = currentDateTime; var newTicket = await _dataProvider.Add(ticket); return(newTicket); }
public TicketInventory saveTicketWithInventory(Ticket ticket, TicketInventory ticketInventory) { tRepository.Add(ticket); tRepository.Complete(); ticketInventory.IdTicket = ticket.Id; tiRepository.Add(ticketInventory); tiRepository.Complete(); ticketInventory.Ticket = ticket; return(ticketInventory); }
public void GenerateTickets(int paymentID, int beneficiaryID, decimal amount, decimal exchangeRate, string name) { D.Tickets tickets = new D.Tickets(); int iteration = TicketCalculator.Count(amount, exchangeRate); for (int i = 0; i < iteration; i++) { tickets.Add(new D.Ticket(paymentID, beneficiaryID, i, name)); } TicketRepository.Add(tickets); }
public async Task CreateTicket([FromBody] CreateTicketModel model) { var ticket = new Ticket( model.Creator, model.Source, model.Summary, model.Description, model.Categorisation); await _ticketRepository.Add(ticket); await _ticketRepository.Save(); }
public IActionResult Post([FromBody] Ticket ticket) { try { var ticketRepository = new TicketRepository(); ticketRepository.Add(ticket); return(Ok()); } catch (Exception e) { AppSettings.Logger.Error($"Unable to connect to the database at: {AppSettings.Logger}"); AppSettings.Logger.Error($"The error was: {e.Message}"); return(StatusCode(500)); } }
public Ticket BookTicket(TicketCreateDto dto, string UserId) { CheckPublishedShowtime(dto.ShowTimeId); CheckSeatInRange(dto.Seat, dto.ShowTimeId); CheckDupplicatedSeat(dto.Seat, dto.ShowTimeId); Ticket entity = new Ticket { Seat = dto.Seat, ShowTimeId = dto.ShowTimeId, TicketTypeId = dto.TicketTypeId, UserId = UserId }; return(repository.Add(entity)); }
public Ticket AddTicket() { Ticket ticket = new Ticket(); IOrderedEnumerable <Ticket> tickets = ticketRepository.GetAll().OrderByDescending(T => T.OrderNumber); int orderNumber; if (tickets.Count() == 0) { orderNumber = 0; } else { orderNumber = tickets.First().OrderNumber + 1; } ticket.OrderNumber = orderNumber; ticketRepository.Add(ticket); return(ticket); }
public ActionResult Create(Ticket ticket) { if (ModelState.IsValid) { try { ticketRepository.Add(ticket); ticketRepository.Save(); return(RedirectToAction("Details", new { id = ticket.ticket_id })); } catch { ModelState.AddRuleViolations(ticket.GetRuleViolations()); ControllerHelpers.CreateDropDownListViewBag(this); } } ControllerHelpers.CreateDropDownListViewBag(this); return(View(ticket)); }
public Ticket NewTicketEdition(TicketData ticket) { var ticketNumber = ticket.TicketNumber; var ticketDetails = TicketRepository.Where(t => t.TicketNumber == ticketNumber); var createdDate = ticketDetails.FirstOrDefault().CreatedDate; var createdBy = ticketDetails.FirstOrDefault().CreatedBy; foreach (var ticketDetail in ticketDetails) { ticketDetail.IsLastDetail = false; } var newTicketEdition = new Ticket() { ProjectId = ticket.ProjectId, AreaId = ticket.AreaId, PriorityId = ticket.PriorityId, CategoryId = ticket.CategoryId, TicketStatusId = ticket.StatusId, Title = ticket.Title, Details = ticket.Content, IsHtml = true, CreatedBy = createdBy, CreatedDate = createdDate, AssignedTo = ticket.UserId, LastUpdateBy = ticket.LastUpdateBy, LastUpdateDate = DateTime.Now, OwnerUserId = ticket.OwnerUserId, ParentTicketId = null, EditionMarkAsDeleted = false, IsLastDetail = true, HasFiles = ticket.HasFiles, IsBillable = ticket.IsBillable, TicketNumber = ticketNumber }; TicketRepository.Add(newTicketEdition); Save(); return(newTicketEdition); }
public ActionResult Create() { Ticket ticket = new Ticket(); ticket.TicketCreatorUserId = UserHelpers.GetUserId(User.Identity.Name); ticket.TicketTags = ""; ticket.TicketStatus = "DRAFT"; ticket.TicketPriority = "Normal"; ticket.TicketSubject = ""; ticket.TicketDueDate = DateTime.UtcNow.AddDays(2); ticket.TicketDescription = ""; ticket.TicketLastUpdated = DateTime.UtcNow; ticket.TicketCreatedDate = DateTime.UtcNow; ticket.TicketOwnersEmailList = ""; ticket.TicketResolutionDetails = ""; ticket.TicketEmailNotificationList = ""; ticketRepository.Add(ticket); ticketRepository.Save(); // redirect to edit mode return(RedirectToAction("EditDraft", new { id = ticket.TicketId })); }
public void Add([FromBody] Ticket ticket) { _ticketRepository.Add(ticket); }
public void Add(Ticket ticket) { repository.Add(ticket); repository.Save(); }
public async Task <TicketDTO> Add(TicketDTO ticket) { var newTicket = await _dataProvider.Add(ticket); return(newTicket); }
public List <Ticket> AddTicket(Ticket item) { trep.Add(item); trep.Save(); return(GetAllTickets()); }
public bool AddTicket(Ticket ticket) { return(_ticketRepository.Add(ticket)); }
private void ShowOperationResponse(EventSourceMessageEventArgs op) { if (op.Event == "open") { return; } var or = JsonSingleton.GetInstance <OperationResponse>(op.Message); SavePagingToken(or.PagingToken); if (or.GetType() != typeof(PaymentOperationResponse)) { return; } var payment = (PaymentOperationResponse)or; if (payment.From.AccountId == _keyPair.AccountId) { return; } AppSettings.Logger.Information( $@"Transaction received: Id: {or.Id}, Source: {or.SourceAccount.AccountId}, Type: {or.Type}"); // Need to make sure the payment was at least $10 worth of XRP // If it isn't enough, refund the money minus a small transaction fee. var paymentAmount = decimal.Parse(payment.Amount); if (GetMinimumLumensRequired() > paymentAmount) { AppSettings.Logger.Information( $"Received underfunded pament of {paymentAmount} lumens from {payment.From.AccountId}! Refunding..."); SendPayment( payment.From.AccountId, (paymentAmount - 0.0000200m).ToString("0.0000000"), "Err: http://bit.ly/2FW9r0m"); return; } AppSettings.Logger.Information("Connecting to the database to get the availale pool..."); var poolId = _poolRepository.GetAvailablePoolByPayer(payment.From.AccountId); if (poolId == 0) { poolId = _poolRepository.Add(new Pool { CreateDate = DateTime.Now }); AppSettings.Logger.Information($"Created new Pool {poolId}."); } var celebId = _poolRepository.GetAvailablePoolCelebrity(poolId); var ticketId = _ticketRepository.Add(new Ticket { PlayerAddress = payment.From.AccountId, CelebrityId = celebId, PoolId = poolId }); AppSettings.Logger.Information( "Created a new Ticket: \n " + $"Ticket ID: {ticketId} \n " + $"Player Address: {payment.From.AccountId} \n" + $"Celebrity ID: {celebId} \n" + $"Pool ID: {poolId}"); SendPayment( or.SourceAccount.AccountId, "0.0000001", $"Raffle Ticket Id: {ticketId}"); }