本文整理汇总了C#中Nop.Web.Framework.Kendoui.DataSourceResult类的典型用法代码示例。如果您正苦于以下问题:C# DataSourceResult类的具体用法?C# DataSourceResult怎么用?C# DataSourceResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSourceResult类属于Nop.Web.Framework.Kendoui命名空间,在下文中一共展示了DataSourceResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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
};
}
示例4: 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);
}
示例5: GetTrials
public ActionResult GetTrials(DataSourceRequest command)
{
var trials = _trialRepository.Table.ToList();
var gridModel = new DataSourceResult
{
Data = trials,
Total = trials.Count
};
return Json(gridModel);
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: List
public ActionResult List(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageScheduleTasks))
return AccessDeniedView();
var models = _scheduleTaskService.GetAllTasks(true)
.Select(PrepareScheduleTaskModel)
.ToList();
var gridModel = new DataSourceResult
{
Data = models,
Total = models.Count
};
return Json(gridModel);
}
示例10: CategoryTemplates
public ActionResult CategoryTemplates(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
return AccessDeniedView();
var templatesModel = _categoryTemplateService.GetAllCategoryTemplates()
.Select(x => x.ToModel())
.ToList();
var gridModel = new DataSourceResult
{
Data = templatesModel,
Total = templatesModel.Count
};
return Json(gridModel);
}
示例11: Categories
public ActionResult Categories(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
return AccessDeniedView();
var categoriesModel = _taxCategoryService.GetAllTaxCategories()
.Select(x => x.ToModel())
.ToList();
var gridModel = new DataSourceResult
{
Data = categoriesModel,
Total = categoriesModel.Count
};
return Json(gridModel);
}
示例12: List
public ActionResult List(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores))
return AccessDeniedView();
var storeModels = _storeService.GetAllStores()
.Select(x => x.ToModel())
.ToList();
var gridModel = new DataSourceResult
{
Data = storeModels,
Total = storeModels.Count()
};
return Json(gridModel);
}
示例13: Weights
public ActionResult Weights(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageMeasures))
return AccessDeniedView();
var weightsModel = _measureService.GetAllMeasureWeights()
.Select(x => x.ToModel())
.ToList();
foreach (var wm in weightsModel)
wm.IsPrimaryWeight = wm.Id == _measureSettings.BaseWeightId;
var gridModel = new DataSourceResult
{
Data = weightsModel,
Total = weightsModel.Count
};
return Json(gridModel);
}
示例14: Providers
public ActionResult Providers(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
return AccessDeniedView();
var taxProvidersModel = _taxService.LoadAllTaxProviders()
.Select(x => x.ToModel())
.ToList();
foreach (var tpm in taxProvidersModel)
tpm.IsPrimaryTaxProvider = tpm.SystemName.Equals(_taxSettings.ActiveTaxProviderSystemName, StringComparison.InvariantCultureIgnoreCase);
var gridModel = new DataSourceResult
{
Data = taxProvidersModel,
Total = taxProvidersModel.Count()
};
return Json(gridModel);
}
示例15: ForumGroupList
public ActionResult ForumGroupList(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageForums))
return AccessDeniedView();
var forumGroups = _forumService.GetAllForumGroups();
var gridModel = new DataSourceResult
{
Data = forumGroups.Select(fg =>
{
var model = fg.ToModel();
model.CreatedOn = _dateTimeHelper.ConvertToUserTime(fg.CreatedOnUtc, DateTimeKind.Utc);
return model;
}),
Total = forumGroups.Count
};
return Json(gridModel);
}