public void ModifyModels(Fliter fliter) { DataCollection.FliterInstance.Update(fliter); }
public void AddModels(Fliter fliter) { DataCollection.FliterInstance.Insert(fliter); }
public void RemoveModels(Fliter fliter) { DataCollection.FliterInstance.Remove(fliter); }
public void init() { //绑定gridView的各种事件 gridView.CellDoubleClick += GridView_CellDoubleClick; gridView.CellClick += GridView_CellClick; //获得列信息 columns = controller.getColumns(); types = controller.getTypes(); //添加第一列“序号” columns.Insert(0, "序号"); types.Insert(0, keyType.KEY_NUMBER); //设置过滤器种类 fliters = new List <Fliter>(); for (int i = 0; i < columns.Count; i++) { KeyValueProp p; if (types[i] == keyType.KEY_STRING) { p = new StringKeyValueProp(columns[i], ""); } else if (types[i] == keyType.KEY_NUMBER) { p = new NumberKeyValueProp(columns[i], 0.0); } else { p = new DateTimeKeyValueProp(columns[i], DateTime.Now); } Fliter fliter = new Fliter(p, 'd'); fliters.Add(fliter); } //设置只读 gridView.ReadOnly = true; //移除空行 gridView.AllowUserToAddRows = false; //添加列 DataGridViewTextBoxColumn col; foreach (string s in columns) { col = new DataGridViewTextBoxColumn(); col.Name = s; col.HeaderText = s; gridView.Columns.Add(col); } //设置第一列为int型 gridView.Columns[0].ValueType = typeof(int); //设置第一列的颜色 gridView.Columns[0].DefaultCellStyle.BackColor = System.Drawing.Color.LightPink; showProps = new List <IRowShowable>(); }