/// <summary> /// </summary> /// <param name="keyword"> /// </param> /// <param name="ordering"> /// </param> /// <param name="pageIndex"> /// </param> /// <param name="pageSize"> /// </param> /// <param name="search"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> IndexAsync(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool toExcelFile = false) { var model = jsonDataService.GetAll <KnowledgeBase>() .Select( a => new { KnowledgeCategory = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.KnowledgeCategorys"), Title = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Title"), Content = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Content"), UsageCount = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.UsageCount"), a.UserCreatedBy, a.CreatedDateTime, a.UserUpdatedBy, a.UpdatedDateTime, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, pageSize))); }
/// <summary> /// </summary> /// <param name="keyword">搜索关键词 /// </param> /// <param name="ordering">排序 /// </param> /// <param name="pageIndex">当前页 /// </param> /// <param name="pageSize">每页大小 /// </param> /// <param name="search">多条件搜索 /// </param> /// <param name="recyclebin">已删除的数据</param> /// <param name="toExcelFile">导出到excel</param> /// <returns> /// </returns> public async Task <IActionResult> IndexAsync(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool recyclebin = false, bool toExcelFile = false) { ViewBag.Import = true; //允许导入数据 var DataDictionarys = jsonDataService.GetAll <DataDictionary>(); //数据回收站 if (recyclebin) { DataDictionarys = DataDictionarys.IgnoreQueryFilters().Where(a => a.IsDeleted == true); } var model = DataDictionarys .Select( a => new { Category = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Category"), Name = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Name"), SystemId = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.SystemId"), Enable = Convert.ToBoolean(SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Enable")), Remark = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Remark"), a.UserCreatedBy, a.CreatedDateTime, a.UserUpdatedBy, a.UpdatedDateTime, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } else { model = model.OrderBy(a => a.Category).ThenBy(a => a.SystemId); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, pageSize))); }
/// <summary> /// </summary> /// <param name="keyword"></param> /// <param name="ordering"></param> /// <param name="pageIndex"></param> /// <param name="search"></param> /// <param name="toExcelFile"></param> /// <returns></returns> public async Task <IActionResult> Index(string keyword, string ordering, int pageIndex = 1, bool search = false, bool toExcelFile = false) { var model = _iJsonDataService.GetAll() .Select( a => new { a.JsonDataType, a.JsonDataStr, CreatedBy = a.UserCreatedBy.UserName, a.CreatedDateTime, UpdatedBy = a.UserUpdatedBy.UserName, a.UpdatedDateTime, a.Remark, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, 20))); }
/// <summary> /// </summary> /// <param name="keyword"> /// </param> /// <param name="ordering"> /// </param> /// <param name="pageIndex"> /// </param> /// <param name="search"> /// </param> /// <param name="toExcelFile"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> Index(string keyword, string ordering, int pageIndex = 1, bool search = false, bool toExcelFile = false) { var model = jsonDataService.GetAll <Holiday>() .Select( a => new { Title = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Title"), Work = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Work"), StartDate = DateTime.Parse(SqlDbFunctions.JsonValue(a.JsonDataStr, "$.StartDate")), EndDate = DateTime.Parse(SqlDbFunctions.JsonValue(a.JsonDataStr, "$.EndDate")), CreatedBy = a.UserCreatedBy.UserName, a.CreatedDateTime, UpdatedBy = a.UserUpdatedBy.UserName, a.UpdatedDateTime, a.Remark, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, 20))); }
public async Task <IActionResult> Get(string keyword, string Category, bool?isEnable) { var model = jsonDataService.GetAll <DataDictionary>().Select(a => new { Category = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Category"), Name = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Name"), SystemId = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.SystemId"), Enable = Convert.ToBoolean(SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Enable")), a.Id }).Search(keyword); model = model.Where(a => a.Category == Category); if (isEnable.HasValue) { model = model.Where(a => a.Enable == isEnable.Value); } model = model.OrderBy(a => a.SystemId); _IResInfo.Data = model; return(Ok(_IResInfo)); }
/// <summary> /// </summary> /// <param name="keyword"> /// </param> /// <param name="ordering"> /// </param> /// <param name="pageIndex"> /// </param> /// <param name="pageSize"> /// </param> /// <param name="search"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> IndexAsync(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool toExcelFile = false) { var model = jsonDataService.GetAll <CityCode>() .Select( a => new { Name = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Name"), ZipCode = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.ZipCode"), SystemId = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.SystemId"), Enable = SqlDbFunctions.JsonValue(a.JsonDataStr, "$.Enable"), a.UserCreatedBy, a.CreatedDateTime, a.UserUpdatedBy, a.UpdatedDateTime, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } else { model = model.OrderBy(a => a.SystemId); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, pageSize))); }