Ejemplo n.º 1
0
        public object Post(Ticket request)
        {
            ApiUser hdUser = ApiUser.getUser(base.Request);
            int _newTktId = Ticket.CreateNew(hdUser, request);
            if (_newTktId > 0)
            {
                if (request.Users != null)
                    foreach (TicketAssignee _ta in request.Users) Ticket.AttachAlternateUser(hdUser, _newTktId, _ta.UserId);

                if (request.Technicians != null)
                    foreach (TicketAssignee _ta in request.Technicians) Ticket.AttachAlternateTechnician(hdUser, _newTktId, _ta.UserId);

                return new HttpResult(new Ticket(hdUser.OrganizationId, hdUser.DepartmentId, _newTktId, hdUser.InstanceId)) { StatusCode = HttpStatusCode.Created };
            }

            CustomNames _cNames = CustomNames.GetCustomNames(hdUser.OrganizationId, hdUser.DepartmentId);
            string errMsg = "Ticket Not Saved. ";
            switch (_newTktId)
            {
                case -1:
                    errMsg += "Input level is not setup for this class.";
                    break;
                case -2:
                    errMsg += "No routing options are enabled. No route found. Must choose " + _cNames.Technician.AbbreviatedSingular + " specifically.";
                    break;
                case -3:
                    errMsg += "No Route Found. Routing configuration must be modified.";
                    break;
                case -4:
                    errMsg += "Level does not exists.";
                    break;
                case -5:
                    errMsg += "Route found but " + _cNames.Technician.AbbreviatedSingular + " could not be returned. Please check routing order for errors.";
                    break;
            }
            throw new HttpError(HttpStatusCode.NotFound, new ArgumentException(errMsg));
        }
Ejemplo n.º 2
0
        public static Ticket GetArticle(Guid organizationId, int departmentId, int articleId, Guid InstanceId)
        {
            Ticket article = new Ticket(organizationId, departmentId, articleId, InstanceId);

            return(article);
        }