本文整理汇总了C#中Common.List.ToDataSourceResult方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToDataSourceResult方法的具体用法?C# List.ToDataSourceResult怎么用?C# List.ToDataSourceResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.ToDataSourceResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadProjectList
/// <summary>
/// loads the project list.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="projectName">Name of the project.</param>
/// <param name="clientId">The client identifier.</param>
/// <param name="status">The status.</param>
/// <param name="isFilteredByProjectName">Name of the is filtered by project.</param>
/// <param name="includeInactive">include Inactive projects.</param>
/// <returns>
/// The view
/// </returns>
public ActionResult LoadProjectList([DataSourceRequest]DataSourceRequest request, string projectName, int clientId, int status, string isFilteredByProjectName, bool? includeInactive)
{
IList<ProjectListItem> projectList = new List<ProjectListItem>();
if (clientId == default(int) && status == default(int) && string.IsNullOrEmpty(projectName) && includeInactive == false)
{
projectList = this.projectService.RetrieveList(null, null, null, includeInactive, SessionData.Instance.UserInfo.Developer.DeveloperID);
}
else
{
if (!string.IsNullOrEmpty(isFilteredByProjectName) && isFilteredByProjectName.Equals("True", StringComparison.OrdinalIgnoreCase))
{
projectName = !string.IsNullOrEmpty(projectName) ? projectName.Trim().Trim(',') : projectName;
projectList = this.projectService.RetrieveList(projectName, null, null, null, SessionData.Instance.UserInfo.Developer.DeveloperID);
}
else
{
int? client = clientId == default(int) ? default(int?) : clientId;
byte? statusId = status == default(int) ? default(byte?) : (byte)status;
bool? isInactive = includeInactive == false ? false : default(bool?);
projectList = this.projectService.RetrieveList(null, client, statusId, isInactive, SessionData.Instance.UserInfo.Developer.DeveloperID);
}
}
(from projectListItem in projectList
from statusItem in this.lookupService.RetrieveProjectStatusList(SessionData.Instance.UserInfo.Developer.DeveloperID)
where projectListItem.Status == statusItem.ID
select new { ProjectItem = projectListItem, StatusItem = statusItem }).ToList().ForEach(item => item.ProjectItem.StatusTitle = item.StatusItem.Name);
DataSourceResult result = projectList.ToDataSourceResult(request);
return this.Json(result, JsonRequestBehavior.AllowGet);
}
示例2: LoadHolidayList
/// <summary>
/// loads the project list.
/// </summary>
/// <param name="request">The request.</param>
/// <param name="countryId">The country Id.</param>
/// <param name="year">The year Id.</param>
/// <returns>
/// The view
/// </returns>
public ActionResult LoadHolidayList([DataSourceRequest]DataSourceRequest request, string countryId, int year)
{
IList<HolidayListItem> holidayList = new List<HolidayListItem>();
holidayList = this.holidayService.RetrieveHolidayList(year, SessionData.Instance.UserInfo.Developer.DeveloperID, Convert.ToInt32(countryId));
DataSourceResult result = holidayList.ToDataSourceResult(request);
return this.Json(result, JsonRequestBehavior.AllowGet);
}