public static string GetTemplateList(string json) { var objs = TyConvert.JsonToObj <object[]>(json); var t = TyConvert.JsonToObj <BS_Template>(objs[0].ToString()); var td = new TemplateDal(); var bsTemplateList = td.GetList(t, (int)objs[1], (int)objs[2], out var rows); return(TyConvert.ObjToJson(new[] { rows.ToString(), TyConvert.ObjToJson(bsTemplateList) })); }
/// <summary> /// 绑定列表 /// </summary> private void BindList() { try { gridView.DataSource = null; PagerModel pager = pagerControl1.Pager; List <BS_Template> list = m_TemplateDal.GetList(ref pager, null, null, null, Enums.TemplateType.Notice); pagerControl1.Pager = pager; list.ForEach(a => { }); gridView.ClearSelection(); gridView.Columns.Clear(); gridView.AutoGenerateColumns = false; DataGridViewTextBoxColumn dc = new DataGridViewTextBoxColumn(); dc.HeaderText = "ID"; dc.DataPropertyName = "id"; //dc.Visible = false; gridView.Columns.Add(dc); dc = new DataGridViewTextBoxColumn(); dc.HeaderText = "编码"; dc.DataPropertyName = "code"; gridView.Columns.Add(dc); dc = new DataGridViewTextBoxColumn(); dc.HeaderText = "名称"; dc.DataPropertyName = "name"; dc.Width = 170; gridView.Columns.Add(dc); dc = new DataGridViewTextBoxColumn(); dc.HeaderText = "备注"; dc.DataPropertyName = "remarks"; gridView.Columns.Add(dc); gridView.ReadOnly = true; gridView.DataSource = list; } catch (Exception ex) { string s = ex.Message; } }