本文整理汇总了C#中Telerik.Web.Mvc.GridModel类的典型用法代码示例。如果您正苦于以下问题:C# GridModel类的具体用法?C# GridModel怎么用?C# GridModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridModel类属于Telerik.Web.Mvc命名空间,在下文中一共展示了GridModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _SearchResult
public ActionResult _SearchResult(GridCommand command, string item, string supplier, DateTime? dateFrom, DateTime? dateTo)
{
string sqlStr = PrepareSearchStatement(command, item, supplier, dateFrom, dateTo);
IList<object[]> objectList = base.genericMgr.FindAllWithNativeSql<object[]>(sqlStr);
var inspectDetailList = (from inp in objectList
select new InspectDetail
{
IpNo = (string)inp[0],
ManufactureParty = (string)inp[1],
ManufacturePartyName = (string)inp[2],
Item = (string)inp[3],
ItemDescription = (string)inp[4],
ReferenceItemCode = (string)inp[5],
UnitCount = (decimal)inp[6],
Uom = (string)inp[7],
RejectQty = (decimal)inp[8],
InspectQty = (decimal)inp[9]
}).ToList();
int count = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage));
if (inspectDetailList.Count > count)
{
SaveWarningMessage(string.Format("数据超过{0}行,只显示前{0}行", count));
}
//return PartialView(inspectDetailList.Take(count));
GridModel<InspectDetail> gridModel = new GridModel<InspectDetail>();
gridModel.Total = count;
gridModel.Data = inspectDetailList.Take(count);
return PartialView(gridModel);
}
示例2: Configure
public ActionResult Configure(GridCommand command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
return Content("Access denied");
var tmp = new List<FixedShippingRateModel>();
foreach (var shippingMethod in _shippingService.GetAllShippingMethods())
tmp.Add(new FixedShippingRateModel()
{
ShippingMethodId = shippingMethod.Id,
ShippingMethodName = shippingMethod.Name,
Rate = GetShippingRate(shippingMethod.Id)
});
var tmp2 = tmp.ForCommand(command);
var gridModel = new GridModel<FixedShippingRateModel>
{
Data = tmp2,
Total = tmp2.Count()
};
return new JsonResult
{
Data = gridModel
};
}
示例3: Categories
public ActionResult Categories(GridCommand command)
{
var model = new GridModel<TaxCategoryModel>();
if (_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
{
var categoriesModel = _taxCategoryService.GetAllTaxCategories()
.Select(x => x.ToModel())
.ForCommand(command)
.ToList();
model.Data = categoriesModel;
model.Total = categoriesModel.Count;
}
else
{
model.Data = Enumerable.Empty<TaxCategoryModel>();
NotifyAccessDenied();
}
return new JsonResult
{
Data = model
};
}
示例4: Configure
public ActionResult Configure(GridCommand command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
return Content("Access denied");
var tmp = new List<FixedTaxRateModel>();
foreach (var taxCategory in _taxCategoryService.GetAllTaxCategories())
tmp.Add(new FixedTaxRateModel()
{
TaxCategoryId = taxCategory.Id,
TaxCategoryName = taxCategory.Name,
Rate = GetTaxRate(taxCategory.Id)
});
var tmp2 = tmp.ForCommand(command);
var gridModel = new GridModel<FixedTaxRateModel>
{
Data = tmp2,
Total = tmp2.Count()
};
return new JsonResult
{
Data = gridModel
};
}
示例5: List
public ActionResult List(string id)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageEmailAccounts))
return AccessDeniedView();
//mark as default email account (if selected)
if (!String.IsNullOrEmpty(id))
{
int defaultEmailAccountId = Convert.ToInt32(id);
var defaultEmailAccount = _emailAccountService.GetEmailAccountById(defaultEmailAccountId);
if (defaultEmailAccount != null)
{
_emailAccountSettings.DefaultEmailAccountId = defaultEmailAccountId;
_settingService.SaveSetting(_emailAccountSettings);
}
}
var emailAccountModels = _emailAccountService.GetAllEmailAccounts()
.Select(x => x.ToModel())
.ToList();
foreach (var eam in emailAccountModels)
eam.IsDefaultEmailAccount = eam.Id == _emailAccountSettings.DefaultEmailAccountId;
var gridModel = new GridModel<EmailAccountModel>
{
Data = emailAccountModels,
Total = emailAccountModels.Count()
};
return View(gridModel);
}
示例6: Weights
public ActionResult Weights(string id)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageMeasures))
return AccessDeniedView();
//mark as primary weight (if selected)
if (!String.IsNullOrEmpty(id))
{
int primaryWeightId = Convert.ToInt32(id);
var primaryWeight = _measureService.GetMeasureWeightById(primaryWeightId);
if (primaryWeight != null)
{
_measureSettings.BaseWeightId = primaryWeightId;
_settingService.SaveSetting(_measureSettings);
}
}
var weightsModel = _measureService.GetAllMeasureWeights()
.Select(x => x.ToModel())
.ToList();
foreach (var wm in weightsModel)
wm.IsPrimaryWeight = wm.Id == _measureSettings.BaseWeightId;
var model = new GridModel<MeasureWeightModel>
{
Data = weightsModel,
Total = weightsModel.Count
};
return View(model);
}
示例7: ListAsync
public ActionResult ListAsync()
{
var clients = _clientRepository.All();
var clientModel = new GridModel(clients);
return View(clientModel);
}
示例8: _AjaxList
public ActionResult _AjaxList(GridCommand command, SnapshotFlowDet4LeanEngineSearchModel searchModel)
{
string selectSql = this.PrepareSearchStatement(command, searchModel);
var total = this.genericMgr.FindAllWithNativeSql<int>(string.Format("select count(*) from ({0}) result", selectSql))[0];
string whereStatement = string.Format(" select * from ( {0} ) result where result.RowId between {1} and {2}", selectSql, command.PageSize * (command.Page - 1), command.PageSize * command.Page);
//var returnList = this.genericMgr.FindEntityWithNativeSql<SnapshotFlowDet4LeanEngine>(whereStatement);
var searchList = this.genericMgr.FindAllWithNativeSql<object[]>(whereStatement);
var returnList = (from take in searchList
select new SnapshotFlowDet4LeanEngine
{
Id = (Int64)take[1],
Flow = (string)take[2],
Item = (string)take[3],
LocationFrom = (string)take[4],
LocationTo = (string)take[5],
OrderNo = (string)take[6],
Lvl = Convert.ToInt16((take[7]).ToString()),
ErrorId = Convert.ToInt16((take[8]).ToString()),
Message = (string)take[9],
CreateDate = (DateTime)take[10],
BatchNo = (int)take[11],
ItemDesc = (string)take[12],
ReferenceItemCode = (string)take[13],
}).ToList();
GridModel<SnapshotFlowDet4LeanEngine> gridMode = new GridModel<SnapshotFlowDet4LeanEngine>();
gridMode.Total = total;
gridMode.Data = returnList;
return PartialView(gridMode);
//string
//SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
//return PartialView(GetAjaxPageData<SnapshotFlowDet4LeanEngine>(searchStatementModel, command));
}
示例9: QueuedEmailList
public ActionResult QueuedEmailList(GridCommand 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, model.SearchSendManually);
var gridModel = new GridModel<QueuedEmailModel>
{
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
};
}
示例10: Index
public ActionResult Index(GridCommand command, ErrorLogModel model)
{
if (!PermissionService.Authorize(PermissionProvider.ErrorView))
return AccessDeniedView();
int totalRecords = 0;
var query = _unitOfWork.ErrorRepository.GetAsQuerable().OrderByDescending(x => x.CreatedOn);
var errorLog = query.ApplyGridCommandsWithPaging(command, out totalRecords);
var errorList = errorLog.Select(error => new ErrorLogModel
{
Id = error.Id,
IpAddress = error.IpAddress,
PageUrl = error.PageUrl,
ShortMessage = error.ShortMessage,
FullMessage = error.FullMessage,
CreatedOn = error.CreatedOn
}).ToList();
var gridModel = new GridModel<ErrorLogModel>
{
Data = errorList,
Total = totalRecords
};
return View(gridModel);
}
示例11: AffiliatedCustomerList
public ActionResult AffiliatedCustomerList(int affiliateId, GridCommand command)
{
var model = new GridModel<AffiliateModel.AffiliatedCustomerModel>();
if (_permissionService.Authorize(StandardPermissionProvider.ManageAffiliates))
{
var affiliate = _affiliateService.GetAffiliateById(affiliateId);
var customers = _customerService.GetAllCustomers(affiliate.Id, command.Page - 1, command.PageSize);
model.Data = customers.Select(customer =>
{
var customerModel = new AffiliateModel.AffiliatedCustomerModel
{
Id = customer.Id,
Email = customer.Email,
Username = customer.Username,
FullName = customer.GetFullName()
};
return customerModel;
});
model.Total = customers.TotalCount;
}
else
{
model.Data = Enumerable.Empty<AffiliateModel.AffiliatedCustomerModel>();
NotifyAccessDenied();
}
return new JsonResult
{
Data = model
};
}
示例12: List
public ActionResult List()
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers))
return AccessDeniedView();
var customers = _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-_customerSettings.OnlineCustomerMinutes),
null, 0, _adminAreaSettings.GridPageSize);
var model = new GridModel<OnlineCustomerModel>
{
Data = customers.Select(x =>
{
return new OnlineCustomerModel()
{
Id = x.Id,
CustomerInfo = x.IsRegistered() ? x.Email : _localizationService.GetResource("Admin.Customers.Guest"),
LastIpAddress = x.LastIpAddress,
Location = _geoCountryLookup.LookupCountryName(x.LastIpAddress),
LastActivityDate = _dateTimeHelper.ConvertToUserTime(x.LastActivityDateUtc, DateTimeKind.Utc),
LastVisitedPage = x.GetAttribute<string>(SystemCustomerAttributeNames.LastVisitedPage)
};
}),
Total = customers.TotalCount
};
return View(model);
}
示例13: CurrentCarts
public ActionResult CurrentCarts(GridCommand command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
return AccessDeniedView();
var customers = _customerService.GetAllCustomers(null, null, null, null, null,
null, null, 0, 0, true, ShoppingCartType.ShoppingCart,
command.Page - 1, command.PageSize);
var gridModel = new GridModel<ShoppingCartModel>
{
Data = customers.Select(x =>
{
return new ShoppingCartModel()
{
CustomerId = x.Id,
CustomerName = x.IsGuest() ?
"Guest" :
x.GetFullName(),
TotalItems = x.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList().GetTotalProducts()
};
}),
Total = customers.TotalCount
};
return new JsonResult
{
Data = gridModel
};
}
示例14: Providers
public ActionResult Providers(string systemName)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
return AccessDeniedView();
//mark as active tax provider (if selected)
if (!String.IsNullOrEmpty(systemName))
{
var taxProvider = _taxService.LoadTaxProviderBySystemName(systemName);
if (taxProvider != null)
{
_taxSettings.ActiveTaxProviderSystemName = systemName;
_settingService.SaveSetting(_taxSettings);
}
}
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 GridModel<TaxProviderModel>
{
Data = taxProvidersModel,
Total = taxProvidersModel.Count()
};
return View(gridModel);
}
示例15: _AjaxFlowCarrierList
public ActionResult _AjaxFlowCarrierList(GridCommand command, string id)
{
GridModel<TransportFlowCarrier> GridModel = new GridModel<TransportFlowCarrier>();
GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowCarrier tf where tf.Flow=?", id)[0];
var result = this.genericMgr.FindAll<TransportFlowCarrier>("from TransportFlowCarrier tf where tf.Flow=? order by Sequence", id);
this.FillCodeDetailDescription<TransportFlowCarrier>(result);
GridModel.Data = result;
return PartialView(GridModel);
}