private void btnDelete_Click(object sender, EventArgs e) { PackageRepo db = new PackageRepo(); if (lstOrder.SelectedIndex == -1) { return; } var seciliPaketSil = lstOrder.SelectedItem as Package; foreach (var item in db.GetAll()) { if (item.OrderId == seciliPaketSil.OrderId) { db.Delete(seciliPaketSil); break; } } lstOrder.Items.Clear(); lstOrder.Items.AddRange(db.GetAll(x => x.OrderId == (cmbOrderName.SelectedItem as Order).OrderId).ToArray()); FormHelper.FormuTemizle(this); cmbPackageProduct.SelectedIndex = -1; SiparisFiyatHesapla(); }
protected override FeedContext <V2FeedPackage> CreateDataSource() { return(new FeedContext <V2FeedPackage> { Packages = PackageRepo.GetAll().Where(p => p.StatusForDatabase == submittedStatus).WithoutVersionSort().ToV2FeedPackageQuery(GetSiteRoot()) }); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { var packages = PackageRepo.GetAll() .Where(p => p.StatusForDatabase == PackageStatusType.Submitted.GetDescriptionOrValue()); return(SearchCore(packages, searchTerm, targetFramework, includePrerelease).ToV2FeedPackageQuery(GetSiteRoot())); }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { var packages = PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id) && (p.StatusForDatabase != _rejectedStatus || p.StatusForDatabase == null)); //if (searchService.ContainsAllVersions) //{ // return NugetGallery.Cache.Get( // string.Format("V2Feed-FindPackagesById-{0}", id.to_lower()), // DateTime.UtcNow.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED), // () => // { // var searchFilter = GetSearchFilter(searchService.ContainsAllVersions, HttpContext.Request.RawUrl, id, includePrerelease: true); // // Find packages by Id specific items // searchFilter.ExactIdOnly = true; // searchFilter.TakeAllResults = true; // searchFilter.SortProperty = SortProperty.Version; // searchFilter.SortDirection = SortDirection.Descending; // return SearchCore(packages, id, string.Empty, includePrerelease: true, searchFilter: searchFilter, useCache: true) // .ToV2FeedPackageQuery(GetSiteRoot()) // .ToList(); // }).AsQueryable(); //} return(NugetGallery.Cache.Get( string.Format("V2Feed-FindPackagesById-{0}", id.to_lower()), DateTime.UtcNow.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED * 3), () => packages .ToV2FeedPackageQuery(GetSiteRoot()) .ToList() ).AsQueryable()); }
private void SiparisFiyatHesapla() { if (cmbOrderName.SelectedIndex == -1) { return; } PackageRepo db = new PackageRepo(); OrderRepo dbOrder = new OrderRepo(); foreach (var item1 in dbOrder.GetAll()) { decimal total = 0; if (cmbOrderName.SelectedItem.ToString() == item1.OrderName.ToString()) { foreach (var item in db.GetAll()) { if (item.OrderId == (cmbOrderName.SelectedItem as Order).OrderId) { total += item.PackagePurchasingPrice; } } lblOrderPriceText.Text = total.ToString(); break; } } }
protected virtual IQueryable <Package> SearchCore(string searchTerm, string targetFramework, bool includePrerelease) { // Filter out unlisted packages when searching. We will return it when a generic "GetPackages" request comes and filter it on the client. var packages = PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Include(x => x.Authors) .Include(x => x.PackageRegistration.Owners) .Where(p => p.Listed); if (String.IsNullOrEmpty(searchTerm)) { return(packages); } var request = new HttpRequestWrapper(HttpContext.Current.Request); SearchFilter searchFilter; // We can only use Lucene if the client queries for the latest versions (IsLatest \ IsLatestStable) versions of a package. if (TryReadSearchFilter(request, out searchFilter)) { searchFilter.SearchTerm = searchTerm; searchFilter.IncludePrerelease = includePrerelease; return(GetResultsFromSearchService(packages, searchFilter)); } return(packages.Search(searchTerm)); }
private void FormControlleriDoldur() { PackageRepo db = new PackageRepo(); ProductRepo dbpro = new ProductRepo(); var seciliPaket = lstOrder.SelectedItem as Package; foreach (var item in db.GetAll()) { if (item.ProductId == seciliPaket.ProductId) { cmbPackageProduct.SelectedItem = item.Product; txtPackageBarcode.Text = item.PackageBarcode; txtPackageName.Text = item.PackageName; nmOrderQuantity.Value = item.PackageProductQuantity; foreach (var item1 in dbpro.GetAll()) { if (item1.ProductPurchasingPrice == seciliPaket.PackagePurchasingPrice) { txtOrderPackagePrice.Text = (item1.ProductPurchasingPrice * item.PackageProductQuantity).ToString(); } } } } }
public IQueryable <V1FeedPackage> Search(string searchTerm, string targetFramework) { // Only allow listed stable releases to be returned when searching the v1 feed. return(PackageRepo.GetAll() .Where(p => !p.IsPrerelease && p.Listed) .Search(searchTerm) .ToV1FeedPackageQuery(Configuration.SiteRoot)); }
protected override FeedContext <V2FeedPackage> CreateDataSource() { return(new FeedContext <V2FeedPackage> { Packages = PackageRepo.GetAll() .ToV2FeedPackageQuery(Configuration.SiteRoot) }); }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { return (PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase) && p.StatusForDatabase == submittedStatus) .ToV2FeedPackageQuery(GetSiteRoot())); }
protected override FeedContext <V2FeedPackage> CreateDataSource() { return(new FeedContext <V2FeedPackage> { Packages = PackageRepo.GetAll() .WithoutVersionSort() .ToV2FeedPackageQuery(Configuration.GetSiteRoot(UseHttps())) }); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { var packages = PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Include(p => p.PackageRegistration.Owners) .Where(p => p.Listed); return(SearchCore(packages, searchTerm, targetFramework, includePrerelease).ToV2FeedPackageQuery(GetSiteRoot())); }
protected override FeedContext <V1FeedPackage> CreateDataSource() { return(new FeedContext <V1FeedPackage> { Packages = PackageRepo.GetAll() .Where(p => !p.IsPrerelease) .ToV1FeedPackageQuery(Configuration.SiteRoot) }); }
public IQueryable <V1FeedPackage> Search(string searchTerm, string targetFramework) { var packages = PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Include(p => p.PackageRegistration.Owners) .Where(p => p.Listed && !p.IsPrerelease); // For v1 feed, only allow stable package versions. packages = SearchCore(packages, searchTerm, targetFramework, includePrerelease: false); return(packages.ToV1FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { var packages = PackageRepo.GetAll().Where(p => p.StatusForDatabase == PackageStatusType.Submitted.GetDescriptionOrValue()); var packageVersions = SearchCore(packages, searchTerm, targetFramework, includePrerelease, SearchFilter.Empty()).ToV2FeedPackageQuery(GetSiteRoot()).ToList(); if (!includePrerelease) { return(packageVersions.Where(p => !p.IsPrerelease).AsQueryable()); } return(packageVersions.AsQueryable()); }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { var rejectedStatus = PackageStatusType.Rejected.GetDescriptionOrValue(); return(NugetGallery.Cache.Get( string.Format("V2Feed-FindPackagesById-{0}", id.to_lower()), DateTime.UtcNow.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED), () => PackageRepo.GetAll().Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase) && (p.StatusForDatabase != rejectedStatus || p.StatusForDatabase == null)) .ToV2FeedPackageQuery(GetSiteRoot()) .ToList().AsQueryable())); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { // Filter out unlisted packages when searching. We will return it when a generic "GetPackages" request comes and filter it on the client. var packages = PackageRepo.GetAll().Where(p => p.Listed); if (!includePrerelease) { packages = packages.Where(p => !p.IsPrerelease); } return(packages.Search(searchTerm) .ToV2FeedPackageQuery(Configuration.SiteRoot)); }
public IQueryable <V1FeedPackage> Search(string searchTerm, string targetFramework) { // Only allow listed stable releases to be returned when searching the v1 feed. var packages = PackageRepo.GetAll().Where(p => !p.IsPrerelease && p.Listed); if (String.IsNullOrEmpty(searchTerm)) { return(packages.ToV1FeedPackageQuery(Configuration.SiteRoot)); } return(SearchService.Search(packages, searchTerm) .ToV1FeedPackageQuery(Configuration.SiteRoot)); }
private void PaketleriGetirMalKabul() { if (cmbGoodsAcceptanceOrders.SelectedIndex == -1) { return; } ProductRepo dbpro = new ProductRepo(); OrderRepo dbord = new OrderRepo(); PackageRepo dbpck = new PackageRepo(); var orders = new List <OrderViewModel>(); try { foreach (var item in dbord.GetAll()) { if (item.OrderId == (cmbGoodsAcceptanceOrders.SelectedItem as Order).OrderId) { foreach (var item1 in dbpck.GetAll()) { if (item1.OrderId == item.OrderId) { foreach (var item2 in dbpro.GetAll()) { if (item2.ProductId == item1.ProductId) { orders.Add(new OrderViewModel() { PackageName = item1.PackageName, PackageBarcode = item1.PackageBarcode, PackageId = item1.PackageId, ProductId = item2.ProductId, ProductStock = item2.ProductStock, PackageProductQuantity = item1.PackageProductQuantity }); } } } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } cmbOrderProduct.Items.Clear(); cmbOrderProduct.Items.AddRange(orders.ToArray()); }
public IQueryable <V2FeedPackage> GetUpdates(string packageIds, string versions, bool includePrerelease, bool includeAllVersions, string targetFrameworks) { if (String.IsNullOrEmpty(packageIds) || String.IsNullOrEmpty(versions)) { return(Enumerable.Empty <V2FeedPackage>().AsQueryable()); } var idValues = packageIds.Trim().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var versionValues = versions.Trim().Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var targetFrameworkValues = String.IsNullOrEmpty(targetFrameworks) ? null : targetFrameworks.Split('|').Select(VersionUtility.ParseFrameworkName).ToList(); if ((idValues.Length == 0) || (idValues.Length != versionValues.Length)) { // Exit early if the request looks invalid return(Enumerable.Empty <V2FeedPackage>().AsQueryable()); } var versionLookup = new Dictionary <string, SemanticVersion>(idValues.Length, StringComparer.OrdinalIgnoreCase); for (int i = 0; i < idValues.Length; i++) { var id = idValues[i]; SemanticVersion version; SemanticVersion currentVersion; if (SemanticVersion.TryParse(versionValues[i], out currentVersion) && (!versionLookup.TryGetValue(id, out version) || (currentVersion > version))) { // If we've never added the package to lookup or we encounter the same id but with a higher version, then choose the higher version. versionLookup[id] = currentVersion; } } var packages = PackageRepo.GetAll() .Include(p => p.PackageRegistration) .Include(p => p.SupportedFrameworks) .Where(p => p.Listed && (includePrerelease || !p.IsPrerelease) && idValues.Contains(p.PackageRegistration.Id)) .OrderBy(p => p.PackageRegistration.Id); //GetUpdates(string packageIds, string versions, bool includePrerelease, bool includeAllVersions, string targetFrameworks return (NugetGallery.Cache.Get( string.Format("V2Feed-GetUpdates-{0}-{1}-{2}-{3}", string.Join("|", idValues).to_lower(), string.Join("|", versionValues).to_lower(), includePrerelease, includeAllVersions), DateTime.UtcNow.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED), () => GetUpdates(packages, versionLookup, targetFrameworkValues, includeAllVersions).AsQueryable().ToV2FeedPackageQuery(GetSiteRoot()).ToList().AsQueryable())); //return searchResults.AsQueryable(); //return GetUpdates(packages, versionLookup, targetFrameworkValues, includeAllVersions).AsQueryable().ToV2FeedPackageQuery(GetSiteRoot()); }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { return(Cache.Get(string.Format("V2Feed-FindPackagesById-{0}", id), DateTime.Now.AddMinutes(Cache.DEFAULT_CACHE_TIME_MINUTES), () => PackageRepo.GetAll().Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) .ToV2FeedPackageQuery(GetSiteRoot()) .ToList().AsQueryable())); //return PackageRepo.GetAll().Include(p => p.PackageRegistration) // .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) // .ToV2FeedPackageQuery(GetSiteRoot()); }
private void btnUpdate_Click(object sender, EventArgs e) { if (lstOrder.SelectedIndex == -1) { return; } PackageRepo packagedb = new PackageRepo(); ProductRepo productdb = new ProductRepo(); var seciliPaketGuncelle = lstOrder.SelectedItem as Package; foreach (var item in packagedb.GetAll()) { if (item.ProductId == seciliPaketGuncelle.ProductId) { foreach (var item2 in productdb.GetAll()) { if (item2.ProductId == seciliPaketGuncelle.ProductId) { item2.ProductStock = Convert.ToInt32(nmOrderQuantity.Value); item2.ProductSellingPrice = (item2.ProductPurchasingPrice * (1 + 0.18m)); } } break; } } seciliPaketGuncelle.PackageName = txtPackageName.Text; seciliPaketGuncelle.ProductId = (cmbPackageProduct.SelectedItem as Product).ProductId; seciliPaketGuncelle.OrderId = (cmbOrderName.SelectedItem as Order).OrderId; seciliPaketGuncelle.PackagePurchasingPrice = Convert.ToDecimal(txtOrderPackagePrice.Text); seciliPaketGuncelle.PackageProductQuantity = Convert.ToInt32(nmOrderQuantity.Value); seciliPaketGuncelle.PackageBarcode = txtPackageBarcode.Text; SiparisFiyatHesapla(); packagedb.Update(); productdb.Update(); PaketleriGetir(); MessageBox.Show($"Güncelleme başarılı"); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { var packages = PackageRepo.GetAll() .Include(p => p.Authors) .Include(p => p.PackageRegistration) .Include(p => p.PackageRegistration.Owners) .Where(p => p.Listed); var packageVersions = Cache.Get(string.Format("V2Feed-Search-{0}", includePrerelease), DateTime.Now.AddMinutes(Cache.DEFAULT_CACHE_TIME_MINUTES), () => includePrerelease ? packages.Where(p => p.IsLatest).ToList() : packages.Where(p => p.IsLatestStable).ToList() ); return(SearchCore(packageVersions.AsQueryable(), searchTerm, targetFramework, includePrerelease) .ToV2FeedPackageQuery(GetSiteRoot()) .ToList() .AsQueryable()); //return SearchCore(packages, searchTerm, targetFramework, includePrerelease).ToV2FeedPackageQuery(GetSiteRoot()); }
public IQueryable <V1FeedPackage> FindPackagesById(string id) { return(PackageRepo.GetAll().Include(p => p.PackageRegistration) .Where(p => !p.IsPrerelease && p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) .ToV1FeedPackageQuery(Configuration.GetSiteRoot(UseHttps()))); }
public IQueryable <V2FeedPackage> Search(string searchTerm, string targetFramework, bool includePrerelease) { var packages = PackageRepo.GetAll() .Include(p => p.Authors) .Include(p => p.PackageRegistration) .Include(p => p.PackageRegistration.Owners) .Where(p => p.Listed); // Check if the caller is requesting packages or calling the count operation. bool requestingCount = HttpContext.Request.RawUrl.Contains("$count"); var isEmptySearchTerm = string.IsNullOrEmpty(searchTerm); if ((requestingCount && isEmptySearchTerm) || isEmptySearchTerm) { // Fetch the cache key for the empty search query. string cacheKey = GetCacheKeyForEmptySearchQuery(includePrerelease); IQueryable <V2FeedPackage> searchResults; DateTime lastModified; var cachedObject = HttpContext.Cache.Get(cacheKey); var currentDateTime = DateTime.UtcNow; if (cachedObject == null && !requestingCount) { searchResults = SearchV2FeedCore(packages, searchTerm, targetFramework, includePrerelease, useCache: false); lastModified = currentDateTime; // cache the most common search query // note: this is per instance cache var cachedPackages = searchResults.ToList(); // don't cache empty results in case we missed any potential ODATA expressions if (!cachedPackages.Any()) { var cachedSearchResult = new CachedSearchResult(); cachedSearchResult.LastModified = currentDateTime; cachedSearchResult.Packages = cachedPackages; HttpContext.Cache.Add( cacheKey, cachedSearchResult, null, currentDateTime.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED), Cache.NoSlidingExpiration, CacheItemPriority.Default, null); } } else if (cachedObject == null) { // first hit on $count and nothing in cache yet; // we can't cache due to the $count hijack in SearchV2FeedCore... return(SearchV2FeedCore(packages, searchTerm, targetFramework, includePrerelease, useCache: false)); } else { var cachedSearchResult = (CachedSearchResult)cachedObject; searchResults = cachedSearchResult.Packages.AsQueryable(); lastModified = cachedSearchResult.LastModified; } // Clients should cache twice as long. // This way, they won't notice differences in the short-lived per instance cache. HttpContext.Response.Cache.SetCacheability(HttpCacheability.Public); HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromSeconds(60)); HttpContext.Response.Cache.SetExpires(currentDateTime.AddSeconds(DEFAULT_CACHE_TIME_SECONDS_V2FEED * 2)); HttpContext.Response.Cache.SetLastModified(lastModified); HttpContext.Response.Cache.SetValidUntilExpires(true); return(searchResults); } return(SearchV2FeedCore(packages, searchTerm, targetFramework, includePrerelease, useCache: true)); }
private void btnOrderSave_Click(object sender, EventArgs e) { if (cmbOrderProduct.SelectedIndex == -1) { return; } bool control = false; var products = new List <PackageViewModel>(); Package package = new Package(); var seciliPaket = ((cmbOrderProduct.SelectedItem as OrderViewModel).PackageId); try { products.AddRange(new PackageRepo().GetAll() .OrderBy(x => x.PackageName) .Where(x => x.PackageId == seciliPaket) .Select(x => new PackageViewModel() { PackageName = x.PackageName, PackageBarcode = x.PackageBarcode, PackageProductQuantity = x.PackageProductQuantity })); } catch (Exception ex) { MessageBox.Show(ex.Message); } foreach (var item in products) { lstGoodAcceptance.Items.Add(item); } var orders = new List <OrderViewModel>(); try { orders.AddRange(new PackageRepo().GetAll() .OrderBy(x => x.PackageName) .Select(x => new OrderViewModel() { PackageName = x.PackageName, PackageBarcode = x.PackageBarcode, PackageId = x.PackageId })); } catch (Exception ex) { MessageBox.Show(ex.Message); } PackageRepo pr = new PackageRepo(); ProductRepo prodb = new ProductRepo(); var seciliPaket1 = cmbOrderProduct.SelectedItem as OrderViewModel; foreach (var item in pr.GetAll()) { foreach (var item1 in prodb.GetAll()) { if (item.ProductId == item1.ProductId) { if (seciliPaket1.ProductId == item1.ProductId) { item1.ProductStock += seciliPaket1.PackageProductQuantity; item1.ProductSellingPrice = (item1.ProductPurchasingPrice * (1 + 0.18m)); } } } } pr.Update(); prodb.Update(); cmbOrderProduct.Items.Clear(); cmbOrderProduct.Items.AddRange(new List <Package>().ToArray()); PackageRepo db = new PackageRepo(); var orders1 = db.GetAll(x => x.OrderId == (cmbGoodsAcceptanceOrders.SelectedItem as Order).OrderId); foreach (var item in orders) { foreach (var item1 in orders1) { if (item.PackageId == seciliPaket && item.PackageId == item1.PackageId) { orders.Remove(item); db.Delete(item1); control = true; break; } } if (control == true) { break; } } control = false; db.Update(); cmbOrderProduct.Items.Clear(); cmbOrderProduct.Items.AddRange(orders.ToArray()); cmbOrderProduct.SelectedIndex = -1; cmbOrderProduct.Text = ""; }
public IQueryable <V2FeedPackage> FindPackagesById(string id) { return(PackageRepo.GetAll().Include(p => p.PackageRegistration) .Where(p => p.PackageRegistration.Id.Equals(id, StringComparison.OrdinalIgnoreCase)) .ToV2FeedPackageQuery(Configuration.SiteRoot)); }