//Chú ý tên table trong DataTable phải giống như tên table mà mình cần thao tác thêm xóa public static PLGridViewUpdate ToPLGridViewUpdate(GridControl grid, PLGridView gridView, DataTable DataSource, string IDField, string[] NameFields, string[] Subjects, InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc, int RowPerPage) { PLGridViewUpdate update = new PLGridViewUpdate(); for (int i = 0; i < gridView.Columns.Count; i++) { update.gridView.Columns.Add(gridView.Columns[i]); } update._init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc); PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(update.gridControl, RowPerPage, update); page.AddFunction = update.AddAction; page.DeleteFunction = update.DeleteAction; page.EditFunction = update.EditAction; page.NoSaveFunction = update.NoSaveAction; page.PrintFunction = update.PrintAction; page.SaveFunction = update.SaveAction; update.Dock = grid.Dock; update.Location = grid.Location; return update; }
/// <summary>Unique: N Field, Phân quyền: Có (Chưa xây dựng) /// </summary> public DMBasicGrid(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects, InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc) { InitializeComponent(); _init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc); }
public void _init(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects, InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc, int RowPerPage) { base._init(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc); PLGridViewUpdateHelp page = new PLGridViewUpdateHelp(gridControl, RowPerPage, this); page.AddFunction = AddAction; page.DeleteFunction = DeleteAction; page.EditFunction = EditAction; page.NoSaveFunction = NoSaveAction; page.PrintFunction = PrintAction; page.SaveFunction = SaveAction; }
public void _init(DataTable DataSource, string IDField, string[] NameFields, string[] Subjects, InitGridColumns InitGridCol, GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc) { this.TableName = null; this.DataSource = DataSource; this.InsertFunc = InsertFunc; this.DeleteFunc = DeleteFunc; this.UpdateFunc = UpdateFunc; this.IDField = IDField; this.NameFields = NameFields; this.Subjects = Subjects; this.InitGridCol = InitGridCol; this.Rule = Rule; InitGrid(); InitDataGrid(); InitEventGrid(); this.permission = permission; this.gridView.DoubleClick += new EventHandler(gridView_DoubleClick); }
public void _init(GroupElementType type, DataTable DataSource, string IDField, string DislayField, string[] NameFields, string[] Subjects, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc, params string[] readOnlyField) { this.btnAdd.Image = FWImageDic.ADD_IMAGE20; this.btnDel.Image = FWImageDic.DELETE_IMAGE20; this.btnUpdate.Image = FWImageDic.EDIT_IMAGE20; this.btnSelect.Image = FWImageDic.CHOICE_IMAGE20; this.btnNoSelect.Image = FWImageDic.NO_CHOICE_IMAGE20; this.btnInfo.Image = FWImageDic.DETAIL_IMAGE20; this.btnClose.Image = FWImageDic.CLOSE_IMAGE20; this.btnSave.Image = FWImageDic.SAVE_IMAGE20; this.btnNoSave.Image = FWImageDic.NO_SAVE_IMAGE20; _DMCore = new DMBasicGrid(DataSource, IDField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc); _DMCore.Dock = DockStyle.Fill; this.Controls.Add(_DMCore); if (popupContainer != null) _DMCore.SupportDoubleClick = false; this.Controls.Add(this.btnBar); this.IDField = IDField; this.DislayField = DislayField; btnExport = HelpGrid.addXuatRaFileItem(this.btnBar, this.Grid); btnPrint = HelpGrid.addInLuoiItem(this.btnBar, this.Grid); SetMode(type); EditMode(readOnlyField); Grid.KeyDown += new KeyEventHandler(Grid_KeyDown); Grid.DoubleClick += new EventHandler(Grid_DoubleClick); _DMCore.SetDMGridOwner(this); if (Grid is PLGridView) { ((PLGridView)Grid)._SetPermissionElement(btnPrint, btnExport); } }
public static RepositoryItemCheckEdit CotPLVerticalCheckUDB(GridView gridView, GridColumn column, string ColumnField, PLDelegation.ProcessGridView UpdateYes, PLDelegation.ProcessGridView UpdateNo) { RepositoryItemCheckEdit checkEdit = CotPLImageCheck(column, ColumnField); gridView.CellValueChanging += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.FieldName == ColumnField) for (int i = 0; i < gridView.RowCount; i++) if (i != e.RowHandle) gridView.SetRowCellValue(i, gridView.Columns[ColumnField], ""); DataView view = (DataView)gridView.DataSource; DataTable table = view.Table; string checkColumn = table.Rows[e.RowHandle][ColumnField].ToString(); if (checkColumn == "Y") { UpdateYes(gridView); //UpdateStateNo(table.TableName, ColumnField); } else { UpdateNo(gridView); //string id = table.Rows[e.RowHandle][KeyField].ToString(); //if (UpdateStateNo(table.TableName, ColumnField)) // UpdateStateYes(table.TableName, ColumnField, KeyField, id); } }; return checkEdit; }
public void _init(GroupElementType type, DataTable DataSource, string IDField, string DislayField, string[] NameFields, string[] Subjects, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, PLDelegation.ProcessDataRow InsertFunc, PLDelegation.ProcessDataRow DeleteFunc, PLDelegation.ProcessDataRow UpdateFunc, params string[] editField) { dmGridTemplate1._init(type, DataSource, IDField, DislayField, NameFields, Subjects, InitGridCol, Rule, permission, InsertFunc, DeleteFunc, UpdateFunc, editField); this.DislayField = DislayField; }