Beispiel #1
0
        public DetailPageViewModel GetWithClientAndDebs(int id, int page = 1)
        {
            var result = new DetailPageViewModel();

            try
            {
                int pageToQuantity = 10;

                var debs = _dbContext.Debs
                           .Where(x => x.AccountId == id)
                           .OrderByDescending(x => x.DateTime)
                           .Skip((page - 1) * pageToQuantity)
                           .Take(pageToQuantity).ToList();

                result.Account = _dbContext.Accounts
                                 .Include(x => x.Client)
                                 .Single(x => x.Id == id);

                result.Account.Debs = debs;

                var totalOfDebs = _dbContext.Debs
                                  .Where(x => x.AccountId == id).Count();
                result.ActuallyPage    = page;
                result.TotalOfRegister = totalOfDebs;
                result.RegisterByPage  = pageToQuantity;
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);
        }
        public DetailPageViewModel Filter(FilterDebsViewModel model, int page)
        {
            DetailPageViewModel result = new DetailPageViewModel();

            try
            {
                DateTime from           = DateTime.Parse(model.From);
                DateTime to             = Convert.ToDateTime(model.To);
                int      pageToQuantity = 10;
                result.Account = _dbContext.Accounts
                                 .Include(x => x.Client)
                                 .Single(x => x.Id == model.IdAccount);
                result.Account.Debs = _dbContext.Debs
                                      .Where(x => x.AccountId == model.IdAccount && (x.DateTime >= from) && (x.DateTime <= to))
                                      .OrderByDescending(x => x.DateTime)
                                      .Skip((page - 1) * pageToQuantity)
                                      .Take(pageToQuantity).ToList();
                result.TotalOfRegister = _dbContext.Debs.Count(x => x.AccountId == model.IdAccount && (x.DateTime >= from) && (x.DateTime <= to));
                result.ActuallyPage    = page;
                result.RegisterByPage  = pageToQuantity;
            }
            catch (Exception)
            {
                result = null;
            }
            return(result);
        }
Beispiel #3
0
 public DetailPage(Game popular)
 {
     InitializeComponent();
     BindingContext         = new DetailPageViewModel(Navigation, popular);
     imageGame.TranslationX = -300;
     lbCompany.TranslationX = -350;
     lbName.TranslationX    = -350;
 }
Beispiel #4
0
 public DetailPage(Item item)
 {
     ViewModel = new DetailPageViewModel(new PageService())
     {
         Item = item
     };
     InitializeComponent();
 }
Beispiel #5
0
 public DetailPage(Phone phone)
 {
     InitializeComponent();
     BindingContext           = new DetailPageViewModel(Navigation, phone);
     lbFirstName.TranslationX = -150;
     lbLastName.TranslationX  = -300;
     imgPhone.TranslationX    = 350;
 }
        public DetailPage(Product product)
        {
            InitializeComponent();

            BindingContext = new DetailPageViewModel()
            {
                Product = product
            };
        }
 public DetailPage(Character character)
 {
     InitializeComponent();
     BindingContext           = new DetailPageViewModel(Navigation, character);
     _character               = character;
     gridDetails.TranslationY = 30;
     imgBackground.Scale      = 1.2;
     CreateStacks();
 }
Beispiel #8
0
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var user          = GetUser();
            var listViewModel = await _refListViewModelReader.ReadRefListViewModel(id.Value);

            if (listViewModel == null)
            {
                return(HttpNotFound());
            }

            var canBrowse = IsCurrentUserId(listViewModel.Author.Id) || listViewModel.PublishingStatus == PublishingStatusKind.Publish;

            if (canBrowse)
            {
                var tagUses = await _tagHandler.GetAllTagUsesAsync(user.Id);

                var ownedTagUses = tagUses.Select(u => u.Name);

                var isFavored = false;
                if (IsAuthenticated())
                {
                    isFavored = await _favoriteHandler.ExistsFavoriteRefListAsync(user.Id, listViewModel.Id);
                }

                var isEdit        = IsCurrentUserId(listViewModel.Author.Id);
                var refViewModels = await _refListViewModelReader.ReadRefViewModels(id.Value);

                var vm = new DetailPageViewModel()
                {
                    IsEdit       = isEdit,
                    CanEdit      = isEdit, /// IsEdit==trueならCanEditの値は使われない
                    IsFavored    = isFavored,
                    RefList      = listViewModel,
                    Refs         = refViewModels,
                    OwnedTagUses = ownedTagUses,
                };

                await SetCookieAndIncrementViewCount(id.Value);

                return(View("Detail", vm));
            }
            else
            {
                return(View("DetailNotBrowsible"));
            }
        }
        public DetailPageView(SWDemo.Models.Response.Books.Item selectedBook)
        {
            InitializeComponent();
            BindingContext = new DetailPageViewModel(selectedBook, this);

            //Popup annimation
            this.Animation = new Rg.Plugins.Popup.Animations.MoveAnimation()
            {
                PositionIn  = Rg.Plugins.Popup.Enums.MoveAnimationOptions.Bottom,
                PositionOut = Rg.Plugins.Popup.Enums.MoveAnimationOptions.Bottom,
                DurationOut = 400,
                DurationIn  = 600,
                EasingIn    = Easing.SpringOut
            };
        }
Beispiel #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DetailPage" /> class.
        /// </summary>
        public DetailPage(Product selectedProduct)
        {
            InitializeComponent();
            var catalogDataService = App.MockDataService
                ? TypeLocator.Resolve <ICatalogDataService>()
                : DataService.TypeLocator.Resolve <ICatalogDataService>();
            var cartDataService = App.MockDataService
                ? TypeLocator.Resolve <ICartDataService>()
                : DataService.TypeLocator.Resolve <ICartDataService>();
            var wishlistDataService = App.MockDataService
                ? TypeLocator.Resolve <IWishlistDataService>()
                : DataService.TypeLocator.Resolve <IWishlistDataService>();

            BindingContext = new DetailPageViewModel(catalogDataService, cartDataService, wishlistDataService,
                                                     selectedProduct);
        }
Beispiel #11
0
        public async Task <ActionResult> Index(int id)
        {
            var _product = _unitOfWork._ProductRepo;
            await _product.IncrementViewCountAsync(id);

            var productDetail = await _product.SelectProductDetailByIdAsync(id);

            var result = new DetailPageViewModel
            {
                Product = productDetail,
                ProductSpecification = await _unitOfWork._ProductSpecificationRepo.sp_SelectByIdAsync(id),
                ProductRelated       = await _product.SelectProductRelatedAsync(id, productDetail.Price)
            };

            return(View(result));
        }
Beispiel #12
0
        public DetailPage(DetailPageViewModel vm)
        {
            InitializeComponent();

            BindingContext = vm;

            var position = new Position(vm.Entry.Latitude, vm.Entry.Longitude);

            map.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMiles(.5)));

            map.Pins.Add(new Pin
            {
                Type     = PinType.Place,
                Label    = vm.Entry.Title,
                Position = position
            });
        }
Beispiel #13
0
 internal async Task <bool> UnPinAsync(DetailPageViewModel detailPageViewModel)
 {
     if (!await IsPinned(detailPageViewModel))
     {
         return(true);
     }
     try
     {
         var tileId = detailPageViewModel.ToString();
         var tile   = new SecondaryTile(tileId);
         return(await tile.RequestDeleteAsync());
     }
     catch (Exception)
     {
         System.Diagnostics.Debugger.Break();
         return(false);
     }
 }
Beispiel #14
0
        public async Task <ActionResult> Detail(long?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "List"));
            }

            var listViewModel = await _refListViewModelReader.ReadRefListViewModel(id.Value);

            if (listViewModel == null)
            {
                return(HttpNotFound());
            }

            var canBrowse = listViewModel.PublishingStatus == PublishingStatusKind.Publish; /// 非公開設定の確認のため本人も見れないようにする。

            if (canBrowse)
            {
                var refViewModels = await _refListViewModelReader.ReadRefViewModels(id.Value);

                var isFavored = false;
                if (IsAuthenticated())
                {
                    var user = GetUser();
                    isFavored = await _favoriteHandler.ExistsFavoriteRefListAsync(user.Id, listViewModel.Id);
                }
                var vm = new DetailPageViewModel()
                {
                    IsEdit    = false,
                    CanEdit   = IsCurrentUserId(listViewModel.Author.Id),
                    IsFavored = isFavored,
                    RefList   = listViewModel,
                    Refs      = refViewModels,
                };

                await SetCookieAndIncrementViewCount(id.Value);

                return(Request.IsGoogleCrawl() ? View("DetailStatic", vm) : View(vm));
            }
            else
            {
                return(View("DetailNotBrowsible"));
            }
        }
Beispiel #15
0
        public async Task <ActionResult> Detail(string userName, string titleSearch = "", string tag = null)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                return(RedirectToAction("Index", "User"));
            }

            var author = await _UserHandler.GetUserByUserNameAsync(userName);

            BusinessContract.Require(author != null, Errors.UserNotFound, userName);

            /// 非公開設定の確認のため本人でもPublishしか見れないようにする。
            var req = new GetRefListsRequest(
                author.Id, null, null, tag, titleSearch, null, PublishingStatusConditionKind.PublishOnly, 0, WebConsts.RefListsPageSize,
                RefListSortKind.PublishedDateDescending
                );
            var result = await _refListHandler.GetRefListsAsync(req);

            var tagUses = await _tagHandler.GetAllTagUsesAsync(author.Id);

            var vm = new DetailPageViewModel()
            {
                Author       = Mapper.Map <UserViewModel>(author),
                OwnedTagUses = Mapper.Map <ICollection <TagUseViewModel> >(tagUses),
                TitleSearch  = titleSearch,
                TagUse       = tag,
                PageIndex    = result.PageIndex + 1,
                PageCount    = result.PageCount,
                RefLists     = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists),
            };

            var isFavored = false;

            if (IsAuthenticated())
            {
                var user = GetUser();
                isFavored = await _favoriteHandler.ExistsFavoriteUserAsync(user.Id, author.Id);
            }
            vm.IsFavored = isFavored;

            return(View(vm));
        }
Beispiel #16
0
        public async Task <ActionResult> Detail(string tag, string titleSearch = "")
        {
            if (string.IsNullOrWhiteSpace(tag) || tag == CoreConsts.UnsetTagName)
            {
                return(RedirectToAction("Index"));
            }

            var tagEntity = await _tagHandler.GetTagAsync(tag);

            if (tagEntity == null)
            {
                return(HttpNotFound());
            }
            var tagVm = Mapper.Map <TagViewModel>(tagEntity);

            /// 非公開設定の確認のため本人でもPublishしか見れないようにする。
            var req = new GetRefListsRequest(
                null, null, null, tag, titleSearch, null, PublishingStatusConditionKind.PublishOnly, 0, WebConsts.RefListsPageSize,
                RefListSortKind.PublishedDateDescending
                );
            var result = await _refListHandler.GetRefListsAsync(req);

            var vm = new DetailPageViewModel()
            {
                Tag         = tagVm,
                TitleSearch = titleSearch,
                PageIndex   = result.PageIndex + 1,
                PageCount   = result.PageCount,
                RefLists    = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists),
            };

            var isFavored = false;

            if (IsAuthenticated())
            {
                var user = GetUser();
                isFavored = await _favoriteHandler.ExistsFavoriteTagAsync(user.Id, tagVm.Id);
            }
            vm.IsFavored = isFavored;

            return(View(vm));
        }
 //  public DetailPage()
 public DetailPage(Product selectedProduct)
 {
     try
     {
         var app = Application.Current as App;
         InitializeComponent();
         BindingContext = new DetailPageViewModel(selectedProduct);
         Analytics.TrackEvent("Product_Clicked", new Dictionary <string, string> {
             { "MerchantBranchId", app.Merchantid },
             { "UserPhoneNumber", app.UserPhoneNumber },
             { "ProductName", selectedProduct.productName },
             { "ProductId", selectedProduct.CitrineProdId.ToString() }
         });
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         //DisplayAlert("Error", ex.Message, "OK");
     }
 }
Beispiel #18
0
        public DetailPage(DetailPageViewModel viewModel)
        {
            BindingContext = viewModel;

            Title = "Notes Detail";

            BackgroundColor = Color.PowderBlue;

            var textLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            textLabel.SetBinding(Label.TextProperty, nameof(DetailPageViewModel.NoteText));

            var exitButton = new Button
            {
                Text            = "Back",
                VerticalOptions = LayoutOptions.Center,
                Margin          = new Thickness(20),
                BackgroundColor = Color.Red,
                TextColor       = Color.White,
                FontSize        = 20
            };

            exitButton.SetBinding(Button.CommandProperty, nameof(DetailPageViewModel.BackButtonCommand));

            var stackLayout = new StackLayout
            {
                Margin = new Thickness(20, 40)
            };

            stackLayout.Children.Add(textLabel);
            stackLayout.Children.Add(exitButton);

            Content = stackLayout;
        }
Beispiel #19
0
        void ShowToast(DetailPageViewModel detailPageViewModel)
        {
            var data  = detailPageViewModel.Value;
            var image = "https://raw.githubusercontent.com/Windows-XAML/Template10/master/Assets/Template10.png";

            var content = new ToastContent()
            {
                Launch = data,
                Visual = new ToastVisual()
                {
                    TitleText = new ToastText()
                    {
                        Text = "Secondary tile pinned"
                    },

                    BodyTextLine1 = new ToastText()
                    {
                        Text = detailPageViewModel.Value
                    },

                    AppLogoOverride = new ToastAppLogo()
                    {
                        Crop   = ToastImageCrop.Circle,
                        Source = new ToastImageSource(image)
                    }
                },
                Audio = new ToastAudio()
                {
                    Src = new Uri("ms-winsoundevent:Notification.IM")
                }
            };

            var notification = new ToastNotification(content.GetXml());
            var notifier     = ToastNotificationManager.CreateToastNotifier();

            notifier.Show(notification);
        }
Beispiel #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DetailPage" /> class.
 /// </summary>
 public DetailPage(Models.Product product)
 {
     InitializeComponent();
     this.BindingContext = VM = new DetailPageViewModel(product, Navigation);
 }
 public ShowFolderCommand(DetailPageViewModel vm)
 {
     _vm = vm;
 }
Beispiel #22
0
 public DetailPage(DetailPageViewModel vm)
 {
     InitializeComponent();
     this.BindingContext = vm;
 }
 public DetailPage(User User)
 {
     InitializeComponent();
     BindingContext = new DetailPageViewModel(Navigation, User);
 }
Beispiel #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DetailPage" /> class.
 /// </summary>
 public DetailPage(Models.Product product)
 {
     InitializeComponent();
     this.BindingContext = VM = new DetailPageViewModel(product, Navigation, blackoutDates, calendar);
 }
Beispiel #25
0
        internal async Task <bool> PinAsync(DetailPageViewModel detailPageViewModel)
        {
            var name  = "Tiles sample";
            var title = "Template 10";
            var body  = detailPageViewModel.Value;
            var image = "https://raw.githubusercontent.com/Windows-XAML/Template10/master/Assets/Template10.png";

            var bindingContent = new TileBindingContentAdaptive()
            {
                PeekImage = new TilePeekImage()
                {
                    Source = new TileImageSource(image)
                },

                Children =
                {
                    new TileText()
                    {
                        Text  = title,
                        Style = TileTextStyle.Body
                    },

                    new TileText()
                    {
                        Text  = body,
                        Wrap  = true,
                        Style = TileTextStyle.CaptionSubtle
                    }
                }
            };

            var binding = new TileBinding()
            {
                Branding    = TileBranding.NameAndLogo,
                DisplayName = name,
                Content     = bindingContent
            };

            var content = new TileContent()
            {
                Visual = new TileVisual()
                {
                    TileMedium = binding,
                    TileWide   = binding,
                    TileLarge  = binding
                }
            };

            var xml = content.GetXml();

            // show tile

            var tileId = detailPageViewModel.ToString();

            if (!await IsPinned(detailPageViewModel))
            {
                // initial pin
                var logo          = new Uri("ms-appx:///Assets/Logo.png");
                var secondaryTile = new SecondaryTile(tileId)
                {
                    Arguments      = detailPageViewModel.Value,
                    DisplayName    = name,
                    VisualElements =
                    {
                        Square44x44Logo             = logo,
                        Square150x150Logo           = logo,
                        Wide310x150Logo             = logo,
                        Square310x310Logo           = logo,
                        ShowNameOnSquare150x150Logo = true,
                    },
                };
                if (!await secondaryTile.RequestCreateAsync())
                {
                    System.Diagnostics.Debugger.Break();
                    return(false);
                }
            }

            // add notifications

            var tileNotification = new TileNotification(xml);
            var tileUpdater      = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);

            tileUpdater.Update(tileNotification);

            // show toast

            ShowToast(detailPageViewModel);

            // result

            return(true);
        }
Beispiel #26
0
        internal async Task <bool> IsPinned(DetailPageViewModel detailPageViewModel)
        {
            var tileId = detailPageViewModel.ToString();

            return((await SecondaryTile.FindAllAsync()).Any(x => x.TileId.Equals(tileId)));
        }
 public SelectEmailCommand(DetailPageViewModel vm)
 {
     _vm = vm;
 }
Beispiel #28
0
 public DetailPage(Item item)
 {
     InitializeComponent();
     BindingContext = new DetailPageViewModel(Navigation, item);
 }
 public DetailPageViewModelTests()
 {
     tripLogNavigation = new Mock <ITripLogNavigation>();
     testee            = new DetailPageViewModel(tripLogNavigation.Object);
 }
Beispiel #30
0
        public ContentPage BuildDetailPage(DetailPageViewModel vm)
        {
            var page = new DetailPage(vm);

            return(page);
        }