コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="apiBaseUrl"></param>
        /// <param name="primarySubscriptionKey"></param>
        /// <param name="secondarySubscriptionKey"></param>

        public FantasyNBAClient(string primarySubscriptionKey, string secondarySubscriptionKey)
        {
            Uri statApiBaseUrl       = NBAConfig.StateApiBaseUrl;
            Uri scoreApiBaseUrl      = NBAConfig.ScoreApiBaseUrl;
            Uri PbpApiBaseUrl        = NBAConfig.PbpApiBaseUrl;
            Uri ProjectionApiBaseUrl = NBAConfig.ProjectionApiBaseUrl;


            CommonServices         = new CommonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            SeasonServices         = new SeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            GameServices           = new GameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            NewsServices           = new NewsServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            StadiumsServices       = new StadiumsServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            StandingsServices      = new StandingsServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            OpponentSeasonServices = new OpponentSeasonServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            TeamServices           = new TeamServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            BoxScoreServices       = new BoxScoreServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            //DfsSlateServices = new DfsSlateServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            PlayerServices       = new PlayerServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            PlayerGameServices   = new PlayerGameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            TeamSeasonServices   = new TeamSeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            BoxScorePbpServices  = new BoxScorePbpServices(PbpApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);
            PlayerSeasonServices = new PlayerSeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey);

            DfsSlateServices   = new DfsSlateServices(ProjectionApiBaseUrl.AbsoluteUri, NBAConfig.ProjectionPrimarySubscriptionKey, NBAConfig.ProjectionSecondarySubscriptionKey);
            ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, NBAConfig.ProjectionPrimarySubscriptionKey, NBAConfig.ProjectionSecondarySubscriptionKey);
        }
コード例 #2
0
 public CreateFeedCollectionTests()
 {
     NewsRepoMock = new Mock <INewsRepository>();
     LoggerMock   = new Mock <ILogger <NewsServices> >();
     CacheMock    = new Mock <IMemoryCache>();
     Service      = new NewsServices(NewsRepoMock.Object, LoggerMock.Object, CacheMock.Object);
 }
コード例 #3
0
 public MainServices()
 {
     Users   = new UserServices();
     News    = new NewsServices();
     Albums  = new AlbumServices();
     Modules = new ModulesServices();
 }
コード例 #4
0
        public void UpdateGrid(string newType)
        {
            var page    = _grid.Pager;
            var newlist = newsServices.GetScfNewsByUser(CurrenUser)
                          .Where(x => x.Type == (byte)NewType.News &&
                                 (string.IsNullOrEmpty(newType) || x.Catelory.NameType == newType));

            newlist =
                newlist.Where(
                    x =>
                    string.IsNullOrEmpty(_grid.SearchCriteria.Header) ||
                    x.Header.Contains(_grid.SearchCriteria.Header));

            var totalRows = (int)newlist.Count();

            _grid.Pager.Init(totalRows);
            if (totalRows == 0)
            {
                _grid.Data = new List <NewsModel>();
                return;
            }

            var list     = newsServices.GetListPager(newlist, page.CurrentPage, page.PageSize);
            var listview = list.Select(x => NewsServices.ToModel(x));
            var viewData = new List <NewsModel>();

            foreach (var it in listview)
            {
                IEnumerable <ServerFile> files = freightServices.getServerFile(it.Id, new SSM.Models.NewsModel().GetType().ToString());
                it.FilesList = files != null?files.ToList() : new List <ServerFile>();

                viewData.Add(it);
            }
            _grid.Data = viewData;
        }
コード例 #5
0
 public NewsManagerViewModel()
 {
     _items    = new ObservableCollection <NewsViewModel>();
     _Services = new NewsServices();
     _Services.OnGetNewsListCompleted += new EventHandler <GetEntityListEventArgs <NewsModel> >(_Services_OnGetNewsListCompleted);
     LoadData();
 }
コード例 #6
0
 public NewsController(
     ILogger <NewsController> logger,
     NewsServices newsServices,
     IRequestUserProvider requestUserProvider)
 {
     _logger              = logger;
     _newsServices        = newsServices;
     _requestUserProvider = requestUserProvider;
 }
コード例 #7
0
        // GET: NewsManagement
        public ActionResult Index()
        {
            var homeInfos = NewsServices.GetSubjectAndContents();

            ViewBag.Subject      = homeInfos.Subject;
            ViewBag.HomeContents = homeInfos.Contents;

            return(View());
        }
コード例 #8
0
        internal async Task Initilize()
        {
            try
            {
                UserDialogs.Instance.ShowLoading();
                var result = await NewsServices.GetAllNews();

                var list = new List <NewsModel>();
                if (result.Success)
                {
                    int i = 2;
                    foreach (var item in result.data)
                    {
                        item.IssueDate = String.IsNullOrEmpty(item.IssueDate) ? "" : Convert.ToDateTime(item.IssueDate).ToString("dd MMM, yyyy");
                        //item.ImageURL = (ApiBase.HttpClientBase.BaseUrl + "NewsImages/" + item.ImageURL);

                        //var response = await ReportsService.Download(ApiBase.HttpClientBase.BaseUrl + "NewsImages/" + item.ImageURL);
                        var response = await ReportsService.DownloadFileBytes(ApiBase.HttpClientBase.BaseUrl + "api/News/GetNewsImage?newsimage=" + item.ImageURL);

                        if (response.FileContents.Length > 1)
                        {
                            item.ImageData = ImageSource.FromStream(() => new MemoryStream(response.FileContents));
                        }

                        item.IssueDate = "Published on " + item.IssueDate;

                        if (item.IsApproved)
                        {
                            //Background color scheme - even odd.
                            if ((i % 2) == 0)
                            {
                                item.BackgroundColor = "#6CAAD3";
                            }
                            else
                            {
                                item.BackgroundColor = "#D3C1A0";
                            }
                            i++;

                            list.Add(item);
                        }
                    }

                    NewsList = new ObservableCollection <NewsModel>(list);
                }
                else
                {
                    await UserDialogs.Instance.AlertAsync(result.Message);
                }
            }
            catch (Exception ex)
            {
                UserDialogs.Instance.HideLoading();
            }
            UserDialogs.Instance.HideLoading();
        }
コード例 #9
0
ファイル: NewsViewModel.cs プロジェクト: jjg0519/OA
 public NewsViewModel()
 {
     _Services = new NewsServices();
     if (_newsstate.IsNull())
     {
         _newsstate = _newsstatelist[0];
     }
     if (_newstype.IsNull())
     {
         _newstype = _newstypelist[0];
     }
 }
コード例 #10
0
        public ActionResult Index()
        {
            List <News> newlist = new NewsServices().GetNews();

            List <Category> categorylist = new CategoryServices().GetCategories();

            var model = new HomeIndexViewModel
            {
                Categories = categorylist,
                News       = newlist
            };

            return(View(model));
        }
コード例 #11
0
 public GroupMeberServices(
         IRepository<group_member> GroupMemberRepository,
         MemberServices _MemberServices, 
         GroupServices _GroupServices,
         PersonalMainPageServices _PersonalMainPageServices,
         NewsServices newsServices,
         IRepository<Group_Grade> GroupGradeRepository
    )
 {
     this.GroupMemberRepository = GroupMemberRepository;
     this._MemberServices = _MemberServices;
     this._GroupServices = _GroupServices;
     this._PersonalMainPageServices = _PersonalMainPageServices;
     this.newsServices = newsServices;
     this.GroupGradeRepository = GroupGradeRepository;
 }
コード例 #12
0
        public ActionResult SaveHomeInfo(string subject, string contents)
        {
            try
            {
                SchoolContext db      = new SchoolContext();
                string        logonId = Session["sIDNo"].ToString();
                var           user    = db.ApplicationUser.FirstOrDefault(x => x.LogonId == logonId);
                int           userId  = user.ID;

                NewsServices.UpdateHomeInfo(subject, contents, userId);

                return(Json(new { url = Url.Action("Index", "News") }));
            }
            catch (Exception ex)
            {
                return(Json(new { message = ex.Message, error = false }));
            }
        }
コード例 #13
0
        public void UpdateGridInfomation()
        {
            var orderField = new SSM.Services.SortField(_gridInfo.Pager.Sidx, _gridInfo.Pager.Sord == "asc");

            filter.SortField = orderField;
            var page = _gridInfo.Pager;
            //bool checkEdit = CurrenUser.IsEditNew(null) || CurrenUser.AllowRegulationApproval;
            //var grpermission = CurrenUser.UserGroups.Select(x => x.GroupId).ToList();
            var newlist = newsServices.GetScfNewsByUser(CurrenUser);

            newlist = newlist.Where(x => x.Type == (byte)NewType.Infomation &&
                                    (string.IsNullOrEmpty(filter.Keyworks) || x.Header.Contains(filter.Keyworks)) &&
                                    (filter.CategoryId == 0 || x.CateloryId == filter.CategoryId) &&
                                    (x.IsApproved != filter.IsPending) &&
                                    (filter.GroupId == 0 || x.GroupAccessPermissions.Any(g => g.GroupId == filter.GroupId))
                                    );
            newlist = newlist.OrderBy(orderField);
            var totalRows = (int)newlist.Count();

            ViewBag.SearchingMode = filter ?? new NewSearchModel();
            ViewBag.AllGroup      = groupService.GetAll(x => x.IsActive);
            _gridInfo.Pager.Init(totalRows);
            if (totalRows == 0)
            {
                _gridInfo.Data = new List <NewsModel>();
                return;
            }

            var list     = newsServices.GetListPager(newlist, page.CurrentPage, page.PageSize);
            var listview = list.Select(x => NewsServices.ToModel(x));
            var viewData = new List <NewsModel>();

            foreach (var it in listview)
            {
                IEnumerable <ServerFile> files = freightServices.getServerFile(it.Id, new SSM.Models.NewsModel().GetType().ToString());
                it.FilesList = files != null?files.ToList() : new List <ServerFile>();

                viewData.Add(it);
            }
            _gridInfo.Data = viewData;
        }
コード例 #14
0
        public ServiceManager()
        {
            this.googleServices = new GoogleServices();
            this.googleServices.LatestCalendarEvent += (sender, calendar) => { this.CalendarStatusEvent?.Invoke(this, calendar); };
            this.googleServices.LatestEmailsEvent   += (sender, mail) => { this.LatestEmailsEvent?.Invoke(this, mail); };

            this.googleMapsServices = new GoogleMapsServices();
            this.googleMapsServices.TrafficUpdateEvent += (sender, traffic) => { this.TrafficUpdateEvent?.Invoke(this, traffic); };

            this.newsServices = new NewsServices();
            this.newsServices.LatestNewsEvent += (sender, newsmodel) => { this.LatestNewsEvent?.Invoke(this, newsmodel); };

            this.weatherServices = new WeatherServices(this.lat, this.logt);
            this.weatherServices.WeatherUpdateEvent += (sender, weather) => { this.WeatherUpdateEvent?.Invoke(this, weather); };

            this.quoteServices = new QuoteServices();
            this.quoteServices.QuoteUpdateEvent += (sender, quote) => { this.QuoteUpdateEvent?.Invoke(this, quote); };

            this.dateTimeServices = new DateTimeServices();
            this.dateTimeServices.TimerUpdateEvent += (sender, time) => { this.TimerUpdateEvent?.Invoke(this, time); };
        }
コード例 #15
0
 public HomeController()
 {
     _newsServices     = new NewsServices();
     _categoryServices = new CategoryServices();
 }
コード例 #16
0
 public MemberNewsController()
 {
     ns  = new NewsServices();
     mns = new MemberNewsServices();
 }
コード例 #17
0
 public NewsController()
 {
     _NewsServices         = new NewsServices(_unitOfWork);
     _NewsCategoryServices = new NewsCategoryServices(_unitOfWork);
 }
コード例 #18
0
ファイル: PopupNews.cs プロジェクト: jjg0519/OA
 public PopupNews()
 {
     _newsServices = new NewsServices();
     _newsServices.OnGetNewsListCompleted += new EventHandler <GetEntityListEventArgs <SAAS.Platform.Model.NewsModel> >(_newsServices_OnGetNewsListCompleted);
 }
コード例 #19
0
 public MyAdminNewsController()
 {
     ns = new NewsServices();
 }