本文整理汇总了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);
}
示例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
};
}
示例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
});
}
示例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);
}
示例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);
}
示例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);
}
示例7: DeleteTrial
public ActionResult DeleteTrial(DataSourceRequest command, int TrialTrackerId)
{
var trial = _trialRepository.GetById(TrialTrackerId);
_trialRepository.Delete(trial);
return new NullJsonResult();
}
示例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);
}
示例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);
}
示例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);
}
示例11: GetTrials
public ActionResult GetTrials(DataSourceRequest command)
{
var trials = _trialRepository.Table.ToList();
var gridModel = new DataSourceResult
{
Data = trials,
Total = trials.Count
};
return Json(gridModel);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}