public async Task <IActionResult> List(string searchContent, string seniorQueryJson, int page = 1, int limit = 10, string sidx = "CreateDt", string sord = "desc") { try { SysUser query = null; if (!string.IsNullOrEmpty(seniorQueryJson)) { query = Newtonsoft.Json.JsonConvert.DeserializeObject <SysUser>(seniorQueryJson); } System.Linq.Expressions.Expression <Func <SysUser, bool> > predicate = ExpressionBuilder.True <SysUser>(); predicate = predicate.And(b => b.Id > 0); if (searchContent != null) { predicate = predicate.And(b => b.UserName.IndexOf(searchContent) != -1); } PageInfo pageinfo = new PageInfo { }; (List <SysUser> list, long count)datas = await SysUserDAL.QueryAsync(predicate, null, pageinfo); var lists = datas.list; return(lists.GetJson <SysUser>(sidx, sord, page, limit, SysTool.GetPropertyNameArray <SysUser>())); } catch (Exception ex) { throw ex; } }
private void DataConnection_Load(object sender, EventArgs e) { string a = System.IO.Directory.GetCurrentDirectory(); try { ListModel = new DBLogin().GDList(null); if (ListModel != null) { var db = SysTool.EnumToList <EDType>(); SelDataType.SelectedIndexChanged -= new EventHandler(SelDataType_SelectedIndexChanged); SelDataType.DataSource = db; var IsReadModel = ListModel.Where(w => w.IsRead == 1); if (IsReadModel.Count() == 0) { var rs = ListModel.First(); BindData(rs); SelDataType.SelectedIndex = 0; BindIp(rs.BaseName, rs.Ip); } else { var ReadFirst = IsReadModel.First(); BindData(ReadFirst); SelDataType.Text = ReadFirst.BaseName; BindIp(ReadFirst.BaseName, ReadFirst.Ip); } SelDataType.SelectedIndexChanged += new EventHandler(SelDataType_SelectedIndexChanged); } } catch (Exception ex) { MessageBox.Show("错误:" + ex.Message); } }
/// <summary> /// 加载条件枚举。 /// </summary> private void LoadModelCondition() { cklmodel.Items.Clear(); var r = SysTool.EnumToList <ModelType>(); foreach (var item in r) { cklmodel.Items.Add(item); } }