public BatchUpdateTimeSegmentsResponse Process(BatchUpdateTimeSegmentsRequest request)
        {
            try
            {
                if (request.Services == null)
                {
                }

                var dao = new TimeSegmentInfoDao();

                var data = dao.GetTimeSegmentData();

                request.Services.ForEach(s => TimeSegmentMapper.UpdateTimeSegmentData(ref data, s));

                bool result = dao.UpdateTimeSegmentData(data);

                return(new BatchUpdateTimeSegmentsResponse()
                {
                    Token = request.Token, ResultType = ResultType.OK
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(new BatchUpdateTimeSegmentsResponse()
                {
                    Token = request.Token, ResultType = ResultType.Error
                });
            }
        }
예제 #2
0
        public GetAllTimeSegmentsResponse Process(GetAllTimeSegmentsRequest request)
        {
            try
            {
                var deviceDao = new TimeSegmentInfoDao();
                var data      = deviceDao.GetTimeSegmentData();
                var services  = TimeSegmentMapper.BuildServices(data);

                return(new GetAllTimeSegmentsResponse()
                {
                    Token = request.Token, ResultType = ResultType.OK, Services = services
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(new GetAllTimeSegmentsResponse()
                {
                    Token = request.Token, ResultType = ResultType.Error
                });
            }
        }