Example #1
0
        public RequestModel findRequestById(int requestId)
        {
            Request efRequest = context.Requests.Find(requestId);

            if (efRequest == null)
            {
                //return null;
                throw new ItemNotFoundException();
            }

            RequestModel request = new RequestModel(efRequest, efRequest.Department, ItemGetter._getPendingOrUpdatedItemsForRequest(efRequest));

            return(request);
        }
Example #2
0
        public RequestModelCollection getAllRequestsOfDepartment(string departmentCode)
        {
            List <Request> all = context.Requests
                                 .Where(x => x.deleted != "Y" &&
                                        x.dept_code == departmentCode
                                        ).ToList();

            if (all.Count == 0)
            {
                throw new ItemNotFoundException();
            }
            else
            {
                List <RequestModel> records = all.Select(x => new RequestModel(x, x.Department, ItemGetter._getPendingOrUpdatedItemsForRequest(x))).ToList();

                return(new RequestModelCollection(records));
            }
        }
Example #3
0
        public RequestModelCollection getAllPendingRequestsOfDepartment(string departmentCode)
        {
            List <Request> pending = context.Requests
                                     .Where(x => x.deleted != "Y" &&
                                            (x.current_status == RequestStatus.PENDING || x.current_status == RequestStatus.UPDATED) &&
                                            x.dept_code == departmentCode
                                            ).ToList();

            if (pending.Count == 0)
            {
                throw new ItemNotFoundException();
            }
            else
            {
                List <RequestModel> records = pending.Select(x => new RequestModel(x, ItemGetter._getPendingOrUpdatedItemsForRequest(x))).ToList();

                return(new RequestModelCollection(records));
            }
        }