Ejemplo n.º 1
0
        public BatchUpdateTimeGroupsResponse Process(BatchUpdateTimeGroupsRequest request)
        {
            try
            {
                if (request.Services == null)
                {
                }

                var dao = new TimeGroupInfoDao();

                var data = dao.GetTimeGroupData();

                request.Services.ForEach(s => TimeGroupMapper.UpdateTimeGroupData(ref data, s));

                bool result = dao.UpdateTimeGroupData(data);

                return(new BatchUpdateTimeGroupsResponse()
                {
                    Token = request.Token, ResultType = ResultType.OK
                });
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(new BatchUpdateTimeGroupsResponse()
                {
                    Token = request.Token, ResultType = ResultType.Error
                });
            }
        }
Ejemplo n.º 2
0
        public GetAllTimeGroupsResponse Process(GetAllTimeGroupsRequest request)
        {
            try
            {
                var deviceDao = new TimeGroupInfoDao();
                var data      = deviceDao.GetTimeGroupData();
                var services  = TimeGroupMapper.BuildServices(data);

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