void barBtnEdt_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var et = gridView1.GetFocusedDataSource<UltraDbEntity.T_ERP_Role>(); if (null == et) return; var vw = new EdtView(); vw.EditMode = Ultra.Business.Core.Define.EnViewEditMode.Edit; vw.Entity = et; InitView(vw); if (vw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { gridControlEx1.RefreshDataSource(); } }
void barBtnNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var vw = new EdtView(); vw.EditMode = Ultra.Business.Core.Define.EnViewEditMode.New; InitView(vw); if (vw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var ds = gridControlEx1.GetDataSource<UltraDbEntity.T_ERP_Role>(); ds = ds ?? new List<UltraDbEntity.T_ERP_Role>(); ds.Insert(0, vw.Entity); gridControlEx1.DataSource = ds; gridControlEx1.RefreshDataSource(); } }