Esempio n. 1
0
        public ActionResult Collections()
        {
            CollectionsViewModel viewModel = new CollectionsViewModel();

            viewModel.CollectionSites = _collectionRepository.List();
            return(View(viewModel));
        }
Esempio n. 2
0
        private async void pvCollections_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (pvCollections.SelectedIndex == 1)
            {
                if (CollectionsViewModel.listCuratedCollection.Count == 0)
                {
                    PublicAuthorization publicAuthorization = new PublicAuthorization();
                    CollectionsViewModel.listCuratedCollection = await publicAuthorization.GetCurated();

                    while (CollectionsViewModel.listCuratedCollection.Count == 0)
                    {
                        await Task.Delay(10);

                        CollectionsViewModel.listCuratedCollection = await publicAuthorization.GetCurated();
                    }

                    this.ViewModel = new CollectionsViewModel();

                    grvCurated.ItemsSource = CollectionsViewModel.listCuratedCollection;
                }
                else
                {
                    grvCurated.ItemsSource = CollectionsViewModel.listCuratedCollection;
                }

                griCuratedLoading.Visibility = Visibility.Collapsed;
            }
        }
Esempio n. 3
0
 public HomePage()
 {
     this.InitializeComponent();
     unsplashApiService = new WallpaperService();
     this.ViewModel     = new CollectionsViewModel();
     ViewModel.InitializeCollections();
 }
        private async void btCollection_Click(object sender, RoutedEventArgs e)
        {
            PublicAuthorization publicAuthorization = new PublicAuthorization();

            if (showinfo.Visibility == Visibility.Visible)
            {
                showinfo.Visibility = Visibility.Collapsed;
            }
            if (gridShowCollection.Visibility == Visibility.Visible)
            {
                gridShowCollection.Visibility = Visibility.Collapsed;
            }
            else
            {
                gridShowCollection.Visibility = Visibility.Visible;
                grtap.Visibility = Visibility.Visible;
            }
            if (Me.TokenInFileUserDefault != null)
            {
                if (CollectionsViewModel.listMeCollection.Count == 0)
                {
                    //RequestParameters.MeCollection = RequestParameters.MeCollection + meRootObjects.username lismover + "/collections?access_token=" + Me.TokenInFileUserDefault;
                    RequestParameters.MeCollection = RequestParameters.MeCollection + "lismover/collections?access_token=" + Me.TokenInFileUserDefault;
                    try
                    {
                        CollectionsViewModel.listMeCollection = await publicAuthorization.GetMeCollection();
                    }
                    catch (Exception)
                    {
                    }


                    while (CollectionsViewModel.listMeCollection.Count == 0)
                    {
                        await Task.Delay(10);

                        try
                        {
                            CollectionsViewModel.listMeCollection = await publicAuthorization.GetMeCollection();
                        }
                        catch (Exception)
                        {
                        }
                    }

                    this.ViewModel = new CollectionsViewModel();

                    lvAddCollection.ItemsSource = CollectionsViewModel.listMeCollection;
                }
                else
                {
                    lvAddCollection.ItemsSource = CollectionsViewModel.listMeCollection;
                }
            }
            else
            {
            }
        }
Esempio n. 5
0
        public ActionResult StoreCollection()
        {
            var viewModel = new CollectionsViewModel()
            {
                groupedDepartmentCollections = itemDisbursementService.groupItemDisbursementByDepartment()
            };

            return(View(viewModel));
        }
Esempio n. 6
0
        public ActionResult DepartmentCollection()
        {
            var departmentId = User.Identity.GetDepartmentId();

            var viewModel = new CollectionsViewModel()
            {
                groupedDepartmentCollections = itemDisbursementService.GetDepartmentCollection(departmentId)
            };

            return(View(viewModel));
        }
Esempio n. 7
0
        // GET: Upload
        public ActionResult Index()
        {
            var collections = _context.Collection.ToList();

            var viewModel = new CollectionsViewModel
            {
                Collection = collections
            };


            return(View(viewModel));
        }
Esempio n. 8
0
        /// <summary>
        /// Load Collections
        /// </summary>
        /// <returns></returns>
        public PartialViewResult loadColections()
        {
            //var model = db.MENUs.Where(q => q.IdCha == 0).OrderBy(o => o.ThuTu);

            CollectionsViewModel model = new CollectionsViewModel();

            model.lstCollection1 = db.Products.Where(p => p.IsProduct == false && p.IsActive == true).OrderBy(p => Guid.NewGuid()).Take(3).ToList();
            model.lstCollection2 = db.Products.Where(p => p.IsProduct == false && p.IsActive == true).OrderBy(p => Guid.NewGuid()).Take(3).ToList();
            model.lstCollection3 = db.Products.Where(p => p.IsProduct == false && p.IsActive == true).OrderBy(p => Guid.NewGuid()).Take(3).ToList();

            return(PartialView("_lstCollection", model));
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method determines if the delete command can execute.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void PreviewDeleteCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            CollectionsViewModel items = DataContext as CollectionsViewModel;

            if (items != null)
            {
                foreach (CollectionViewModel item in items.Collections)
                {
                    if (item.IsSelected == true)
                    {
                        e.CanExecute = true;
                        return;
                    }
                }
            }
            e.CanExecute = false;
            e.Handled    = true;
        }
Esempio n. 10
0
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            PublicAuthorization publicAuthorization = new PublicAuthorization();

            CollectionsViewModel.listFeaturedCollection = await publicAuthorization.GetFeatured();

            while (CollectionsViewModel.listFeaturedCollection.Count == 0)
            {
                await Task.Delay(10);

                CollectionsViewModel.listFeaturedCollection = await publicAuthorization.GetFeatured();
            }

            this.ViewModel = new CollectionsViewModel();

            grvFeatured.ItemsSource       = CollectionsViewModel.listFeaturedCollection;
            griFeaturedLoading.Visibility = Visibility.Collapsed;
        }
Esempio n. 11
0
        public async Task <ActionResult> AwardsFilms()
        {
            bool loggedIn = CurrentMember != null;

            ViewBag.LoggedIn = loggedIn;

            if (loggedIn)
            {
                var bookedFilms = db.MemberFilms.Where(mf => mf.MemberID == CurrentMember.MemberID).ToList();
                ViewBag.BookedFilms = bookedFilms;
            }

            ViewBag.CurrentTime = await GetLocationTime();

            CollectionsViewModel vm = new CollectionsViewModel();

            var collections = db.FilmCollections.ToList();

            foreach (var col in collections)
            {
                Film film = db.Films.Find(col.FilmID);

                col.Film = film;
            }

            var colles = collections.Where(c => c.Film.Showing > DateTime.Parse("2021-06-10")).OrderBy(fc => fc.Name).OrderBy(fc => fc.SortOrder).ToList().Select(fc => new CollectionViewModel()
            {
                Collection = fc,
                Films      = db.Films.Where(f => fc.FilmCollectionID == f.FilmCollectionID && f.Title != "Collection").ToList()
            }).ToList();

            foreach (var col in colles)
            {
                foreach (var film in col.Films)
                {
                    film.FilmDetails = db.FilmDetails.Where(fd => fd.FilmID == film.FilmID).FirstOrDefault();
                }
            }

            vm.Collections = colles;

            return(View(vm));
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method handles the execution of the delete command.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void DeleteExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            CollectionsViewModel items = DataContext as CollectionsViewModel;

            if (items != null)
            {
                foreach (CollectionViewModel item in items.Collections)
                {
                    if (item.IsSelected == true)
                    {
                        if (MessageBox.Show(DisplayValues.Message_DeleteItemConfirmation, DisplayValues.Message_DeleteItemConfirmationCaption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            items.DeleteCollection(item);
                        }
                        return;
                    }
                }
            }
        }
Esempio n. 13
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(View("NotFound", "Home"));
            }
            CollectionsViewModel model = new CollectionsViewModel();

            model.detail                 = db.Products.Where(p => p.IsActive == true && p.IsProduct == false && p.ProductID == id).FirstOrDefault();
            model.detail.CountView       = model.detail.CountView + 1;
            db.Entry(model.detail).State = EntityState.Modified;
            db.SaveChanges();
            model.lstImages = db.ProductImages.Where(i => i.ProductID == id).ToList();
            var cateid = db.Products.Where(p => p.IsActive == true && p.IsProduct == false && p.ProductID == id).FirstOrDefault().CategoryID;

            model.lstCollection1 = db.Products.Where(p => p.IsActive == true && p.IsProduct == false && p.CategoryID == cateid && p.ProductID != id).OrderByDescending(p => p.ProductID).Take(4).ToList();


            return(View(model));
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method handles the execution of the new command.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void NewExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Point currentPosition                    = MouseUtilities.GetMousePosition(this);
            CollectionsViewModel   items             = DataContext as CollectionsViewModel;
            EntityDiagramControl   diagram           = VisualItemHelper.VisualUpwardSearch <EntityDiagramControl>(this) as EntityDiagramControl;
            DiagramEntityViewModel diagramEntityView = diagram.DataContext as DiagramEntityViewModel;

            if (items != null && diagramEntityView != null)
            {
                dialog         = new Window();
                dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                dialog.Width   = 400 * UserSettingsHelper.Instance.ControlSize;
                dialog.Left    = Math.Max(currentPosition.X, 20);
                dialog.Top     = Math.Max(currentPosition.Y, 20);
                dialog.Content = new CollectionDialogControl();
                Collection newItem = new Collection();
                newItem.PropertyID = Guid.NewGuid();
                newItem.Solution   = items.Solution;
                newItem.Entity     = items.Entity;
                //newItem.ReferenceEntity = diagramEntityView.DiagramEntity.Entity;
                CollectionViewModel newItemView = new CollectionViewModel(newItem, items.Solution);
                newItemView.IsFreeDialog  = true;
                dialog.DataContext        = newItemView;
                dialog.Title              = newItemView.Title;
                newItemView.RequestClose += new EventHandler(Item_RequestClose);
                #region protected
                #endregion protected
                dialog.ShowDialog();
                if (newItemView.IsOK == true)
                {
                    items.AddCollection(newItemView);
                }
                dialog.Close();
                dialog    = null;
                e.Handled = true;
                return;
            }
        }
Esempio n. 15
0
        public IActionResult Collections(string querry, int?page)
        {
            var recipes = _recipeRepository.GetAllRecipesForCollections(querry)
                          .Select(e =>
            {
                e.EncryptedId = _protector.Protect(e.Id.ToString());
                return(e);
            });

            ViewBag.CollectionsTitle = querry;

            var pageNumber       = page ?? 1;
            int pageSize         = 24;
            var onepageOfRecipes = recipes.ToList().ToPagedList(pageNumber, pageSize);

            CollectionsViewModel model = new CollectionsViewModel
            {
                Recipes = onepageOfRecipes,
                Query   = querry
            };

            return(View(model));
        }
Esempio n. 16
0
        public async Task <IActionResult> Collections()
        {
            CollectionsViewModel vm = new CollectionsViewModel();

            var collections = db.FilmCollections.OrderBy(fc => fc.Name).OrderBy(fc => fc.SortOrder).ToList().Select(fc => new CollectionViewModel()
            {
                Collection = fc,
                Films      = db.Films.Where(f => fc.FilmCollectionID == f.FilmCollectionID && f.Title != "Collection").ToList()
            }).ToList();

            foreach (var col in collections)
            {
                foreach (var film in col.Films)
                {
                    film.FilmDetails = db.FilmDetails.Where(fd => fd.FilmID == film.FilmID).FirstOrDefault();
                }
            }

            vm.Collections = collections;

            bool loggedIn = CurrentMember != null;

            ViewBag.LoggedIn = loggedIn;

            if (loggedIn)
            {
                var bookedFilms = db.MemberFilms.Where(mf => mf.MemberID == CurrentMember.MemberID).ToList();
                ViewBag.BookedFilms = bookedFilms;
            }

            ViewBag.CurrentTime = await GetLocationTime();

            ViewBag.Database = db;

            return(View(vm));
        }
Esempio n. 17
0
		public CollectionsNavigator(IShell shellViewModel, CollectionsViewModel collectionsViewModel)
		{
			this.shellViewModel = shellViewModel;
			this.collectionsViewModel = collectionsViewModel;
		}
Esempio n. 18
0
        public MainWindow()
        {
            InitializeComponent();

            DataContext = new CollectionsViewModel();
        }
Esempio n. 19
0
 public CollectionsNavigator(IShell shellViewModel, CollectionsViewModel collectionsViewModel)
 {
     this.shellViewModel       = shellViewModel;
     this.collectionsViewModel = collectionsViewModel;
 }
Esempio n. 20
0
        public IActionResult Create([FromForm] CollectionsViewModel model)
        {
            if (ModelState.IsValid)
            {
                var collection = model.Collection;

                if (model.TitleImage != null)
                {
                    byte[] imageData = null;

                    using (var binaryReader = new BinaryReader(model.TitleImage.OpenReadStream()))
                    {
                        imageData = binaryReader.ReadBytes((int)model.TitleImage.Length);
                    }

                    collection.TitleImage = imageData;
                }

                #region NUMBERS
                if (collection.FirstNumberName != null)
                {
                    collection.FirstNumberIsEnabled = true;
                }
                else
                {
                    collection.FirstNumberIsEnabled = false;
                }
                if (collection.SecondNumberName != null)
                {
                    collection.SecondNumberIsEnabled = true;
                }
                else
                {
                    collection.SecondNumberIsEnabled = false;
                }
                if (collection.ThirdNumberName != null)
                {
                    collection.ThirdNumberIsEnabled = true;
                }
                else
                {
                    collection.ThirdNumberIsEnabled = false;
                }
                #endregion
                #region TEXTS
                if (collection.FirstTextName != null)
                {
                    collection.FirstTextIsEnabled = true;
                }
                else
                {
                    collection.FirstTextIsEnabled = false;
                }
                if (collection.SecondTextName != null)
                {
                    collection.SecondTextIsEnabled = true;
                }
                else
                {
                    collection.SecondTextIsEnabled = false;
                }
                if (collection.ThirdTextName != null)
                {
                    collection.ThirdTextIsEnabled = true;
                }
                else
                {
                    collection.SecondTextIsEnabled = false;
                }
                #endregion
                #region DATES
                if (collection.FirstDateName != null)
                {
                    collection.FirstDateIsEnabled = true;
                }
                else
                {
                    collection.FirstDateIsEnabled = false;
                }
                if (collection.SecondDateName != null)
                {
                    collection.SecondDateIsEnabled = true;
                }
                else
                {
                    collection.SecondDateIsEnabled = false;
                }
                if (collection.ThirdDateName != null)
                {
                    collection.ThirdDateIsEnabled = true;
                }
                else
                {
                    collection.ThirdDateIsEnabled = false;
                }
                #endregion
                #region CHECKBOXES
                if (collection.FirstCheckBoxName != null)
                {
                    collection.FirstCheckBoxIsEnabled = true;
                }
                else
                {
                    collection.FirstCheckBoxIsEnabled = false;
                }
                if (collection.SecondCheckBoxName != null)
                {
                    collection.SecondCheckBoxIsEnabled = true;
                }
                else
                {
                    collection.SecondCheckBoxIsEnabled = false;
                }
                if (collection.ThirdCheckBoxName != null)
                {
                    collection.ThirdCheckBoxIsEnabled = true;
                }
                else
                {
                    collection.ThirdCheckBoxIsEnabled = false;
                }
                #endregion

                this.dataManager.Collections.AddCollection(collection);

                return(Redirect($"/User/Index/{collection.UserId}"));
            }
            else
            {
                ViewBag.Theme = new SelectList(Themes.List);

                ModelState.AddModelError(string.Empty, "INVALID DATA");
                return(View(model));
            }
        }
Esempio n. 21
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);

            Point                  currentPosition   = MouseUtilities.GetMousePosition(this);
            DiagramViewModel       diagramView       = ParentCanvas.DataContext as DiagramViewModel;
            DiagramEntityViewModel diagramEntityView = DataContext as DiagramEntityViewModel;

            if (diagramView != null && diagramEntityView != null)
            {
                // try drop as diagram relationship
                DiagramRelationshipViewModel dragRelationship = e.Data.GetData(typeof(DiagramRelationshipViewModel)) as DiagramRelationshipViewModel;
                if (dragRelationship != null)
                {
                    dragRelationship.SinkDiagramEntityViewModel = diagramEntityView;
                    dragRelationship.Diagram = diagramView;
                    dialog         = new Window();
                    dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Width   = 650 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Left    = Math.Max(currentPosition.X, 20);
                    dialog.Top     = Math.Max(currentPosition.Y, 20);
                    dialog.Content = new RelationshipDialogControl();
                    Relationship newRelationship = new Relationship();
                    newRelationship.RelationshipID   = Guid.NewGuid();
                    newRelationship.Solution         = dragRelationship.Solution;
                    newRelationship.ReferencedEntity = dragRelationship.SinkDiagramEntityViewModel.DiagramEntity.Entity;
                    newRelationship.Entity           = dragRelationship.SourceDiagramEntityViewModel.DiagramEntity.Entity;
                    RelationshipViewModel newRelationshipView = new RelationshipViewModel(newRelationship, dragRelationship.Solution);
                    dialog.DataContext = newRelationshipView;
                    dialog.Title       = newRelationshipView.Title;
                    newRelationshipView.RequestClose += new EventHandler(Item_RequestClose);

                    dialog.ShowDialog();
                    if (newRelationshipView.IsOK == true)
                    {
                        dragRelationship.RelationshipViewModel = newRelationshipView;
                        diagramView.CreateRelationship(dragRelationship);
                    }
                    dialog.Close();
                    dialog    = null;
                    e.Handled = true;
                    return;
                }

                // try drop as collection
                CollectionsViewModel dragCollections = e.Data.GetData(typeof(CollectionsViewModel)) as CollectionsViewModel;
                if (dragCollections != null)
                {
                    dialog         = new Window();
                    dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Width   = 400 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Left    = Math.Max(currentPosition.X, 20);
                    dialog.Top     = Math.Max(currentPosition.Y, 20);
                    dialog.Content = new CollectionDialogControl();
                    Collection newProperty = new Collection();
                    newProperty.PropertyID       = Guid.NewGuid();
                    newProperty.Solution         = dragCollections.Solution;
                    newProperty.Entity           = dragCollections.Entity;
                    newProperty.ReferencedEntity = diagramEntityView.DiagramEntity.Entity;
                    CollectionViewModel newPropertyView = new CollectionViewModel(newProperty, dragCollections.Solution);
                    dialog.DataContext            = newPropertyView;
                    dialog.Title                  = newPropertyView.Title;
                    newPropertyView.RequestClose += new EventHandler(Item_RequestClose);

                    dialog.ShowDialog();
                    if (newPropertyView.IsOK == true)
                    {
                        dragCollections.AddCollection(newPropertyView);
                    }
                    dialog.Close();
                    dialog    = null;
                    e.Handled = true;
                    return;
                }

                // try drop as property reference
                PropertyReferencesViewModel dragPropertyReferences = e.Data.GetData(typeof(PropertyReferencesViewModel)) as PropertyReferencesViewModel;
                if (dragPropertyReferences != null)
                {
                    dialog         = new Window();
                    dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Width   = 400 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Left    = Math.Max(currentPosition.X, 20);
                    dialog.Top     = Math.Max(currentPosition.Y, 20);
                    dialog.Content = new PropertyReferenceDialogControl();
                    PropertyReference newProperty = new PropertyReference();
                    newProperty.PropertyID = Guid.NewGuid();
                    newProperty.Solution   = dragPropertyReferences.Solution;
                    newProperty.Entity     = dragPropertyReferences.Entity;
                    PropertyReferenceViewModel newPropertyView = new PropertyReferenceViewModel(newProperty, dragPropertyReferences.Solution);
                    newPropertyView.ReferencedEntityID = diagramEntityView.EntityViewModel.EntityID;
                    newPropertyView.RefreshProperties();
                    dialog.DataContext            = newPropertyView;
                    dialog.Title                  = newPropertyView.Title;
                    newPropertyView.RequestClose += new EventHandler(Item_RequestClose);

                    dialog.ShowDialog();
                    if (newPropertyView.IsOK == true)
                    {
                        dragPropertyReferences.AddPropertyReference(newPropertyView);
                    }
                    dialog.Close();
                    dialog    = null;
                    e.Handled = true;
                    return;
                }

                // try drop as entity reference
                EntityReferencesViewModel dragEntityReferences = e.Data.GetData(typeof(EntityReferencesViewModel)) as EntityReferencesViewModel;
                if (dragEntityReferences != null)
                {
                    dialog         = new Window();
                    dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Width   = 400 * UserSettingsHelper.Instance.ControlSize;
                    dialog.Left    = Math.Max(currentPosition.X, 20);
                    dialog.Top     = Math.Max(currentPosition.Y, 20);
                    dialog.Content = new EntityReferenceDialogControl();
                    EntityReference newProperty = new EntityReference();
                    newProperty.PropertyID       = Guid.NewGuid();
                    newProperty.Solution         = dragEntityReferences.Solution;
                    newProperty.Entity           = dragEntityReferences.Entity;
                    newProperty.ReferencedEntity = diagramEntityView.DiagramEntity.Entity;
                    EntityReferenceViewModel newPropertyView = new EntityReferenceViewModel(newProperty, dragEntityReferences.Solution);
                    dialog.DataContext            = newPropertyView;
                    dialog.Title                  = newPropertyView.Title;
                    newPropertyView.RequestClose += new EventHandler(Item_RequestClose);

                    dialog.ShowDialog();
                    if (newPropertyView.IsOK == true)
                    {
                        dragEntityReferences.AddEntityReference(newPropertyView);
                    }
                    dialog.Close();
                    dialog    = null;
                    e.Handled = true;
                    return;
                }
            }
        }