public override Task <OperatesResponse> PageSerachOperate(SearchOperate request, ServerCallContext context) { var query = _operate.GetAll().AsNoTracking(); if (SearchFilter(request) != null) { query = query.Where(SearchFilter(request)); } query = OrderFilter() != null ? query.OrderByDescending(OrderFilter()) : query.OrderByDescending(item => item.Id); var total = query.Count(); var result = query.Skip(request.PageMax * (request.PageIndex - 1)) .Take(request.PageMax) .ToList(); var date = new OperatesResponse { Total = total }; ConvertToEntities(result).ForEach(item => { date.Datas.Add(item); }); return(Task.FromResult(date)); }
//搜索标题 public string SearchTitle(string Title, string TypeSelect) { if (Title.Length == 0) { return(""); } string data = new SearchOperate().SearchTitle(Title, TypeSelect); return(data); }
protected Expression <Func <SysOperate, bool> > SearchFilter(SearchOperate search) { Expression <Func <SysOperate, bool> > expression = item => true; if (!string.IsNullOrEmpty(search.Name)) { expression = expression.And(item => item.Name.Contains(search.Name)); } return(expression); }
private void renwuTabChange(object sender, EventArgs e) { if (renwuTab.TabPages[renwuTab.SelectedIndex] == bugTab) { operate = SearchOperate.BUG; searchBug(searchKeyword.Text); checkboxOperate(bugCheckedState); } else { operate = SearchOperate.TASK; searchTask(searchKeyword.Text); checkboxOperate(taskCheckedState); } }
/// <summary> /// 任务和BUG下的列表绘制 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void listview_DrawSubItem(object sender, DrawListViewSubItemEventArgs e) { ListView listView = (ListView)sender; if (listView.Tag == null) { e.DrawDefault = true; return; } SearchOperate type = (SearchOperate)listView.Tag; //BUG的解决列和任务的完成列,绘制添加一个复选框 if ((e.ColumnIndex == 3 && type == SearchOperate.BUG) || (type == SearchOperate.TASK && e.ColumnIndex == 6)) { e.DrawBackground(); drawCheckBox(listView, e.SubItem, e.SubItem.Tag == null ? false : (bool)e.SubItem.Tag); } else { e.DrawDefault = true; } }