public async Task <InformationResponse <IEnumerable <ViewerPanelResponse>, int> > GetProfileViewPanel(int userId, SystemSession session)
        {
            var serviceRequest = new ProfileView
            {
                UserId = userId
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.profileViewPanel(serviceRequest, session.GetSession())).ConfigureAwait(false);

            var data = response.ProfileViews.Select(x => new ViewerPanelResponse
            {
                UserId      = x.UserId,
                UserTypeId  = (SystemUserType)x.UserTypeId,
                UserName    = x.Username,
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                Image       = x.Picture,
                Observed    = x.Observed,
                Title       = x.Title,
                ViewedDate  = Convert.ToDateTime(x.ViewDate),
                Position    = x.PositionName,
                ViewerCount = x.ViewersCount
            });
            var result = new InformationResponse <IEnumerable <ViewerPanelResponse>, int>
            {
                Page        = data,
                Information = response.TotalTypes
            };

            return(result);
        }
        public async Task <InformationResponse <IEnumerable <ViewerPanelResponse>, int> > GetProfileViewPanel(int userId)
        {
            var totalTypes = new ObjectParameter("TOTALTYPES", typeof(int));
            var response   = await Task.Factory.StartNew(() => Context.PROC_PROFILE_VIEW_PANEL(userId, totalTypes).ToList()).ConfigureAwait(false);

            var data = response.Select(x => new ViewerPanelResponse
            {
                UserId      = x.UserId,
                UserTypeId  = (SystemUserType)x.UserTypeID,
                UserName    = x.UserName,
                FirstName   = x.FirstName,
                LastName    = x.LastName,
                Image       = x.Picture,
                Observed    = x.Observed,
                Title       = x.Title,
                ViewedDate  = x.ViewedDate,
                Position    = x.POSITIONNAME,
                ViewerCount = x.VIEWERSCOUNT.GetValueOrDefault()
            });
            var result = new InformationResponse <IEnumerable <ViewerPanelResponse>, int>
            {
                Page        = data,
                Information = Convert.ToInt32(totalTypes.Value)
            };

            return(result);
        }
示例#3
0
 public ArduinoLadderCompiler(InformationResponse information)
 {
     if (information == null)
     {
         throw new ArgumentNullException("information");
     }
     this.m_information = information;
 }
        public async Task <InformationResponse <IEnumerable <ViewSummaryResponse>, int> > GetProfileViewSummary(PaginatedRequest <int> request)
        {
            var hasNextPage = new ObjectParameter("HASNEXTPAGE", typeof(bool));
            var totalViews  = new ObjectParameter("TOTALVIEWCOUNT", typeof(int));
            var response    = await Task.Factory.StartNew(() => Context.PROC_PROFILE_VIEW_SUMMARY(request.UserId, request.Data, request.PageIndex, request.PageSize, hasNextPage, totalViews).ToList()).ConfigureAwait(false);

            var data = response.Select(x => new ViewSummaryResponse
            {
                TypeId       = x.TYPEID,
                Name         = x.NAME,
                ViewCount    = x.TOTALVIEWS,
                NewViewCount = x.NEWVIEWS,
                LastViewed   = x.LASTVIEWED.GetValueOrDefault()
            });
            var result = new InformationResponse <IEnumerable <ViewSummaryResponse>, int>
            {
                Page        = data,
                Information = Convert.ToInt32(totalViews.Value)
            };

            return(result);
        }
        public ArduinoRuntimeProxy(
            IRuntimeType runtimeType,
            string comPort,
            Lazy <IRuntimeService> runtimeService,
            IMessagingService messagingService)
        {
            if (runtimeType == null)
            {
                throw new ArgumentNullException("runtimeType");
            }
            if (runtimeService == null)
            {
                throw new ArgumentNullException("runtimeService");
            }
            if (messagingService == null)
            {
                throw new ArgumentNullException("messagingService");
            }
            this.Type                     = runtimeType;
            this.m_runtimeService         = runtimeService;
            this.m_arduinoRuntimeProtocol = new ArduinoRuntimeProtocol(comPort);
            this.messagingService         = messagingService;

            this.m_runtimeService.Value.SignalChanged += (s) =>
            {
                Console.WriteLine("Signal {0} changed. Forced: {1}, Forced Value: {2}",
                                  s.SignalName.ToString(),
                                  s.Forced.BoolValue,
                                  s.ForcedValue.Value.ToString());
            };

            this.m_arduinoRuntimeProtocol.Connect();
            this.m_information = this.m_arduinoRuntimeProtocol.GetInformation();
            this.m_arduinoRuntimeProtocol.Disconnect();
            this.m_signalTable = new SignalTable(this.m_information);
            this.m_compiler    = new ArduinoLadderCompiler(this.m_information);
        }
        public async Task<InformationResponse<IEnumerable<ViewerPanelResponse>, int>> GetProfileViewPanel(int userId, SystemSession session)
        {
            var serviceRequest = new ProfileView
            {
                UserId = userId
            };

            var response = await Task.Factory.StartNew(() => Client.UserService.profileViewPanel(serviceRequest, session.GetSession())).ConfigureAwait(false);
            var data = response.ProfileViews.Select(x => new ViewerPanelResponse
            {
                UserId = x.UserId,
                UserTypeId = (SystemUserType)x.UserTypeId,
                UserName = x.Username,
                FirstName = x.FirstName,
                LastName = x.LastName,
                Image = x.Picture,
                Observed = x.Observed,
                Title = x.Title,
                ViewedDate = Convert.ToDateTime(x.ViewDate),
                Position = x.PositionName,
                ViewerCount = x.ViewersCount
            });
            var result = new InformationResponse<IEnumerable<ViewerPanelResponse>, int>
            {
                Page = data,
                Information = response.TotalTypes
            };
            return result;
        }