public ActionResult CreateTicket(CreateTicketModel model)
        {
            var calcStratFactory = _calcFact.create(model.Beverages_Domestics);
            var tick             = _tickServ.CreateTicket(model.ReservationId, model.FirstName, model.LastName, calcStratFactory);

            return(RedirectToAction("Ticket", new { id = tick.Id }));
        }
Example #2
0
        public ActionResult Index()
        {
            TicketHandler handler = new TicketHandler(new TicketDataAccess());

            // Retrieve the tickets list for the past 6 months only
            DateTime to   = DateTime.Now.AddDays(1);
            DateTime from = DateTime.Now.AddMonths(-6);
            IEnumerable <TicketTableModel> model = handler.GetTicketTableModel(from, to, 1, 10);
            CreateTicketModel createTicketModel  = new CreateTicketModel();

            // Priority dropdown list
            List <SelectListItem>        priorityList   = new List <SelectListItem>();
            IEnumerable <PriorityResult> priorityResult = handler.GetPriority();

            foreach (PriorityResult priority in priorityResult)
            {
                priorityList.Add(new SelectListItem {
                    Text = priority.Name, Value = priority.Id.ToString()
                });
            }
            createTicketModel.PriorityList = priorityList;

            // Owner dropdown list
            List <SelectListItem>    ownerList  = new List <SelectListItem>();
            IEnumerable <UserResult> userResult = handler.GetUsers();

            foreach (UserResult user in userResult)
            {
                ownerList.Add(new SelectListItem {
                    Text = user.Name, Value = user.Id.ToString()
                });
            }
            createTicketModel.OwnerList = ownerList;

            // Component list
            List <SelectListItem>         componentList   = new List <SelectListItem>();
            IEnumerable <ComponentResult> componentResult = handler.GetComponent();

            foreach (ComponentResult component in componentResult)
            {
                componentList.Add(new SelectListItem {
                    Text = component.Name, Value = component.Id.ToString()
                });
            }
            createTicketModel.ComponentList = componentList;

            // Estimate list
            List <SelectListItem> estimateList = new List <SelectListItem>();

            for (int i = 1; i <= 5; i++)
            {
                estimateList.Add(new SelectListItem {
                    Text = i + "MD", Value = i.ToString()
                });
            }
            createTicketModel.EstimateList = estimateList;

            ViewData["CreateTicketModel"] = createTicketModel;
            return(View(model));
        }
Example #3
0
        public async Task <IWriterResult> CreateTicket(CreateTicketModel model)
        {
            using (var context = DataContextFactory.CreateContext())
            {
                var user = await context.Users.Where(u => u.UserName == model.UserName).FirstOrDefaultNoLockAsync().ConfigureAwait(false);

                if (user == null)
                {
                    return(new WriterResult(false, $"User - {model.UserName} not found"));
                }

                var ticket = new SupportTicket {
                    User        = user,
                    QueueId     = model.QueueId,
                    Category    = model.Category,
                    Title       = model.Title,
                    Description = model.Description,
                    LastUpdate  = DateTime.UtcNow,
                    Created     = DateTime.UtcNow
                };

                context.SupportTicket.Add(ticket);
                await context.SaveChangesAsync().ConfigureAwait(false);

                return(new WriterResult(true, $"Ticket - {ticket.Title} Created"));
            }
        }
Example #4
0
        public ActionResult Create(CreateTicketModel ticketModel)
        {
            if (ModelState.IsValid)
            {
                var userId = this.User.Identity.GetUserId();

                var user = this.data.Users.GetById(userId);
                user.Points += 1;
                this.data.Users.Update(user);

                var ticket = new Ticket()
                {
                    AuthorId      = userId,
                    CategoryId    = ticketModel.CategoryId,
                    Description   = ticketModel.Description,
                    Priority      = ticketModel.Priority,
                    ScreenshotUrl = ticketModel.ScreenshotUrl,
                    Title         = ticketModel.Title
                };

                this.data.Tickets.Add(ticket);
                this.data.SaveChanges();

                return(RedirectToAction("Details", "Tickets", new { id = ticket.Id }));
            }

            ViewBag.Categories = new SelectList(this.data.Categories.All(), "Id", "Name", ticketModel.CategoryId);

            return(View(ticketModel));
        }
Example #5
0
        public bool CreateTicket(CreateTicketModel createTicketModel)
        {
            int loggedinId = TMS.Helper.AuthenticationHelper.CurrentLoginId();
            tblTicket _objtblTicket = (createTicketModel.ticketid == 0) ? new tblTicket() : db.tblTickets.Where(x => x.ticketid == createTicketModel.ticketid).FirstOrDefault();
            if (loggedinId != null)
            {
                _objtblTicket.CustomerId = loggedinId;
            }
            else
            {
                _objtblTicket.CustomerId = 0;
            }
            _objtblTicket.Categoryid = createTicketModel._categoryModel.CategoryId;
            _objtblTicket.Prority = createTicketModel.Prority;
            _objtblTicket.Subject = createTicketModel.Subject;
            _objtblTicket.Message = createTicketModel.Message;
            _objtblTicket.FullName = createTicketModel.FullName;
            _objtblTicket.Email = createTicketModel.Email;
            _objtblTicket.Phone = createTicketModel.Phone;
            _objtblTicket.CreateDate = DateTime.Now;
            _objtblTicket.ResolveStatus = false;
            _objtblTicket.ResolveDate = null;
            if (createTicketModel.ticketid == 0)
            {
                _objtblTicket.IsActive = true;
                db.tblTickets.Add(_objtblTicket);
            }
            db.SaveChanges();

            return true;
        }
        public int Create(CreateTicketModel model)
        {
            DATA.TicketType ticketType = (DATA.TicketType)Enum.Parse(typeof(DATA.TicketType), model.TicketType);
            if (!Enum.IsDefined(typeof(DATA.TicketType), ticketType))
            {
                throw new ServiceException("Invalid Ticket Type.");
            }

            DATA.TicketState ticketState = (DATA.TicketState)Enum.Parse(typeof(DATA.TicketState), model.TicketState);
            if (!Enum.IsDefined(typeof(DATA.TicketState), ticketState))
            {
                throw new ServiceException("Invalid Ticket State.");
            }

            if (string.IsNullOrEmpty(model.TicketTitle) || model.TicketTitle.Length < 5 || string.IsNullOrWhiteSpace(model.TicketTitle))
            {
                throw new ServiceException("The Ticket title should have no less than 5 characters.");
            }

            if (string.IsNullOrEmpty(model.TicketDescription) || model.TicketDescription.Length < 5)
            {
                throw new ServiceException("The description should have no less than 5 characters.");
            }

            if (_context.Tickets.Any(a => a.ProjectId == model.ProjectId && a.Title == model.TicketTitle))
            {
                throw new ServiceException($"This project already has ticket with title '{model.TicketTitle}'.");
            }

            DATA.Ticket ticket = new DATA.Ticket()
            {
                ProjectId      = model.ProjectId,
                Description    = model.TicketDescription,
                SubmissionDate = DateTime.Now,
                Title          = model.TicketTitle,
                Type           = ticketType,
                State          = ticketState,
                SubmitterId    = model.SubmitterId,
            };

            _context.Tickets.Add(ticket);

            if (!string.IsNullOrEmpty(model.FileName))
            {
                DATA.File file = new DATA.File
                {
                    Name     = model.FileName,
                    Content  = model.FileContent,
                    TicketId = ticket.Id,
                };

                _context.Files.Add(file);
            }


            _context.SaveChanges();

            return(ticket.Id);
        }
Example #7
0
        public ActionResult CreateTicket(CreateTicketModel model)
        {
            var tick = _tickServ.CreateTicket(model.ReservationId, model.FirstName, model.LastName, new Domain.DTO.StrategyDTO {
                IncludeTea = model.IncludeTea, IncludeCoffee = model.IncludeCoffee
            });

            return(RedirectToAction("Ticket", new { id = tick.Id }));
        }
Example #8
0
 public IActionResult Create(CreateTicketModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     _ticketsModifier.Add(model.ToDomainObject(User.GetUserId(), User.Identity.Name));
     return(RedirectToAction(nameof(Index)));
 }
        public async Task <JsonResult> CreateTicket(CreateTicketModel ticket, string tenantUid)
        {
            var origin = TenantHelper.GetCurrentTenantUrl(_contentService, tenantUid);
            var token  = Request.Cookies["token"].Value;

            var response = await _ticketService.CreateTicket(tenantUid, token, origin, ticket);

            return(Json(response));
        }
        // GET: Sprint
        public ActionResult Index()
        {
            SprintHandler handler = new SprintHandler(new SprintDataAccess());

            // Retrieve the sprint list for the past 6 months only
            DateTime to   = DateTime.Now.AddDays(1);
            DateTime from = DateTime.Now.AddMonths(-6);
            IEnumerable <SprintTableModel> model = handler.GetSprintTableModel(from, to, 1, 10);
            CreateTicketModel createTicketModel  = new CreateTicketModel();

            return(View(model));
        }
        public int CreateIssue(CreateTicketModel model)
        {
            CreateIssueResult result = new CreateIssueResult();

            result.Subject     = model.Subject;
            result.FixVersion  = model.FixVersion;
            result.Estimate    = model.Estimate;
            result.Description = model.Description;
            result.Priority    = model.Priority;
            result.Owner       = model.Owner;
            result.Repoter     = GetLoginUser();
            result.Component   = model.Component;
            return(_issueDataAccess.CreateIssue(result));
        }
        public IActionResult Create(TicketFormViewModel viewModel)
        {
            var model = new CreateTicketModel();

            viewModel.ProjectId = _projectService.GetByName(viewModel.ProjectName).Id;
            int userId = GetUserId();

            string path = viewModel.FilePath;

            if (!string.IsNullOrEmpty(path))
            {
                byte[] file     = System.IO.File.ReadAllBytes(path);
                string fileName = Path.GetFileName(path);

                model = new CreateTicketModel
                {
                    ProjectId         = viewModel.ProjectId,
                    TicketTitle       = viewModel.TicketTitle,
                    TicketDescription = viewModel.Description,
                    TicketState       = viewModel.TicketState.Replace(" ", ""),
                    TicketType        = viewModel.TicketType.Replace(" ", ""),
                    FileContent       = file,
                    FileName          = fileName,
                    SubmitterId       = userId
                };
            }

            model = new CreateTicketModel
            {
                ProjectId         = viewModel.ProjectId,
                TicketTitle       = viewModel.TicketTitle,
                TicketDescription = viewModel.Description,
                TicketState       = viewModel.TicketState.Replace(" ", ""),
                TicketType        = viewModel.TicketType.Replace(" ", ""),
                SubmitterId       = userId
            };

            try
            {
                _ticketService.Create(model);
            }
            catch (System.Exception e)
            {
                viewModel.ErrorMessage = e.Message;
                GetProjectsName(viewModel);
                return(View(nameof(Create), viewModel));
            }

            return(RedirectToAction(nameof(HomeController.Index), "Home"));
        }
        public async Task <ActionResult> CreateTicket(CreateTicketModel model)
        {
            if (!ModelState.IsValid)
            {
                return(CloseModalError("Error Creating Ticket"));
            }

            var result = await TicketWriter.CreateTicket(model);

            if (result.Success)
            {
                return(CloseModalSuccess(result.Message));
            }

            return(CloseModalError(result.Message));
        }
Example #14
0
        private static void CreateTicket(ITicketService ticketService, int?userId)
        {
            Console.Write("Enter project name: ");
            string projectName = Console.ReadLine();

            CreateTicketModel ticketModel = GetTicketModel(projectName);

            try
            {
                ticketService.Create(ticketModel);
            }
            catch (ServiceException se)
            {
                Console.WriteLine(se.Message);
            }
        }
        public async Task <CreateTicketModel> GetCreateTicket()
        {
            using (var context = DataContextFactory.CreateReadOnlyContext())
            {
                var createModel = new CreateTicketModel
                {
                    Category = SupportTicketCategory.General,
                    QueueId  = Constant.DEFAULT_QUEUE_ID
                };

                createModel.QueueDictionary = await context.SupportTicketQueue.ToDictionaryNoLockAsync(x => x.Id, x => x.Name).ConfigureAwait(false);

                createModel.CategoryDictionary = Enum.GetValues(typeof(SupportTicketCategory)).Cast <SupportTicketCategory>().ToDictionary(t => t, t => t.ToString());

                return(createModel);
            }
        }
Example #16
0
        public List<CreateTicketModel> GetAllTicketsByUser(int userId)
        {
            List<CreateTicketModel> getTicketList = new List<CreateTicketModel>();
            var getTickets = (from t in db.tblTickets
                                  join user in db.tblUsers on t.Categoryid equals user.userId
                                  join cat in db.tblCategories on t.Categoryid equals cat.CategoryId
                                  where t.CustomerId == userId
                                  select new { user.FirstName,t.Message, cat.CatgoryName, t.Prority }).ToList();
            foreach (var tList in getTickets)
            {

                CreateTicketModel obj = new CreateTicketModel();
                obj._categoryModel = new CategoryModel();
                obj.FullName = tList.FirstName;
                obj.Message = tList.Message;
                obj._categoryModel.CatgoryName = tList.CatgoryName;
                obj.Prority = tList.Prority;

                getTicketList.Add(obj);
            }
            return getTicketList;
        }
        public Task <Result <Guid> > Add(CreateTicketModel model, UserSurvey userSurvey = null, bool sendEmail = true)
        => Result <Guid> .TryAsync(async() =>
        {
            var isAdmin = generalDataService.User.Permissions.Any(p => p == (int)PermissionType.Admin);

            if (model.UserId == Guid.Empty)
            {
                model.UserId = generalDataService.User.Id;
            }

            var user = (await _membershipServiceApi.SystemUserApiService.Get(new BaseModel {
                Id = model.UserId
            }))
                       .Data;
            var ticket = new Ticket
            {
                Id               = Guid.NewGuid(),
                CreationDate     = DateTime.Now,
                UserId           = !isAdmin ? generalDataService.User.Id : user.Id,
                RepresentativeId = isAdmin ? generalDataService.User.Id : Guid.Empty,
                BlobId           = model.BlobId,
                Text             = model.Text,
                Title            = model.Title,
                Active           = true,
                Priority         = (byte)model.Priority
            };

            if (userSurvey != null)
            {
                ticket.UserSurvey.Add(userSurvey);
            }

            _repository.Add(ticket);
            await _repository.CommitAsync();


            return(Result <Guid> .Successful(ticket.Id));
        });
Example #18
0
        public async Task <ActionResult <IEnumerable <CreateTicketResultModel> > > CreateTicket([FromBody] CreateTicketModel createTicketModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            TicketDomainModel ticketDomainModel = new TicketDomainModel
            {
                ProjectionId = createTicketModel.ProjectionId,
                UserId       = createTicketModel.UserId
            };

            var listOFSeats = createTicketModel.seatModels;


            List <CreateTicketResultModel> createTicketResultModels = new List <CreateTicketResultModel>();
            CreateTicketResultModel        createTicketResultModel;

            foreach (var item in listOFSeats)
            {
                try
                {
                    ticketDomainModel.SeatId = item.Id;
                    createTicketResultModel  = await _ticketService.CreateNewTicket(ticketDomainModel);
                }
                catch (DbUpdateException e)
                {
                    ErrorResponseModel errorResponse = new ErrorResponseModel
                    {
                        ErrorMessage = e.InnerException.Message ?? e.Message,
                        StatusCode   = System.Net.HttpStatusCode.BadRequest
                    };

                    return(BadRequest(errorResponse));
                }

                if (!createTicketResultModel.IsSuccessful)
                {
                    ErrorResponseModel errorResponse = new ErrorResponseModel()
                    {
                        ErrorMessage = createTicketResultModel.ErrorMessage,
                        StatusCode   = System.Net.HttpStatusCode.BadRequest
                    };

                    return(BadRequest(errorResponse));
                }

                createTicketResultModels.Add(createTicketResultModel);
            }

            return(createTicketResultModels);
        }
        public int CreateIssue(CreateTicketModel model)
        {
            TicketHandler handler = new TicketHandler(new TicketDataAccess());

            return(handler.CreateIssue(model));
        }
Example #20
0
 public Task <Result <Guid> > Add(CreateTicketModel model)
 => _ticketBiz.Add(model);
        public async Task <IResponseContent> CreateTicket(string tenantUid, string token, string origin, CreateTicketModel ticket)
        {
            var payload = new JsonRpcFormat <JsonRpcFormatParams <CreateTicketModel> >()
            {
                Method = "CreateTicket",
                Params = new JsonRpcFormatParams <CreateTicketModel>()
                {
                    Model = ticket
                }
            };

            var response = await SubmitPostAsync(URL_API_TICKET, token, origin, payload, tenantUid);

            return(await AssertResponseContent <TicketResponseContent>(response));
        }
Example #22
0
 public ActionResult CreateTicketbyUser(CreateTicketModel _createTicketModel)
 {
     var result = _ticketmanager.CreateTicket(_createTicketModel);
     return RedirectToAction("CreateTicket");
 }
Example #23
0
        public ActionResult CreateTicket(CreateTicketModel model)
        {
            var tick = _tickServ.CreateTicket(model.ReservationId, model.FirstName, model.LastName);

            return(RedirectToAction("Ticket", new { id = tick.Id }));
        }
Example #24
0
 public bool CreateTicket(CreateTicketModel _createTicketModel)
 {
     return objCreateTicketRepo.CreateTicket(_createTicketModel);
 }