當前位置: 首頁>>代碼示例>>C#>>正文


C# Kendoui.DataSourceRequest類代碼示例

本文整理匯總了C#中Nop.Web.Framework.Kendoui.DataSourceRequest的典型用法代碼示例。如果您正苦於以下問題:C# DataSourceRequest類的具體用法?C# DataSourceRequest怎麽用?C# DataSourceRequest使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataSourceRequest類屬於Nop.Web.Framework.Kendoui命名空間,在下文中一共展示了DataSourceRequest類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SubscriptionList

		public ActionResult SubscriptionList(DataSourceRequest command, NewsLetterSubscriptionListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNewsletterSubscribers))
                return AccessDeniedView();

            bool? isActive = null;
            if (model.ActiveId == 1)
                isActive = true;
            else if (model.ActiveId == 2)
                isActive = false;

            var newsletterSubscriptions = _newsLetterSubscriptionService.GetAllNewsLetterSubscriptions(model.SearchEmail,
                model.StoreId, isActive, command.Page - 1, command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data = newsletterSubscriptions.Select(x =>
				{
					var m = x.ToModel();
				    var store = _storeService.GetStoreById(x.StoreId);
				    m.StoreName = store != null ? store.Name : "Unknown store";
					m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
					return m;
				}),
                Total = newsletterSubscriptions.TotalCount
            };

            return Json(gridModel);
		}
開發者ID:jasonholloway,項目名稱:brigita,代碼行數:29,代碼來源:NewsLetterSubscriptionController.cs

示例2: QueuedEmailList

		public ActionResult QueuedEmailList(DataSourceRequest command, QueuedEmailListModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue))
                return AccessDeniedView();

            DateTime? startDateValue = (model.SearchStartDate == null) ? null
                            : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone);

            DateTime? endDateValue = (model.SearchEndDate == null) ? null 
                            :(DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1);

            var queuedEmails = _queuedEmailService.SearchEmails(model.SearchFromEmail, model.SearchToEmail, 
                startDateValue, endDateValue, 
                model.SearchLoadNotSent, model.SearchMaxSentTries, true,
                command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = queuedEmails.Select(x => {
                    var m = x.ToModel();
                    m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
                    if (x.SentOnUtc.HasValue)
                        m.SentOn = _dateTimeHelper.ConvertToUserTime(x.SentOnUtc.Value, DateTimeKind.Utc);
                    return m;
                }),
                Total = queuedEmails.TotalCount
            };
			return new JsonResult
			{
				Data = gridModel
			};
		}
開發者ID:haithemChkel,項目名稱:nopCommerce_33,代碼行數:31,代碼來源:QueuedEmailController.cs

示例3: List

        public ActionResult List(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
                return Content("Access denied");

            var pickupPoints = _storePickupPointService.GetAllStorePickupPoints();
            var model = pickupPoints.Select(x =>
            {
                var store = _storeService.GetStoreById(x.StoreId);
                return new StorePickupPointModel
                {
                    Id = x.Id,
                    Name = x.Name,
                    OpeningHours = x.OpeningHours,
                    PickupFee = x.PickupFee,
                    StoreName = store != null ? store.Name
                        : x.StoreId == 0 ? _localizationService.GetResource("Admin.Configuration.Settings.StoreScope.AllStores") : string.Empty
                };
            }).ToList();

            return Json(new DataSourceResult
            {
                Data = model,
                Total = pickupPoints.TotalCount
            });
        }
開發者ID:Xzelsius,項目名稱:nopCommerce,代碼行數:26,代碼來源:PickupInStoreController.cs

示例4: AffiliatedCustomerList

        public ActionResult AffiliatedCustomerList(int affiliateId, DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAffiliates))
                return AccessDeniedView();

            var affiliate = _affiliateService.GetAffiliateById(affiliateId);
            if (affiliate == null)
                throw new ArgumentException("No affiliate found with the specified id");

            var customers = _customerService.GetAllCustomers(
                affiliateId: affiliate.Id,
                pageIndex: command.Page - 1,
                pageSize: command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = customers.Select(customer =>
                    {
                        var customerModel = new AffiliateModel.AffiliatedCustomerModel();
                        customerModel.Id = customer.Id;
                        customerModel.Name = customer.Email;
                        return customerModel;
                    }),
                Total = customers.TotalCount
            };

            return Json(gridModel);
        }
開發者ID:aumankit,項目名稱:nop,代碼行數:27,代碼來源:AffiliateController.cs

示例5: List

        public ActionResult List(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
                return AccessDeniedView();

            var customers = _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-_customerSettings.OnlineCustomerMinutes),
                null, command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = customers.Select(x => new OnlineCustomerModel
                {
                    Id = x.Id,
                    CustomerInfo = x.IsRegistered() ? x.Email : _localizationService.GetResource("Admin.Customers.Guest"),
                    LastIpAddress = x.LastIpAddress,
                    Location = _geoLookupService.LookupCountryName(x.LastIpAddress),
                    LastActivityDate = _dateTimeHelper.ConvertToUserTime(x.LastActivityDateUtc, DateTimeKind.Utc),
                    LastVisitedPage = _customerSettings.StoreLastVisitedPage ?
                        x.GetAttribute<string>(SystemCustomerAttributeNames.LastVisitedPage) :
                        _localizationService.GetResource("Admin.Customers.OnlineCustomers.Fields.LastVisitedPage.Disabled")
                }),
                Total = customers.TotalCount
            };

            return Json(gridModel);
        }
開發者ID:491134648,項目名稱:nopCommerce,代碼行數:25,代碼來源:OnlineCustomerController.cs

示例6: CurrentCarts

        public ActionResult CurrentCarts(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCurrentCarts))
                return AccessDeniedView();

            var customers = _customerService.GetAllCustomers(
                loadOnlyWithShoppingCart: true,
                sct: ShoppingCartType.ShoppingCart,
                pageIndex: command.Page - 1,
                pageSize: command.PageSize);

            var gridModel = new DataSourceResult
            {
                Data = customers.Select(x =>
                {
                    return new ShoppingCartModel()
                    {
                        CustomerId = x.Id,
                        CustomerEmail = x.IsRegistered() ? x.Email : _localizationService.GetResource("Admin.Customers.Guest"),
                        TotalItems = x.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList().GetTotalProducts()
                    };
                }),
                Total = customers.TotalCount
            };

            return Json(gridModel);
        }
開發者ID:minuzZ,項目名稱:zelectroshop,代碼行數:27,代碼來源:ShoppingCartController.cs

示例7: DeleteTrial

        public ActionResult DeleteTrial(DataSourceRequest command, int TrialTrackerId)
        {
            var trial = _trialRepository.GetById(TrialTrackerId);
            _trialRepository.Delete(trial);

            return new NullJsonResult();
        }
開發者ID:quan-vu-niteco,項目名稱:NopCommerce,代碼行數:7,代碼來源:TrialTrackerController.cs

示例8: AdvertisementList

        public ActionResult AdvertisementList(DataSourceRequest command, AdvertisementListModel model)
        {
            var ads = _advertisementService.SearchAdvertisements(
                storeId: model.SearchStoreId,
                vendorId: model.SearchVendorId,
                keywords: model.SearchAdvertisementName,
                pageIndex: command.Page - 1,
                pageSize: command.PageSize);

            var gridModel = new DataSourceResult();
            gridModel.Data = ads.Select(x =>
            {
                var adModel = new ModelsMapper().CreateMap<Advertisement, AdvertisementModel>(x);
                //little hack here:
                //ensure that product full descriptions are not returned
                //otherwise, we can get the following error if products have too long descriptions:
                //"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. "
                //also it improves performance
                adModel.Description = string.Empty;

                //picture
                //var defaultProductPicture = _pictureService.GetPicturesByProductId(x.Id, 1).FirstOrDefault();
                //adModel.PictureThumbnailUrl = _pictureService.GetPictureUrl(defaultProductPicture, 75, true);
                ////product type
                //adModel.ProductTypeName = x.ProductType.GetLocalizedEnum(_localizationService, _workContext);
                ////friendly stock qantity
                ////if a simple product AND "manage inventory" is "Track inventory", then display
                //if (x.ProductType == ProductType.SimpleProduct && x.ManageInventoryMethod == ManageInventoryMethod.ManageStock)
                //    adModel.StockQuantityStr = x.GetTotalStockQuantity().ToString();
                return adModel;
            });
            gridModel.Total = ads.TotalCount;

            return Json(gridModel);
        }
開發者ID:mhsohail,項目名稱:Livetameion_3.7,代碼行數:35,代碼來源:AdvertisementsController.cs

示例9: BannerPicturesList

        public ActionResult BannerPicturesList(DataSourceRequest command, int? id)
        {
            if(!id.HasValue || id.Value == 0)
                return new EmptyResult();

            var bannerPictures = _promoBannerService.RetrievePicturesForBanner(id.Value);
            var modelItems = bannerPictures.Select(sp => new PromoBannerPictureModel()
                    {
                        Id = sp.Id,
                        Comment = sp.Comment,
                        DisplaySequence = sp.DisplaySequence,
                        PictureId = sp.PictureId,
                        PromoReference = sp.PromoReference,
                        Url = sp.Url,
                        BannerId = id.Value
                    }).ToList();

            if (modelItems != null && modelItems.Count() > 0)
            {
                modelItems.ToList().ForEach(i =>
                    {
                        i.PictureUrl = _pictureService.GetPictureUrl(i.PictureId);
                    });
            }

            var gridModel = new DataSourceResult
            {
                Data = modelItems,
                Total = modelItems != null ? modelItems.Count() : 0
            };

            return Json(gridModel);
        }
開發者ID:Qixol,項目名稱:Qixol.Promo.Nop.Plugin,代碼行數:33,代碼來源:PromoBannerController.cs

示例10: AuctionList

 public ActionResult AuctionList(DataSourceRequest command, AuctionListModel model)
 {
     var auctions = _auctionService.GetAllAuctions().ToList();
     var gridModel = new DataSourceResult();
     gridModel.Data = auctions;
     gridModel.Total = auctions.Count;
     return Json(gridModel);
 }
開發者ID:mhsohail,項目名稱:Livetameion_3.7,代碼行數:8,代碼來源:AuctionsController.cs

示例11: GetTrials

        public ActionResult GetTrials(DataSourceRequest command)
        {
            var trials = _trialRepository.Table.ToList();

            var gridModel = new DataSourceResult
            {
                Data = trials,
                Total = trials.Count
            };

            return Json(gridModel);
        }
開發者ID:quan-vu-niteco,項目名稱:NopCommerce,代碼行數:12,代碼來源:TrialTrackerController.cs

示例12: GalleryList

        public ActionResult GalleryList(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.AccessAdminPanel))
                return AccessDeniedView();

            var galleries = _productRepository.Table.Where(x => x.ProductTemplateId == 3).ToList();
            var gridModel = new DataSourceResult
            {
                Data = galleries.Select(x => x.ToModel()),
                Total = galleries.Count
            };

            return Json(gridModel);
        }
開發者ID:kolnago,項目名稱:AlterDeco,代碼行數:14,代碼來源:GalleryController.cs

示例13: CountryList

        public ActionResult CountryList(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries))
                return AccessDeniedView();

            var countries = _countryService.GetAllCountries(showHidden: true);
            var gridModel = new DataSourceResult
            {
                Data = countries.Select(x => x.ToModel()),
                Total = countries.Count
            };

            return Json(gridModel);
        }
開發者ID:aumankit,項目名稱:nop,代碼行數:14,代碼來源:CountryController.cs

示例14: List

        public ActionResult List(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes))
                return AccessDeniedView();

            var productAttributes = _productAttributeService
                .GetAllProductAttributes(command.Page - 1, command.PageSize);
            var gridModel = new DataSourceResult
            {
                Data = productAttributes.Select(x => x.ToModel()),
                Total = productAttributes.TotalCount
            };

            return Json(gridModel);
        }
開發者ID:minuzZ,項目名稱:zelectroshop,代碼行數:15,代碼來源:ProductAttributeController.cs

示例15: List

        public ActionResult List(PlayerListModel model, DataSourceRequest command)
        {
            var players = _playerService.GetAll(model.SearchLevel, model.SearchFullName);
            var resultData = command.Page > 0 && command.PageSize > 0 ?
                players.PagedForCommand(command).Select(x => x) :
                players;

            var gridModel = new DataSourceResult
            {
                Data = resultData,
                Total = players.Count
            };

            return Json(gridModel);
        }
開發者ID:AlexandrKiselev79,項目名稱:LLT_Site,代碼行數:15,代碼來源:PlayerController.cs


注:本文中的Nop.Web.Framework.Kendoui.DataSourceRequest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。