Esempio n. 1
0
        public MainWindowViewModel(IWindowManager windowManager, string connectionString)
        {
            _windowManager = windowManager;
            Login          = connectionString.Split(';').ToList().Where(n => n.IndexOf("uid=") != -1).ToList()[0];
            _signInTime    = DateTime.Now.ToUniversalTime().ToLongDateString() + DateTime.Now.ToShortTimeString();

            NotifyOfPropertyChange(() => DateTimeSignIn);


            using (var context = new DAL.Repositories.EFUnitOfWork(connectionString))
            {
                //var item = (Attachments)context.Attachments.Find(o => o.Content == "записывайся блять").FirstOrDefault();

                //if (item != null)
                //{
                //    item.Content = "пяздец";
                //    context.Attachments.Update(item);
                //    context.Save();
                //}

                //CarouselItems.Clear();
                context.Attachments.GetAll().ToList().ForEach(n => CarouselItems.Add(n.Content));
                SelectedItem = CarouselItems.First();

                //var item = new DAL.Models.Attachments() { AttachTypeId = 2, Content = "записывайся блять", CreateDate = DateTime.UtcNow.Date};
                //context.Attachments.Create(item);
            }
        }
        private async Task SetData(PageData pageData)
        {
            base.Title = pageData.ItemContext.FirstOrDefault().GetValueFromField(Constants.Sitecore.Fields.PageContent.Title);

            IEnumerable <ListItem> carouselItems = await _listItemService.GenerateListItemsFromTeasers(pageData.DataSourceFromField);

            CarouselItems = carouselItems.ToObservableCollection();

            CurrentCarouselItem = CarouselItems.First();
        }
        private async Task SetData()
        {
            ISitecoreItem item = base.PageContext.ItemContext.FirstOrDefault();

            base.Title = item.GetValueFromField(Constants.Sitecore.Fields.PageContent.Title);

            ContentHeader  = item.GetValueFromField(Constants.Sitecore.Fields.PageContent.Title);
            ContentSummary = item.GetValueFromField(Constants.Sitecore.Fields.PageContent.Summary);
            ContentMedia   = await _cachedMediaRepository.GetCache(item.GetImageUrlFromMediaField(Constants.Sitecore.Fields.PageContent.Image));

            IEnumerable <ListItem> carouselItems = await _listItemService.GenerateListItemsFromChildren(base.PageContext.DataSourceFromChildren);

            CarouselItems = carouselItems.ToObservableCollection();

            CurrentCarouselItem = CarouselItems.First();
        }