Esempio n. 1
0
        public async Task TurnoverWithDays(int id)
        {
            await CheckPermission();

            var service = new ScheduleCycleService(_logger, _mapper);
            await service.DeleteTurnoverWithDays(id);
        }
Esempio n. 2
0
        public async Task <JsonResult> GetRoutesWithTimeline(int turnoverId, int skip, int limit)
        {
            await CheckPermission();

            var service = new ScheduleCycleService(_logger, _mapper);
            var result  = await service.GetRoutesWithTimeline(turnoverId, skip, limit);

            return(Json(result));
        }
Esempio n. 3
0
        public async Task <JsonResult> TurnoverWithDays(int skip, int limit)
        {
            await CheckPermission();

            var service = new ScheduleCycleService(_logger, _mapper);
            var result  = await service.GetTurnoversWithDays(skip, limit);

            return(Json(result));
        }
Esempio n. 4
0
        public async Task <JsonResult> AddOrUpdate([FromBody] InspectionRoute input)
        {
            await CheckPermission();

            var timeLineTimeStart = DateTime.MinValue.AddHours(3);

            if (input.Start < timeLineTimeStart && input.End > timeLineTimeStart)
            {
                throw new ValidationException(Error.IncorrectCorrectTimeRange);
            }
            var service = new ScheduleCycleService(_logger, _mapper);

            return(Json(await service.AddOrUpdateInspectionOnRoute(input)));
        }
Esempio n. 5
0
        public async Task <JsonResult> TripsByTurnoverIdAndDays(int turnoverId, int routeId)
        {
            await CheckPermission();

            if (turnoverId == 0 || routeId == 0)
            {
                throw new ValidationException(Error.NotFilledOptionalField);
            }

            var service = new ScheduleCycleService(_logger, _mapper);
            var result  = await service.GetTripsByTurnoverIdAndDays(turnoverId, routeId);

            return(Json(result));
        }
Esempio n. 6
0
        public async Task <JsonResult> TurnoverWithDays([FromBody] TurnoverWithDays input)
        {
            await CheckPermission();

            if (input.Days == null || input.Days.Count == 0)
            {
                throw new ValidationException("Не заполнены дни циклового графика");
            }
            var service = new ScheduleCycleService(_logger, _mapper);

            if (input.Id != 0)
            {
                return(Json(await service.UpdateTurnoverWithDays(input)));
            }
            return(Json(await service.AddTurnoverWithDays(input)));
        }