public override void Refresh() { this._bgHandboolIdSetList = this.manager.Select(); this.bindingSource1.DataSource = this._bgHandboolIdSetList; if (this.action == "insert") { Model.BGHandbookIdSet model = new Book.Model.BGHandbookIdSet(); model.IsUsing = true; this._bgHandboolIdSetList.Add(model); this.bindingSource1.Position = this.bindingSource1.IndexOf(model); this.gridControl1.RefreshDataSource(); } base.Refresh(); switch (this.action) { case "insert": this.gridView1.OptionsBehavior.Editable = true; break; case "update": this.gridView1.OptionsBehavior.Editable = true; break; case "view": this.gridView1.OptionsBehavior.Editable = false; break; default: break; } }
private void gridView1_KeyDown(object sender, KeyEventArgs e) { if (this.action != "view") { if (e.KeyData == Keys.Enter) { Model.BGHandbookIdSet model = new Book.Model.BGHandbookIdSet(); model.IsUsing = true; this._bgHandboolIdSetList.Add(model); this.bindingSource1.Position = this.bindingSource1.IndexOf(model); } if (e.KeyData == Keys.Delete) { this.Delete(); } } this.gridControl1.RefreshDataSource(); }