コード例 #1
0
        public ActionResult Index(int?categoryId)
        {
            var archiveCategories      = _archiveCategoryRepo.List();
            var archiveItemsToDisplay  = _archiveItemRepo.Find(item => item.CategoryId == categoryId).ToList();
            var archiveItemsByLanguage = archiveItemsToDisplay.Where(item =>
                                                                     item.LanguageCode.Equals(string.Empty) ||
                                                                     item.LanguageCode == SessionHelper.GetStringValue(SessionConstants.LanguageCode)).ToList();
            var archiveModel = new ArchiveViewModel
            {
                CategoryId            = categoryId ?? 0,
                ArchiveItemCategories = _archiveCategoryRepo.List()
                                        .OrderBy(_ => _.Name)
                                        .Select(a =>
                {
                    var archiveItems = _archiveItemRepo.Find(item => item.CategoryId == a.Id).ToList();
                    var archiveItemsPerCategoryByLanguage = archiveItems.Where(item =>
                                                                               item.LanguageCode.Equals(string.Empty) ||
                                                                               item.LanguageCode == SessionHelper.GetStringValue(SessionConstants.LanguageCode)).ToList();
                    return(new ArchiveByItemCategoryViewModel()
                    {
                        ArchiveItemCategory = a,
                        Items = archiveItemsPerCategoryByLanguage
                    });
                }).ToList(),
                SelectedArchive = categoryId > 0 ? new ArchiveByItemCategoryViewModel
                {
                    ArchiveItemCategory = archiveCategories.FirstOrDefault(_ => _.Id == categoryId),
                    Items = archiveItemsByLanguage
                } : null
            };

            archiveModel.SelectedArchive?.Items.ForEach(item => LoadUploadedFiles(item));
            return(View(archiveModel));
        }
コード例 #2
0
        public IActionResult Category()
        {
            var model = new List <ArchiveViewModel>();
            var posts = _blogService.GetPublishedPosts();
            var cats  = _blogService.GetCategories();

            foreach (var blogCategory in cats)
            {
                var catModel = new ArchiveViewModel(blogCategory.Name, blogCategory.Link);
                catModel.Posts.AddRange(posts.Where(p => p.CategoryNames.Contains(blogCategory.Name, StringComparer.OrdinalIgnoreCase)));

                model.Add(catModel);
            }

            var remainingPosts = posts.Except(model.SelectMany(_ => _.Posts).Distinct()).ToList();

            if (remainingPosts.Any())
            {
                var catModel = new ArchiveViewModel(BlogConstant.DefaultCategoryName, BlogConstant.DefaultCategoryLink);
                catModel.Posts.AddRange(remainingPosts);
                model.Add(catModel);
            }

            ViewData["Title"]       = "分类";
            ViewData["Canonical"]   = "/category/";
            ViewData["Description"] = "所有文章以分类的形式展现";
            return(View("Index", model));
        }
コード例 #3
0
        public void ArchiveViewModel_ExampleData()
        {
            var archiveViewModel = new ArchiveViewModel
            {
                FileIndexItems = new List <FileIndexItem>(),
                Breadcrumb     = new List <string> {
                    "/"
                },
                RelativeObjects = new RelativeObjects
                {
                    NextFilePath = "/"
                },
                SearchQuery      = "test",
                SubPath          = "/",
                IsReadOnly       = false,
                CollectionsCount = 0,
                Collections      = true,
            };

            Assert.AreEqual("/", archiveViewModel.Breadcrumb.FirstOrDefault());
            Assert.AreEqual("/", archiveViewModel.RelativeObjects.NextFilePath);
            Assert.AreEqual("test", archiveViewModel.SearchQuery);
            Assert.AreEqual("/", archiveViewModel.SubPath);
            Assert.AreEqual(false, archiveViewModel.IsReadOnly);
            Assert.AreEqual(0, archiveViewModel.CollectionsCount);
            Assert.IsTrue(archiveViewModel.Collections);
        }
コード例 #4
0
        public async Task <IActionResult> Archive()
        {
            var categories = await Task.FromResult(_categoryManager.GetQueryable().ToList());

            var categoryModels = new List <CategoryViewModel>();

            foreach (var category in categories)
            {
                var cmodel = category.ToModel();

                cmodel.Count = await _categoryManager.GetPostCountAsync(category.Id, false);

                var posts = _postManager.GetQueryable().Where(t => !t.IsDraft && t.Categories.Any(c => c.CategoryId == category.Id)).ToList();

                cmodel.Posts = posts.Select(t => t.ToModel()).ToList();

                categoryModels.Add(cmodel);
            }

            var model = new ArchiveViewModel()
            {
                Categories = categoryModels,
            };

            model.NoCategoryPosts = _postManager.GetQueryable().Where(t => !t.IsDraft && t.Categories.Count == 0).ToList().Select(t => t.ToModel()).ToList();

            return(View(model));
        }
コード例 #5
0
        public ActionResult Index(int?categoryId)
        {
            var archiveCategories     = _archiveCategoryRepo.List();
            var archiveItemsToDisplay = _archiveItemRepo.Find(item => item.CategoryId == categoryId).ToList()
                                        .Select(a =>
            {
                a.ArchiveCategory = archiveCategories.FirstOrDefault(c => c.Id == a.CategoryId);
                return(a);
            }).OrderByDescending(a => a.PublishedOn).ToList();
            var archiveModel = new ArchiveViewModel
            {
                CategoryId        = categoryId ?? 0,
                ArchiveCategories = _archiveCategoryRepo.List()
                                    .OrderBy(_ => _.Name)
                                    .Select(a =>
                {
                    var archiveItems = _archiveItemRepo.Find(item => item.CategoryId == a.Id).ToList();
                    return(new ArchiveCategoryViewModel
                    {
                        ArchiveCategory = a,
                        Items = archiveItems
                    });
                }).ToList(),
                SelectedArchive = categoryId > 0 ? new ArchiveCategoryViewModel
                {
                    ArchiveCategory = archiveCategories.FirstOrDefault(_ => _.Id == categoryId),
                    Items           = archiveItemsToDisplay
                } : null
            };

            archiveModel.SelectedArchive?.Items.ForEach(item => LoadUploadedFiles(item));
            return(View(archiveModel));
        }
コード例 #6
0
        private static void ComposeObjects()
        {
            var api             = new ClientApi();
            var archiveVm       = new ArchiveViewModel();
            var commentsVm      = new CommentsViewModel();
            var newEmployeeVm   = new EmployeeViewModel();
            var employeesVm     = new EmployeesViewModel(newEmployeeVm);
            var loginVm         = new LoginViewModel(api);
            var forgetPasswodVm = new ForgetPasswordViewModel();
            var myTasksVm       = new MyTasksViewModel();
            var newTaskVm       = new NewTaskViewModel();
            var profileVm       = new ProfileViewModel();
            var trackingTasksVm = new TrackingTasksViewModel(newTaskVm);
            var reportsVm       = new ReportsViewModel();
            var mainWindowVm    = new MainWindowViewModel(archiveVm,
                                                          commentsVm,
                                                          employeesVm,
                                                          loginVm,
                                                          forgetPasswodVm,
                                                          myTasksVm,
                                                          profileVm,
                                                          reportsVm,
                                                          trackingTasksVm);

            Current.MainWindow = new MainWindow(mainWindowVm);
        }
コード例 #7
0
        public IActionResult Tag()
        {
            var model = new List <ArchiveViewModel>();
            var posts = _blogService.GetPublishedPosts();
            var tags  = _blogService.GetTags();

            foreach (var tag in tags)
            {
                var tagModel = new ArchiveViewModel(tag.Name, tag.Link);
                tagModel.Posts.AddRange(posts.Where(p => p.TagNames.Contains(tag.Name, StringComparer.OrdinalIgnoreCase)));

                model.Add(tagModel);
            }

            var remainingPosts = posts.Except(model.SelectMany(_ => _.Posts).Distinct()).ToList();

            if (remainingPosts.Any())
            {
                var tagModel = new ArchiveViewModel(BlogConstant.DefaultTagName, BlogConstant.DefaultTagLink);
                tagModel.Posts.AddRange(remainingPosts);
                model.Add(tagModel);
            }

            ViewData["Title"]       = "标签";
            ViewData["Canonical"]   = "/tag/";
            ViewData["Description"] = "所有文章以标签归类的形式展现";
            return(View("Index", model));
        }
コード例 #8
0
        public void ArchiveWindow(object sender, RoutedEventArgs e)
        {
            var archiveWindow    = new ArchiveWindow();
            var archiveViewModel = new ArchiveViewModel(DirectoryStructureViewModel.Selected);

            archiveWindow.DataContext = archiveViewModel;
            archiveWindow.Show();
        }
コード例 #9
0
        //print admin archive page
        public ActionResult ArchivePage()
        {
            // Load the list of data into the StudentList
            var myDataList       = ArchiveBackend.Index();
            var ArchiveViewModel = new ArchiveViewModel(myDataList);

            return(View(ArchiveViewModel));
        }
コード例 #10
0
        public ArchiveView()
        {
            InitializeComponent();
            string fullName = SessionManager.User.Name + " " + SessionManager.User.Surname;

            textBlockFullName.Text = fullName;
            var _archiveViewModel = new ArchiveViewModel();

            DataContext = _archiveViewModel;
        }
コード例 #11
0
        public IActionResult Search(ArchiveViewModel archive)
        {
            var ViewModel = new ArchiveViewModel()
            {
                Monafsas = monafasaData.GetByPeriodTime(archive.StartDate, archive.EndDate)
            };


            return(View("index", ViewModel));
        }
コード例 #12
0
        public override object PrepareViewModel()
        {
            var itemList           = _nccPostService.LoadArchive(DisplayOrder);
            ArchiveViewModel model = new ArchiveViewModel();

            model.ShowPostCount     = ShowPostCount;
            model.DisplayAsDropdown = DisplayAsDropdown;
            model.ItemList          = itemList;
            return(model);
        }
コード例 #13
0
        public IActionResult Index()
        {
            var ViewModel = new ArchiveViewModel()
            {
                Monafsas  = monafasaData.GetAll(),
                StartDate = DateTime.Now.Subtract(new TimeSpan(31, 0, 0, 0)),
                EndDate   = DateTime.Now
            };

            return(View(ViewModel));
        }
コード例 #14
0
        // Constructor
        public ArchiveController(ColibriDbContext colibriDbContext, IStringLocalizer <ArchiveController> localizer)
        {
            _colibriDbContext = colibriDbContext;
            _localizer        = localizer;

            // ViewModel
            ArchiveViewModel = new ArchiveViewModel()
            {
                ArchiveEntry = new ArchiveEntry()
            };
        }
コード例 #15
0
        public ActionResult Archive()
        {
            var model = new ArchiveViewModel()
            {
                Base       = GetBaseViewModel(),
                Categories = Category.Categories,
                NoCatList  = Be.Post.Posts.FindAll(delegate(Post p) { return(p.Categories.Count == 0 && p.IsVisible); })
            };

            return(View(model));
        }
コード例 #16
0
        //prikazivanje arhive faktura
        public ActionResult Archive()
        {
            var invoice     = _context.Invoice.ToList();
            var CurrentUser = User.Identity.GetUserId();
            var viewModel   = new ArchiveViewModel
            {
                CurrentUser = CurrentUser,
                Invoice     = invoice
            };

            return(View(viewModel));
        }
コード例 #17
0
ファイル: ArchiveWidget.cs プロジェクト: stantoxt/NetCoreCMS
        public override string RenderBody()
        {
            var itemList          = _nccPostService.LoadArchive(DisplayOrder);
            ArchiveViewModel item = new ArchiveViewModel();

            item.ShowPostCount     = ShowPostCount;
            item.DisplayAsDropdown = DisplayAsDropdown;
            item.ItemList          = itemList;
            var body = _viewRenderService.RenderToStringAsync <BlogController>(ViewFileName, item).Result;

            return(body);
        }
コード例 #18
0
        public ActionResult Archive(string id, int page = 1)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(this.HttpNotFound());
            }

            ArchiveViewModel model = new ArchiveViewModel();

            model.Tag = id;

            model.Posts = this.postService.GetPostsByTag(page, 10, id);

            return(this.View(model));
        }
コード例 #19
0
        public void ArchiveViewModel_ColorClass()
        {
            var viewModel = new ArchiveViewModel
            {
                ColorClassActiveList = new List <ColorClassParser.Color> {
                    ColorClassParser.Color.None
                },
                ColorClassUsage = new List <ColorClassParser.Color> {
                    ColorClassParser.Color.None
                }
            };

            Assert.AreEqual(ColorClassParser.Color.None, viewModel.ColorClassActiveList.FirstOrDefault());
            Assert.AreEqual(ColorClassParser.Color.None, viewModel.ColorClassUsage.FirstOrDefault());
        }
コード例 #20
0
        public ArchiveUC(EventHandler onRemove, EventHandler onEdit,
                         ArchiveViewModel archiveViewModel, UserBasicInformationViewModel userBasicInformation)
        {
            InitializeComponent();
            _onRemove             = onRemove;
            _onEdit               = onEdit;
            _userBasicInformation = userBasicInformation;

            if (_userBasicInformation.UserLevel < (int)EUserLevel.Admin)
            {
                btnDel.IsEnabled  = btnDel.IsEnabled = false;
                btnDel.Visibility = btnDel.Visibility = Visibility.Collapsed;
            }

            SetArchiveValues(archiveViewModel);
        }
コード例 #21
0
 public void SetData(ArchiveViewModel vm, int index)
 {
     SelectedIndex  = index;
     ArchivePostsVM = vm;
     try
     {
         RefreshControl.RefreshRequested -= RefreshControlRefreshRequested;
         RefreshControl.Visualizer.RefreshStateChanged -= RefreshControlRefreshStateChanged;
     }
     catch { }
     RefreshControl.RefreshRequested += RefreshControlRefreshRequested;
     if (RefreshControl.Visualizer != null)
     {
         RefreshControl.Visualizer.RefreshStateChanged += RefreshControlRefreshStateChanged;
     }
     LoadData();
 }
コード例 #22
0
        ////////////////////////////////////PRACTICE///////
        // GET: AndersonPayy/Edit/5
        //public ActionResult EditInvoice(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    EInvoice invoice = db.invoices.Find(id);
        //    if (invoice == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    ViewBag.id = id;
        //    ViewBag.CompanyName = new SelectList(db.Client, "CompanyName", "CompanyName", invoice.Name);
        //    ViewBag.TypeOfService = new SelectList(db.typeofservices, "typeofserviceId", "NameOfService", invoice.TypeOfService);
        //    return View(invoice);
        //}

        // POST: AndersonPayy/Edit/5
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult EditInvoice([Bind(Include = "invoiceId,Date,DueDate,Quantity,Rate,Amount,Total,TypeOfService,CompanyName,Recipients,GovernmentTax,gtholder,WithholdingTax,ExpiringPeriod,whtholder,Signature,LateFee,lfholder,Address,Comments,Currency,StartPeriod,totalTax,invIdholder,Status,Deleted")] EInvoice invoice, string Submit, string Comments)
        //{
        //    //DateTime date = DateTime.Today;
        //    //var seconddayofthemonth = new DateTime(date.Year, date.Month, 2);
        //    //var limited = invoice.ExpiringPeriod.AddMonths(1);

        //    //Converts everything from string to their definite var type
        //    var rateHldr = Convert.ToDecimal(invoice.Rate);
        //    var qtyHldr = Convert.ToInt32(invoice.Quantity);
        //    var lfHldr = Convert.ToDecimal(invoice.LateFee);

        //    //amount
        //    invoice.Amount = rateHldr * qtyHldr;
        //    //government tax


        //    //withholding tax
        //    //JEV WAS HERE NYAHAHA
        //    if (invoice.GovernmentTax == 12)
        //    {
        //        decimal x = invoice.Amount * invoice.GovernmentTax;
        //        invoice.gtholder = 12;
        //        decimal govtax = x / 100;
        //        invoice.GovernmentTax = govtax;
        //        invoice.WithholdingTax = 0;
        //        decimal y = invoice.Amount * invoice.WithholdingTax;
        //        invoice.whtholder = invoice.WithholdingTax;
        //        decimal whtax = y / 100;
        //        invoice.WithholdingTax = whtax;
        //    }

        //    if (invoice.WithholdingTax == 1)
        //    {

        //        invoice.WithholdingTax = 1;
        //        decimal wttax = invoice.WithholdingTax / 100;
        //        invoice.whtholder = wttax;
        //        Convert.ToDouble(invoice.Amount);
        //        decimal y = invoice.Amount * wttax;
        //        invoice.WithholdingTax = y;


        //    }
        //    else if (invoice.WithholdingTax == 2)
        //    {


        //        invoice.WithholdingTax = 2;
        //        decimal wttax = invoice.WithholdingTax / 100;
        //        invoice.whtholder = invoice.WithholdingTax;
        //        decimal y = invoice.Amount * wttax;
        //        invoice.WithholdingTax = y;



        //    }
        //    else if (invoice.WithholdingTax == 5)
        //    {


        //        invoice.WithholdingTax = 5;
        //        decimal wttax = invoice.WithholdingTax / 100;
        //        invoice.whtholder = wttax;
        //        Convert.ToDouble(invoice.Amount);
        //        decimal y = invoice.Amount * wttax;
        //        invoice.WithholdingTax = y;



        //    }
        //    else
        //    {

        //        invoice.WithholdingTax = 0;
        //        decimal wttax = invoice.WithholdingTax / 100;
        //        invoice.whtholder = wttax;
        //        Convert.ToDouble(invoice.Amount);
        //        decimal y = invoice.Amount * wttax;
        //        invoice.WithholdingTax = y;

        //    }


        //    //latefee
        //    decimal q = invoice.Amount * lfHldr;
        //    invoice.lfholder = lfHldr;
        //    decimal latefee = q / 100;
        //    lfHldr = latefee;
        //    invoice.LateFee = Convert.ToString(lfHldr);


        //    invoice.Comments = Comments;
        //    invoice.totalTax = invoice.gtholder + invoice.whtholder + invoice.lfholder;
        //    invoice.Total = invoice.Amount + invoice.GovernmentTax + invoice.WithholdingTax + latefee;

        //    //if (date == seconddayofthemonth)
        //    //{
        //    //    invoice.Status = "Overdue";
        //    //}
        //    //if (invoice.ExpiringPeriod < DateTime.Today)
        //    //{
        //    //    invoice.Status = "Overdue";
        //    //}
        //    //else
        //    //{
        //    invoice.Status = "Pending";
        //    //}

        //    if (ModelState.IsValid)
        //    {
        //        switch (Submit)
        //        {
        //            case "Preview":
        //                return RedirectToAction("PreviewInvoice", invoice);

        //            default:
        //                db.Entry(invoice).State = EntityState.Modified;
        //                db.SaveChanges();
        //                return RedirectToAction("EmailRedirect");
        //                //, new { id = invoice.invoiceId }
        //        }
        //    }
        //    ViewBag.CompanyName = new SelectList(db.Client, "CompanyName", "CompanyName", invoice.Name);
        //    ViewBag.TypeOfService = new SelectList(db.typeofservices, "typeofserviceId", "NameOfService", invoice.TypeOfService);
        //    return View(invoice);
        //}

        //TYPE OF SERVICE
        // GET: TypeOfServices/Create
        //public ActionResult Create()
        //{
        //    return PartialView();
        //}

        // POST: TypeOfServices/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Create([Bind(Include = "typeofserviceId,NameOfService")] ETypeOfService typeofservice)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.typeofservices.Add(typeofservice);
        //        db.SaveChanges();
        //        return RedirectToAction("CreateInvoice");
        //    }

        //    return RedirectToAction("CreateInvoice");
        //}

        //Home Page

        //public ActionResult Home()
        //{
        //    return View();
        //}

        public ViewResult SearchArchive(int?page, string search)
        {
            int id      = db.Archives.Max(a => a.SupportId);
            var results = from s in db.Archives where db.Archives.Contains(s) select s;

            if (!String.IsNullOrWhiteSpace(search))
            {
                var terms = search.Trim().Split(' ');
                results = results.Where(s => terms.Any(terms.Contains));
            }
            var MyViewModel = new ArchiveViewModel();

            MyViewModel.SupportId = id;


            return(View(results.Where(x => x.Name.Contains(search) || search == null).ToList().ToPagedList(page ?? 1, 30)));
        }
コード例 #23
0
        public ActionResult ArchiveData(ArchiveViewModel model)
        {
            List <SYS_ARCHIVE> list = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                string whereClause = " where 1=1 ";

                if (null != model.PROJECTNO)
                {
                    whereClause += " and PROJECTNO like '%" + model.PROJECTNO + "%' ";
                }
                if (null != model.PROJECTNAME)
                {
                    whereClause += " and PROJECTNAME like '%" + model.PROJECTNAME + "%' ";
                }
                if (null != model.BUILDORG)
                {
                    whereClause += " and BUILDORG like '%" + model.BUILDORG + "%' ";
                }
                if (null != model.BUILDADRESS)
                {
                    whereClause += " and BUILDADRESS like '%" + model.BUILDADRESS + "%' ";
                }
                if (null != model.ARCHIVENO)
                {
                    whereClause += " and ARCHIVENO like '%" + model.ARCHIVENO + "%' ";
                }

                if (null != model.ARCHIVETIMESTART)
                {
                    whereClause += " and ARCHIVETIME >= to_date('" + model.ARCHIVETIMESTART + "','yyyy-mm-dd') ";
                }
                if (null != model.ARCHIVETIMEEND)
                {
                    whereClause += " and ARCHIVETIME <= to_date('" + model.ARCHIVETIMEEND + "','yyyy-mm-dd') ";
                }
                list = orm.Query <SYS_ARCHIVE>(whereClause);
            }

            var jss = new System.Web.Script.Serialization.JavaScriptSerializer();

            System.Web.HttpContext.Current.Response.Write(jss.Serialize(new { rows = list }));
            System.Web.HttpContext.Current.Response.End();
            return(Json(new { rows = list }));
        }
コード例 #24
0
        public async Task <IActionResult> Index(ArchiveViewModel model)
        {
            // i18n
            ViewData["ArchiveEntries"]      = _localizer["ArchiveEntriesText"];
            ViewData["Back"]                = _localizer["BackText"];
            ViewData["CategoryGroup"]       = _localizer["CategoryGroupText"];
            ViewData["CategoryType"]        = _localizer["CategoryTypeText"];
            ViewData["CreatedOn"]           = _localizer["CreatedOnText"];
            ViewData["CreateEntry"]         = _localizer["CreateEntryText"];
            ViewData["Create"]              = _localizer["CreateText"];
            ViewData["EditEntry"]           = _localizer["EditEntryText"];
            ViewData["IsOffer"]             = _localizer["IsOfferText"];
            ViewData["NewEntry"]            = _localizer["NewEntryText"];
            ViewData["Title"]               = _localizer["TitleText"];
            ViewData["TypeOfCategoryGroup"] = _localizer["TypeOfCategoryGroupText"];
            ViewData["Update"]              = _localizer["UpdateText"];
            ViewData["DeleteEntry"]         = _localizer["DeleteEntryText"];
            ViewData["Delete"]              = _localizer["DeleteText"];

            ArchiveViewModel.ArchiveEntryList = await _colibriDbContext.ArchiveEntry.Include(m => m.CategoryGroups).Include(m => m.CategoryTypes).ToListAsync();

            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(Index)));
            }

            // Prüfen, ob Suchbegriff für Titel existiert
            if (!string.IsNullOrEmpty(model.SearchTitle))
            {
                ArchiveViewModel.ArchiveEntryList = ArchiveViewModel.ArchiveEntryList.Where(m => m.Name.Contains(model.SearchTitle));
            }
            // Prüfen, ob Suchbegriff für Rubrik-Gruppe existiert
            if (!string.IsNullOrEmpty(model.SearchCategoryGroup))
            {
                ArchiveViewModel.ArchiveEntryList = ArchiveViewModel.ArchiveEntryList.Where(m => m.CategoryGroups.Name.Contains(model.SearchCategoryGroup));
            }

            // Prüfen, ob Suchbegriff für Rubrik existiert
            if (!string.IsNullOrEmpty(model.SearchCategoryType))
            {
                ArchiveViewModel.ArchiveEntryList = ArchiveViewModel.ArchiveEntryList.Where(m => m.CategoryTypes.Name.Contains(model.SearchCategoryType));
            }

            // Return View
            return(View(ArchiveViewModel));
        }
コード例 #25
0
        public ActionResult Arcive(int id, HttpPostedFileBase uploadFile)
        {
            var fileName = $"BookId_{id}_{uploadFile.FileName}";
            var archive  = new ArchiveViewModel
            {
                Id       = id,
                FilePath = fileName,
                BookId   = id
            };

            var archiveMap = _mapper.Map <ArchiveModel>(archive);

            _fileStorage.CreateArchive(fileName, uploadFile.InputStream);
            _bookService.AddArchive(id, archiveMap);

            return(RedirectToAction("Index"));
        }
コード例 #26
0
ファイル: HomeController.cs プロジェクト: atadi96/felev6
        public IActionResult Archive(ArchiveViewModel archive)
        {
            int                  articlesPerPage = 20;
            DateTime?            dateTime        = archive.DateTime;
            IQueryable <Article> articles        =
                _context.Articles
                .OrderByDescending(art => art.Modified)
                .Where(art => (String.IsNullOrWhiteSpace(archive.TitleSearch) ||
                               art.Title.Contains(archive.TitleSearch)) &&
                       (String.IsNullOrWhiteSpace(archive.ContentSearch) ||
                        art.Content.Contains(archive.ContentSearch))
                       ).Where(art =>
                               dateTime == null || art.Modified.Date == dateTime.Value.Date
                               );

            archive.UpdatePageContents(articlesPerPage, articles);
            return(View("Archive", archive));
        }
コード例 #27
0
        public ArchiveDetailWindow(EventHandler modified,
                                   ArchiveViewModel archiveViewModel,
                                   ItemsMonitoringService itemsMonitoringService,
                                   UserBasicInformationViewModel userBasicInformation)
        {
            _onModified             = modified;
            _archiveViewModel       = archiveViewModel;
            _itemsMonitoringService = itemsMonitoringService;
            _userBasicInformation   = userBasicInformation;
            InitializeComponent();
            Populate();


            if (_userBasicInformation.UserLevel < (int)EUserLevel.Admin)
            {
                btnEdit.IsEnabled  = false;
                btnEdit.Visibility = Visibility.Collapsed;
            }
        }
コード例 #28
0
        public async Task <ActionResult> ArchiveDetails(string id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            if (await GetAssetStatus(id) != ArchiveProcessingStates.Processed)
            {
                return(NoContent());
            }

            var assetModel = await GetAssetById(id);

            if (assetModel == null)
            {
                return(NotFound());
            }

            var url = await GetAssetUri(assetModel);

            List <string> files = new List <string>();

            if (!string.IsNullOrWhiteSpace(assetModel.AssetMeta))
            {
                try {
                    files = JsonConvert.DeserializeObject <List <string> >(assetModel.AssetMeta);
                }
                catch (Exception ex) {
                    _logger.LogError(ex, "Bad meta data for asset " + id);
                }
            }


            var avm = new ArchiveViewModel {
                Id       = assetModel.Id,
                AssetUrl = url,
                RootFile = assetModel.StorageLocation,
                Files    = files
            };

            return(View(avm));
        }
コード例 #29
0
        public IActionResult Date()
        {
            var model = new List <ArchiveViewModel>();
            var posts = _blogService.GetPublishedPosts();
            var dates = posts.Select(_ => _.CreationTimeUtc.Year).Distinct();

            foreach (var date in dates)
            {
                var catModel = new ArchiveViewModel($"{date} 年", date.ToString());
                catModel.Posts.AddRange(posts.Where(p => p.CreationTimeUtc.Year == date).OrderByDescending(p => p.CreationTimeUtc));

                model.Add(catModel);
            }

            ViewData["Title"]       = "存档";
            ViewData["Canonical"]   = "/archive/";
            ViewData["Description"] = "所有文章以发表日期归类的形式展现";
            return(View("Index", model.OrderByDescending(m => m.Name)));
        }
コード例 #30
0
        public ActionResult Archive(int?year, int?month, int page = 1)
        {
            if (year == null || month == null)
            {
                this.Logger.WarnFormat("Possible wrong link : {0} - The referref is {1}", this.HttpContext.Request.Url, this.HttpContext.Request.UrlReferrer);

                return(this.HttpNotFound());
            }

            if (year < 1900 || month < 1)
            {
                return(this.HttpNotFound());
            }

            ArchiveViewModel model = new ArchiveViewModel();

            model.Posts = this.postService.GetPostsByDate(page, 10, year.Value, month, null, null);

            return(this.View(model));
        }