private void Add() { if (!AllItems.Any(x => x.IsEmpty)) { AllItems.Add(new NamespaceItem()); } }
private void Add() { if (!AllItems.Any(x => x.IsEmpty)) { AllItems.Insert(0, new NamespaceItem("")); } }
protected override IQueryable <GeoInformation> BaseQuery(IFetchStrategy <GeoInformation> fetchStrategy = null) { if (!AllItems.Any()) { LoadItems(FileNames); } return(AllItems.AsQueryable <GeoInformation>()); }
private void AddUniqueItemsFrom <T>(List <T> items) where T : CatalogItemModel { var uniqueItems = items.Where(i => !AllItems.Any(a => a.Sku.Equals(i.Sku))).ToList(); if (uniqueItems.Any()) { AllItems.AddRange(uniqueItems); } }
internal override void ValidateCollectionStateBeforeSave() { base.ValidateCollectionStateBeforeSave(); // If there are no recipients but the document contains loaded encrypted content keys, they will remain encrypted. if (!AllItems.Any() && Document.ContentKeys.LoadedItems.Any(key => key.IsLoadedEncryptedKey)) { throw new InvalidOperationException("You cannot remove all recipients from a CPIX document that contains loaded encrypted content keys. If you wish to convert all such keys to clear keys, you must first remove and re-add them to the document to signal that intent."); } }
public void NewButton_Pressed(object sender, RoutedEventArgs e) { if (!AllItems.Any() || AllItems.Count == ComboBoxBindingSources.Count) { return; } var remainingItems = AllItems.Where(x => ChosenItems.All(y => x.ID != y.ID)).ToList(); ComboBoxBindingSources.Add(new ComboBoxBindingSource(remainingItems.First(), remainingItems)); RefreshAvailableItems(); }
protected override void ValidateCollectionStateBeforeAdd(Recipient entity) { base.ValidateCollectionStateBeforeAdd(entity); if (AllItems.Any(i => i.Certificate == entity.Certificate || i.Certificate.Thumbprint == entity.Certificate.Thumbprint)) { throw new InvalidOperationException("The collection already contains a recipient identified by the same certificate."); } // If there were no recipients before and we just added one, this means that keys will from now on be encrypted. // We thus need to make sure that all keys are new keys - loaded keys that remain clear are not tolerable! if (!AllItems.Any() && Document.ContentKeys.LoadedItems.Any()) { throw new InvalidOperationException("You cannot add a recipient to a CPIX document that contains loaded clear content keys. If you wish to encrypt all such keys, you must first remove and re-add them to the document to signal that intent."); } }
public ActionResult Index(int?pageNo, string filter) { if (filter == null && TempData["filter"] != null) { filter = TempData["filter"].ToString(); } TempData.Remove("pricefilter"); TempData.Remove("search"); TempData.Remove("category"); int pageNumber; if (TempData["PageNumber"] == null) { pageNumber = 1; TempData["PageNumber"] = 1; } else { if (pageNo == 1) { pageNumber = Convert.ToInt32(TempData["PageNumber"]) + 1; TempData["PageNumber"] = pageNumber; } else if (pageNo == -1) { pageNumber = Convert.ToInt32(TempData["PageNumber"]) - 1; TempData["PageNumber"] = pageNumber; } else { pageNumber = 1; TempData["PageNumber"] = pageNumber; } } if (pageNumber < 1) { pageNumber = 1; TempData["PageNumber"] = 1; } pageNumber = (pageNumber - 1) * pageSize; IEnumerable <Item> AllItems; if (filter != null) { if (filter == "1") { TempData["filter"] = "1"; AllItems = _context.Items.OrderByDescending(item => item.Price).Skip(pageNumber).Take(pageSize).ToList(); } else { TempData["filter"] = "2"; AllItems = _context.Items.OrderBy(item => item.Price).Skip(pageNumber).Take(pageSize).ToList(); } } else { AllItems = _context.Items.OrderBy(item => item.Id).Skip(pageNumber).Take(pageSize).ToList(); } if (AllItems.Any() == false) { return(View("ProductSearchEnded")); } TempData.Keep(); return(View(AllItems)); }