Ejemplo n.º 1
0
        public ActionResult Edit(int publisherID)
        {
            InitLists();
            PublisherHelper helper = new PublisherHelper();

            return(View(helper.GetPublisher(publisherID)));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(int publisherID)
        {
            PublisherHelper helper = new PublisherHelper();

            helper.Delete(publisherID);
            return(Content("ok"));
        }
Ejemplo n.º 3
0
        public ActionResult ChangePublisherStatus(PublisherStatus status, int id)
        {
            string          currentUserId = User.Identity.GetUserId();
            PublisherHelper helper        = new PublisherHelper();

            return(Json(helper.ChangePublisherStatus(status, id, currentUserId)));
        }
Ejemplo n.º 4
0
        public ActionResult Edit(Publisher publisher)
        {
            InitLists();
            PublisherHelper helper = new PublisherHelper();

            publisher.UpdaterId = User.Identity.GetUserId();
            helper.Update(publisher);
            return(Content("ok"));
        }
Ejemplo n.º 5
0
        public ActionResult GetFirstPublisher(string countryCode, PublisherStatus status)
        {
            //TODO move this to user settings, don't make during search!!
            UserSettingsHelper usHelper = new UserSettingsHelper();

            usHelper.Update(User.Identity.GetUserId(), countryCode);
            //TODO move this to user settings, don't make during search!!
            PublisherHelper helper    = new PublisherHelper();
            Publisher       publisher = helper.GetFirstPublisherByCountryAndStatus(countryCode, status);

            return(Json(GetPublisherEmail(publisher), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        private void Binding()
        {
            _viewModel = new PublisherPickupViewModel(AppConfig.ShowAllPublisher);

            txtPickupName.Text             = "chọn báo";
            txtGuid.Text                   = AppConfig.ShowAllPublisher ? "Chạm vào từng báo để cài hay gỡ..." : "Chỉ đang hiện những báo chưa cài. Chạm vào từng báo để cài hay gỡ...";
            firstNextIcon.Visibility       = System.Windows.Visibility.Visible;
            txtStats.Text                  = PublisherHelper.GetAllStatsString();
            this.llmsPublisher.ItemsSource = _viewModel.PublisherBankViewModels;

            llmsPublisher.ScrollTo <Guid>(_lastPublisherId);
        }
 /// <summary>
 /// Notify page change
 /// </summary>
 /// <param name="page"></param>
 public async Task PagerPageChangedAsync(int page)
 {
     CommonHelper.Spinner = "loader-big";
     StateHasChanged();
     if (!string.IsNullOrEmpty(NodeList.ContinuationToken) && page > PagedNodeList.PageCount)
     {
         NodeList = await PublisherHelper.PublishedAsync(EndpointId, true);
     }
     PagedNodeList = NodeList.GetPaged(page, CommonHelper.PageLength, null);
     NavigationManager.NavigateTo(NavigationManager.BaseUri + "PublishedNodes/" + page + "/" + EndpointId);
     CommonHelper.Spinner = string.Empty;
     StateHasChanged();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// OnAfterRenderAsync
        /// </summary>
        /// <param name="firstRender"></param>
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                NodeList = await PublisherHelper.PublishedAsync(EndpointId);

                Page                 = "1";
                PagedNodeList        = NodeList.GetPaged(int.Parse(Page), CommonHelper.PageLength, NodeList.Error);
                CommonHelper.Spinner = string.Empty;
                CommonHelper.CheckErrorOrEmpty(PagedNodeList, ref _tableView, ref _tableEmpty);
                StateHasChanged();
            }
        }
Ejemplo n.º 9
0
        public ActionResult Get(IDataTablesRequest request, PublisherStatus publisherStatuses, bool isPotentiallyCancelled, List <string> countries, List <int> categories, int minEmailAmount)
        {
            PublisherHelper helper = new PublisherHelper();

            var filteredData = helper.GetPublishersWithStats(request.Start, request.Length, request.Search.Value, publisherStatuses, isPotentiallyCancelled, countries, categories, minEmailAmount);

            var response = DataTablesResponse.Create(request, helper.GetTotalRecords(),
                                                     helper.GetTotalFilteredRecords(request.Search.Value, publisherStatuses, isPotentiallyCancelled, countries, categories, minEmailAmount),
                                                     filteredData);

            // Easier way is to return a new 'DataTablesJsonResult', which will automatically convert your
            // response to a json-compatible content, so DataTables can read it when received.
            return(new DataTablesJsonResult(response, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// OnAfterRenderAsync
        /// </summary>
        /// <param name="firstRender"></param>
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                NodeList = await PublisherHelper.PublishedAsync(EndpointId, true);

                Page                 = "1";
                PagedNodeList        = NodeList.GetPaged(int.Parse(Page), CommonHelper.PageLength, NodeList.Error);
                CommonHelper.Spinner = string.Empty;
                CommonHelper.CheckErrorOrEmpty(PagedNodeList, ref _tableView, ref _tableEmpty);
                StateHasChanged();
                PublishEvent = await PublisherServiceEvents.NodePublishSubscribeByEndpointAsync(EndpointId,
                                                                                                samples => InvokeAsync(() => GetPublishedNodeData(samples)));
            }
        }
Ejemplo n.º 11
0
        protected Publisher GetPublisher(int?publisherId)
        {
            Publisher       result = new Publisher();
            PublisherHelper helper = new PublisherHelper();

            if (!publisherId.HasValue)
            {
                UserSettingsHelper usHelper     = new UserSettingsHelper();
                string             userLanguage = usHelper.GetUserLanguage(User.Identity.GetUserId());
                result = helper.GetFirstPublisherByCountryAndStatus(userLanguage, PublisherStatus.None);
            }
            else
            {
                result = helper.GetPublisher(publisherId.Value);
            }
            return(result);
        }
Ejemplo n.º 12
0
        private void Binding()
        {
            var publisherId = NavigationContext.QueryString.GetQueryStringToGuid("publisherId");

            if (default(Guid).Equals(publisherId))
            {
                return;
            }

            _viewModel = new FeedPickupViewModel(publisherId);

            txtPublisherName.Text     = "chọn mục trong  " + _viewModel.Name;
            firstNextIcon.Visibility  = System.Windows.Visibility.Visible;
            txtStats.Text             = PublisherHelper.GetStatsString(publisherId);
            this.llmsFeed.ItemsSource = _viewModel.FeedBankViewModels;

            llmsFeed.ScrollTo <Guid>(_lastFeedId);
        }
Ejemplo n.º 13
0
        public ActionResult Create(Publisher publisher)
        {
            string          currentUserId = User.Identity.GetUserId();
            PublisherHelper helper        = new PublisherHelper();

            publisher.Status    = PublisherStatus.None;
            publisher.CreatorId = currentUserId;
            publisher.UpdaterId = currentUserId;
            try
            {
                helper.AddPublisher(publisher);
            }
            catch (Exception ex)
            {
                throw;
                return(View(publisher));
            }
            return(Content("ok"));
        }
Ejemplo n.º 14
0
        private void Binding()
        {
            var publisherId = NavigationContext.QueryString.GetQueryStringToGuid("publisherId");

            if (default(Guid).Equals(publisherId))
            {
                return;
            }

            if (_pageNumber == 0)
            {
                _pageNumber = 1;
            }

            _viewModel.Initialize(publisherId);
            _viewModel.LoadPage(_pageNumber);

            txtPublisherName.Text        = _viewModel.Name;
            firstNextIcon.Visibility     = System.Windows.Visibility.Visible;
            txtStats.Text                = PublisherHelper.GetStatsString(_viewModel.Id);
            this.llsFeedList.ItemsSource = _viewModel.FeedViewModels;

            llsFeedList.ScrollTo <Guid>(_lastFeedId);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// loads the information of a book from an online source
        /// </summary>
        public Book AutoLoadDNB(string isbn)
        {
            Book book = new Book();

            book.BookIsbn = isbn;
            if (IsbnValidated(isbn))
            {
                htmlData = Regex.Replace(htmlData, @"\t|\n|\r", "");
                htmlData = Regex.Replace(htmlData, "<a href=.*?>", "");
                var genreName = GetGenreNeu().Replace("[", "(").Replace("]", ")");
                if (!genreName.Equals(""))
                {
                    GenreHelper helper = new GenreHelper();
                    Genre       genre  = new Genre();
                    if (helper.FindIdByName(genreName) < 0)
                    {
                        genre.GenreName = genreName;
                        genre.Add();
                    }
                    genre          = new Genre(helper.FindIdByName(genreName));
                    book.BookGenre = genre;
                }

                var titel = GetTitelNeu().Replace("[", "(").Replace("]", ")");
                if (!titel.Equals(""))
                {
                    book.BookTitle = titel;
                }

                var authors = GetAutorNeu();
                foreach (string s in authors)
                {
                    Author       author = new Author();
                    AuthorHelper helper = new AuthorHelper();
                    if (helper.FindIdByName(s) < 0)
                    {
                        author.AuthorName = s;
                        author.Add();
                    }
                    author = new Author(helper.FindIdByName(s));
                    book.BookAuthors.Add(author);
                }

                var ausgabe = GetAusgabeNeu().Replace("[", "(").Replace("]", ")");
                if (!ausgabe.Equals(""))
                {
                    book.BookEdition = ausgabe;
                }

                var publisherName = GetVerlagNeu().Replace("[", "(").Replace("]", ")");
                if (!publisherName.Equals(""))
                {
                    PublisherHelper helper    = new PublisherHelper();
                    Publisher       publisher = new Publisher();
                    if (helper.FindIdByName(publisherName) < 0)
                    {
                        publisher.PublisherName = publisherName;
                        publisher.Add();
                    }
                    publisher          = new Publisher(helper.FindIdByName(publisherName));
                    book.BookPublisher = publisher;
                }

                var jahr = GetDatumNeu();
                if (!jahr.Equals(""))
                {
                    try
                    {
                        DateTime date = new DateTime(int.Parse(jahr), 1, 1);
                        book.BookDatePublication = date;
                    }
                    catch
                    {
                        book.BookDatePublication = DateTime.UtcNow;
                    }
                }

                var preis = GetPreisNeu().Replace('.', ',');
                if (!preis.Equals(""))
                {
                    book.BookPrice = decimal.Parse(preis);
                }

                var languageName = GetSpracheNeu().Replace("[", "(").Replace("]", ")");
                if (!languageName.Equals(""))
                {
                    LanguageHelper helper   = new LanguageHelper();
                    Language       language = new Language();
                    if (helper.FindIdByName(languageName) < 0)
                    {
                        language.LanguageName = languageName;
                        language.Add();
                    }
                    language          = new Language(helper.FindIdByName(languageName));
                    book.BookLanguage = language;
                }

                var image = GetPictureNeu(isbn);
                if (image != null)
                {
                    book.BookImage = image;
                }
                return(book);
                //MetroMessageBox.Show(this, "Das Buch \"" + tb_Titel.Text + "\" wurde erfolgreich geladen!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                return(book);
                //AutoLoadBuecherNachISBN();
            }
        }
Ejemplo n.º 16
0
        public ActionResult GetConfirmedSubscriptionsChartData()
        {
            PublisherHelper helper = new PublisherHelper();

            return(Json(helper.GetConfirmedSubscriptionsChart(), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 17
0
        public ActionResult Details(int publisherID)
        {
            PublisherHelper helper = new PublisherHelper();

            return(View(helper.GetPublisher(publisherID)));
        }
Ejemplo n.º 18
0
        private void BindingNavBarForPrevFeedPage()
        {
            var navBarViewModel = new NavBarViewModel();
            var item            = _itemContainer.AllItemViewModels[_currentIndex];

            var subscribedPublisher = _feedManager.GetSubscribedPublishers();

            subscribedPublisher.Target.ForEach(p =>
            {
                navBarViewModel.FirstBrothers.Add(new Brother()
                {
                    Id          = p.Id.ToString(),
                    Name        = p.Name,
                    ImageUri    = p.ImageUri.ToString().StartsWith("/") ? p.ImageUri : new Uri("/" + p.ImageUri.ToString(), UriKind.Relative),
                    Stats       = PublisherHelper.GetStatsString(p.Id),
                    Selected    = p.Id.Equals(_itemContainer.Publisher.Id),
                    PostAction  = ViewModels.PostAction.Navigation,
                    NavigateUri = new Uri(string.Format("/FeedPage.xaml?publisherId={0}&feedId={1}", p.Id, p.FeedIds[0]), UriKind.Relative)
                });
            });

            navBarViewModel.FirstBrothers.Add(new Brother()
            {
                Id          = string.Empty,
                Name        = string.Empty,
                ImageUri    = new Uri("/Images/publishers/install.png", UriKind.Relative),
                Stats       = "cài thêm hoặc gỡ bớt báo",
                Selected    = false,
                PostAction  = PostAction.Navigation,
                NavigateUri = new Uri("/PublisherPickupPage.xaml", UriKind.Relative)
            });

            _itemContainer.Publisher.FeedIds.ForEach(f =>
            {
                var feedResult = _feedManager.GetSubscribedFeed(f);
                if (feedResult.HasError)
                {
                    return;
                }

                navBarViewModel.SecondBrothers.Add(new Brother()
                {
                    Id          = f.ToString(),
                    Name        = feedResult.Target.Name,
                    ImageUri    = null,
                    Stats       = FeedHelper.GetStatsString(f),
                    Selected    = f.Equals(_itemContainer.Id),
                    PostAction  = ViewModels.PostAction.Navigation,
                    NavigateUri = new Uri(string.Format("/FeedPage.xaml?publisherId={0}&feedId={1}", _itemContainer.Publisher.Id, f), UriKind.Relative)
                });
            });

            if (_itemContainer.Publisher.FeedIds.Count > 1)
            {
                navBarViewModel.SecondBrothers.Add(new Brother()
                {
                    Id          = string.Empty,
                    Name        = "Cài thêm chuyên mục",
                    ImageUri    = null,
                    Stats       = "hoặc gỡ bớt chuyên mục không thích",
                    Selected    = false,
                    PostAction  = PostAction.Navigation,
                    NavigateUri = new Uri("/FeedPickupPage.xaml?publisherId=" + _itemContainer.Publisher.Id.ToString(), UriKind.Relative)
                });
            }

            NavBar.BindingNavBar(navBarViewModel);
            NavBar.Navigation = ((uri, id) =>
            {
                DisposeAll();
                if (!id.Equals(_itemContainer.Publisher.Id))
                {
                    UserBehaviorManager.Instance.Log(UserAction.PubEnter, _itemContainer.Publisher.Id.ToString());
                }
                if (!id.Equals(_itemContainer.Id))
                {
                    UserBehaviorManager.Instance.Log(UserAction.FeedEnter, _itemContainer.Id.ToString());
                }

                NavigationService.Navigate(uri);
            });
            NavBar.NavigateHome = (() => this.BackToMainPage());
        }
Ejemplo n.º 19
0
        private void BindingNavBar()
        {
            var navBarViewModel = new NavBarViewModel();

            var subscribedPublisher = _feedManager.GetSubscribedPublishers();

            subscribedPublisher.Target.ForEach(p =>
            {
                navBarViewModel.FirstBrothers.Add(new Brother()
                {
                    Id          = p.Id.ToString(),
                    Name        = p.Name,
                    ImageUri    = p.ImageUri.ToString().StartsWith("/") ? p.ImageUri : new Uri("/" + p.ImageUri.ToString(), UriKind.Relative),
                    Stats       = PublisherHelper.GetStatsString(p.Id),
                    Selected    = p.Id.Equals(_viewModel.Publisher.Id),
                    PostAction  = ViewModels.PostAction.Binding,
                    BindingData = new BindingData()
                    {
                        PublisherId = p.Id,
                        FeedId      = p.FeedIds[0],
                        CategoryId  = default(Guid)
                    }
                });
            });

            navBarViewModel.FirstBrothers.Add(new Brother()
            {
                Id          = string.Empty,
                Name        = string.Empty,
                ImageUri    = new Uri("/Images/publishers/install.png", UriKind.Relative),
                Stats       = "cài thêm hoặc gỡ bớt báo",
                Selected    = false,
                PostAction  = PostAction.Navigation,
                NavigateUri = new Uri("/PublisherPickupPage.xaml", UriKind.Relative)
            });

            _currentPublisher.FeedIds.ForEach(f =>
            {
                var feedResult = _feedManager.GetSubscribedFeed(f);
                if (feedResult.HasError)
                {
                    return;
                }

                navBarViewModel.SecondBrothers.Add(new Brother()
                {
                    Id          = f.ToString(),
                    Name        = feedResult.Target.Name,
                    ImageUri    = null,
                    Stats       = FeedHelper.GetStatsString(f),
                    Selected    = f.Equals(_viewModel.Id),
                    PostAction  = ViewModels.PostAction.Binding,
                    BindingData = new BindingData()
                    {
                        PublisherId = feedResult.Target.Publisher.Id,
                        FeedId      = f,
                        CategoryId  = default(Guid)
                    }
                });
            });

            if (_currentPublisher.FeedIds.Count > 1)
            {
                navBarViewModel.SecondBrothers.Add(new Brother()
                {
                    Id          = string.Empty,
                    Name        = "Cài thêm chuyên mục",
                    ImageUri    = null,
                    Stats       = "hoặc gỡ bớt chuyên mục không thích",
                    Selected    = false,
                    PostAction  = PostAction.Navigation,
                    NavigateUri = new Uri("/FeedPickupPage.xaml?publisherId=" + _currentPublisher.Id.ToString(), UriKind.Relative)
                });
            }

            NavBar.BindingNavBar(navBarViewModel);
            NavBar.SelectedEvent -= NavBar_Selected;
            NavBar.SelectedEvent += NavBar_Selected;
            NavBar.Navigation     = ((uri, id) => NavigationService.Navigate(uri));
            NavBar.NavigateHome   = (() => this.BackToMainPage());
        }
Ejemplo n.º 20
0
 protected override async Task GetItems(bool getNextPage)
 {
     Items = await PublisherHelper.PublishedAsync(EndpointId, true);
 }
Ejemplo n.º 21
0
        public ActionResult GetMetrics()
        {
            PublisherHelper helper = new PublisherHelper();

            return(Json(helper.GetMetrics(), JsonRequestBehavior.AllowGet));
        }