public PreglediPage(bool OnlyZakazani = false)
        {
            this.OnlyZakazani = OnlyZakazani;
            Title             = OnlyZakazani ? AppResources.ZakazaniPreglediPageTitle : AppResources.SviPreglediPageTitle;
            InitializeComponent();
            BindingContext = PreglediVM = ViewModelLocator.PreglediViewModel;
            ((PregledResourceParameters)PreglediVM.ResourceParameters).OnlyZakazani = this.OnlyZakazani;
            PreglediVM.SearchEntryPlaceholder = AppResources.SearchByDoktor;

            ListView.MainListView.ItemTapped += async(sender, e) =>
            {
                await Navigation.PushPopupAsync(new PregledDialogPage((e.Item as CollectionViewItem)?.Id ?? 0));
            };
        }
コード例 #2
0
        /// <summary>
        /// Metoda za tablični ispis svih pregleda
        /// </summary>
        /// <param name="page"></param>
        /// <param name="sort"></param>
        /// <param name="ascending"></param>
        /// <returns></returns>
        public IActionResult Index(int page = 1, int sort = 1, bool ascending = true)
        {
            int pagesize = appSettings.PageSize;
            var query    = ctx.Pregled.AsNoTracking();

            int count = query.Count();

            var pagingInfo = new PagingInfo
            {
                CurrentPage  = page,
                Sort         = sort,
                Ascending    = ascending,
                ItemsPerPage = pagesize,
                TotalItems   = count
            };

            if (page > pagingInfo.TotalPages)
            {
                return(RedirectToAction(nameof(Index), new {
                    page = pagingInfo.TotalPages,
                    sort,
                    ascending
                }));
            }

            System.Linq.Expressions.Expression <Func <Pregled, object> > orderSelector = null;
            switch (sort)
            {
            case 1:
                orderSelector = p => p.SifraPregleda;
                break;

            case 2:
                orderSelector = p => p.Datum;
                break;

            case 3:
                orderSelector = p => p.Anamneza;
                break;

            case 4:
                orderSelector = p => p.Dijagnoza;
                break;
            }

            if (orderSelector != null)
            {
                query = ascending ? query.OrderBy(orderSelector) : query.OrderByDescending(orderSelector);
            }

            var pregledi = query
                           .Skip((page - 1) * pagesize)
                           .Take(pagesize)
                           .ToList();

            var model = new PreglediViewModel
            {
                Pregledi   = pregledi,
                PagingInfo = pagingInfo
            };

            return(View(model));
        }
コード例 #3
0
 public PreglediPage()
 {
     InitializeComponent();
     BindingContext = model = new PreglediViewModel();
 }