Example #1
0
 public void ModifyModels(Fliter fliter)
 {
     DataCollection.FliterInstance.Update(fliter);
 }
Example #2
0
 public void AddModels(Fliter fliter)
 {
     DataCollection.FliterInstance.Insert(fliter);
 }
Example #3
0
 public void RemoveModels(Fliter fliter)
 {
     DataCollection.FliterInstance.Remove(fliter);
 }
Example #4
0
        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>();
        }