public RepositoryItemSelectDMGridTemplate(GroupElementType type, GridView gridView, string TableName, string columnField, string IDField, string DislayField, string getField, string[] NameFields, string[] Subjects, string FilterField, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, params string[] readOnlyField) { CotAo = columnField + getField + "_PLV"; this.ShowPopupShadow = true; dmGridTemplate1 = new DMGrid(); popupControl = new PopupContainerControl(); this.CloseOnOuterMouseClick = false; this.PopupControl = popupControl; popupControl.Controls.Add(dmGridTemplate1); popupControl.Size = dmGridTemplate1.Size; this.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; this.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(RepositoryItemSelectDMGridTemplate_EditValueChanging); //dmGridTemplate1._init(type, TableName, IDField, DislayField, NameFields, Subjects, InitGridCol, Rule, permission, readOnlyField); this.Popup += new EventHandler(RepositoryItemSelectDMGridTemplate_Popup); this.CloseUp += new DevExpress.XtraEditors.Controls.CloseUpEventHandler(popupContainerEdit1_CloseUp); this.Closed += new DevExpress.XtraEditors.Controls.ClosedEventHandler(popupContainerEdit1_Closed); this.KeyDown += new KeyEventHandler(popupContainerEdit1_KeyDown); this.DislayField = DislayField; this.FilterField = FilterField; gridView.GridControl.DataSourceChanged += delegate(object sender, EventArgs e) { if (gridView.GridControl.DataSource != null && !((DataTable)gridView.GridControl.DataSource).Columns.Contains(CotAo)) { DataTable dt = (DataTable)gridView.GridControl.DataSource; dt.Columns.Add(new DataColumn(CotAo)); SetValueTable(ref dt, columnField, CotAo, TableName, "ID", getField); } }; long idValue; gridView.CellValueChanging += delegate(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.FieldName.Equals(CotAo)) { idValue = _getSelectedID(); if (e.RowHandle < 0) { gridView.EditingValue = idValue; gridView.SetFocusedRowCellValue(gridView.Columns.ColumnByFieldName(columnField), idValue); } else { DataTable dt = ((DataTable)gridView.GridControl.DataSource); DataRow row = dt.Rows[e.RowHandle]; row[columnField] = idValue; row[CotAo] = e.Value; } } }; gridView.InitNewRow += delegate(object sender, InitNewRowEventArgs e) { gridView.SetRowCellValue(e.RowHandle, columnField,_getSelectedID()); }; }
public RepositoryItemSelectDMGridTemplate(GroupElementType type, GridView gridView, string TableName, string columnField, string IDField, string DislayField,string getField, string NameField, string Subject, string FilterField, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, params string[] readOnlyField) : this(type,gridView, TableName,columnField, IDField, DislayField, getField, new string[] { NameField }, new string[] { Subject },FilterField, InitGridCol, Rule, null, readOnlyField) { }
public RepositoryItemSelectDMGridTemplate(GroupElementType type, GridView gridView, string TableName, string columnField, params string[] readOnlyField) : this(type, gridView, TableName, columnField, "ID", "NAME", "ID", new string[] { "NAME" }, new string[] { "Tên" }, "NAME", null, null, null, readOnlyField) { }
/// <summary> /// Phân quyền : Không /// VISIBLE_BIT : Không hỗ trợ /// Unique : N Field /// RootID : Không /// </summary> public void Init(GroupElementType type, String GroupTableName, String IDField, String ParentIDField, string[] VisibleFields, string[] Captions, string GenName, object[] InputColumnType, FieldNameCheck[] Rules) { Init(type, GroupTableName, null, IDField, ParentIDField, VisibleFields, Captions, GenName, InputColumnType, Rules); }
//Cập nhật các nút tương ứng với tình huống sử dụng private void UpdateItemBtn(GroupElementType type) { btnPrint = HelpTreeList.addXuatRaFileItem(this.toolStrip_1, this.TreeList_1); //In btnExport = HelpTreeList.addInLuoiItem(this.toolStrip_1, this.TreeList_1); TreeList_1._SetPermissionElement(btnPrint, btnExport); if (type == GroupElementType.ONLY_INPUT) { btnSelect.Visible = false; btnNoSelect.Visible = false; ChonSep.Visible = false; //this.TreeList_1.DoubleClick -= new System.EventHandler(this.TreeList_1_DoubleClick); this.TreeList_1.InvalidNodeException += InvalidNodeException_1; TreeList_1.AllowDrop = true; //Xuất ra file } else if (type == GroupElementType.ONLY_CHOICE) { btnAdd.Visible = false; btnDel.Visible = false; btnUpdate.Visible = false; addSameLevel.Visible = false; LuuSep.Visible = false; btnLuu.Visible = false; btnKhongLuu.Visible = false; DongSep.Visible = false; btnClose.Visible = false; ChonSep.Visible = false; btnSelect.Visible = true; btnNoSelect.Visible = true; btnPrint.Visible = false; btnExport.Visible = false; this.TreeList_1.FocusedNodeChanged -= new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(this.TreeList_1_FocusedNodeChanged); this.TreeList_1.ValidateNode -= new DevExpress.XtraTreeList.ValidateNodeEventHandler(this.TreeList_1_ValidateNode_1); this.TreeList_1.InvalidNodeException -= InvalidNodeException_1; TreeList_1.AllowDrop = false; } else if (type == GroupElementType.CHOICE_N_ADD) { btnDel.Visible = false; btnUpdate.Visible = false; DongSep.Visible = false; btnClose.Visible = false; btnPrint.Visible = false; btnExport.Visible = false; this.TreeList_1.InvalidNodeException += InvalidNodeException_1; TreeList_1.AllowDrop = false; } }
/// <summary> /// Phân quyền : Không /// VISIBLE_BIT : Không hỗ trợ /// Unique : N Field /// RootID : Có /// </summary> public void Init(GroupElementType type, String GroupTableName, int[] RootID, String IDField, String ParentIDField, string[] VisibleFields, string[] Captions, string GenName, object[] InputColumnType, FieldNameCheck[] Rules, string[] UniqueFields, string[] Subjects) { Init(type, GroupTableName, RootID, IDField, ParentIDField, VisibleFields, Captions, GenName, InputColumnType, Rules, UniqueFields, Subjects, false); }
/// <summary> /// Phân quyền : Không /// VISIBLE_BIT : Không hỗ trợ /// Unique : 1 "NAME" Field /// RootID : Có /// </summary> public void Init(GroupElementType type, String GroupTableName, int[] RootID, String IDField, String ParentIDField, string[] VisibleFields, string[] Captions, string GenName, object[] InputColumnType, FieldNameCheck[] Rules) { Init(type, GroupTableName, RootID, IDField, ParentIDField, VisibleFields, Captions, GenName, InputColumnType, Rules, new string[] { "NAME" }, new string[] { "Tên" }); }
private void SetMode(GroupElementType type) { this.btnSave.Enabled = false; this.btnNoSave.Enabled = false; if (type == GroupElementType.ONLY_INPUT) { ChonSep.Visible = false; btnSelect.Visible = false; btnNoSelect.Visible = false; Grid.OptionsBehavior.ImmediateUpdateRowPosition = true; } else if (type == GroupElementType.ONLY_CHOICE) { btnAdd.Visible = false; btnDel.Visible = false; btnUpdate.Visible = false; ChonSep.Visible = true; btnSelect.Visible = true; btnNoSelect.Visible = true; this.DongSep.Visible = false; this.btnClose.Visible = false; this.LuuSep.Visible = false; this.btnSave.Visible = false; this.btnNoSave.Visible = false; btnSelect.Visible = false; btnNoSelect.Visible = false; btnPrint.Visible = false; btnExport.Visible = false; } else if (type == GroupElementType.CHOICE_N_ADD) { btnDel.Visible = true; btnUpdate.Visible = true; this.DongSep.Visible = false; this.btnClose.Visible = false; btnPrint.Visible = false; btnExport.Visible = false; } }
/// <summary> /// Phân quyền : Không /// VISIBLE_BIT : Có /// Unique : N Field /// RootID : Có /// </summary> public void Init(GroupElementType type, String GroupTableName, int[] RootID, String IDField, String ParentIDField, string[] VisibleFields, string[] Captions, string GenName, object[] InputColumnType, FieldNameCheck[] Rules, string[] UniqueFields, string[] Subjects, bool IsVisibleBit) { this.type = type; UpdateItemBtn(this.type); this.GroupTableName = GroupTableName; this.IDField = IDField; this.ParentIDField = ParentIDField; this.GenName = GenName; this.VisibleFields = VisibleFields; this.TreeList_1._BuildTree(this.GroupTableName, RootID, IDField, ParentIDField, VisibleFields, Captions, InputColumnType); this.TreeList_1.OptionsView.ShowColumns = true; ((DataTable)this.TreeList_1.DataSource).PrimaryKey = new DataColumn[] { ((DataTable)this.TreeList_1.DataSource).Columns[IDField] }; this.TreeList_1.ExpandAll(); this.Rules = Rules; this.UniqueFields = UniqueFields; this.Subjects = Subjects; this.IsVisibleBit = IsVisibleBit; //HelpTree.ShowFilter(this.TreeList_1, true, IDField, ParentIDField, FilterConditionEnum.NotContains); }
/// <summary> /// Unique: N Field /// Phân quyền: Có (Chưa xử lý), /// Cho thêm: Có Nếu readOnlyField = null hoặc không truyền vào /// Không Nếu readOnlyFiled !=null (chỉ cập nhật) /// VISIBLE_BIT:Không /// GroupElementType: Chọn kiểu chọn lựa ( Chỉ chọn , Chọn và Thêm ) /// </summary> public void _init(GroupElementType type, string TableName, string IDField, string DislayField, string[] NameFields, string[] Subjects, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, 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(TableName, IDField, NameFields, Subjects, InitGridCol, Rule, permission); _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 RepositoryItemSelectDMGridTemplate CotPLDMGrid(GridView gridView, GridColumn column, GroupElementType type, string TableName, string IDField, string DislayField, string getField, string[] NameFields, string[] Subjects, string FilterField, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, string ColumnField, DataSet dataTable0, params string[] readOnlyField) { column.FieldName = ColumnField + getField + "_PLV"; RepositoryItemSelectDMGridTemplate dmGrid = new RepositoryItemSelectDMGridTemplate(type, gridView, TableName, ColumnField, IDField, DislayField, getField, NameFields, Subjects, FilterField, InitGridCol, Rule, permission, dataTable0, readOnlyField); column.ColumnEdit = dmGrid; gridView.OptionsBehavior.AutoExpandAllGroups = true; return dmGrid; }
public RepositoryItemSelectDMGridTemplate(GroupElementType type, GridView gridView, string TableName, string columnField, string IDField, string DislayField, string getField, string[] NameFields, string[] Subjects, string FilterField, ProtocolVN.Framework.Win.DMBasicGrid.InitGridColumns InitGridCol, ProtocolVN.Framework.Win.DMBasicGrid.GetRule Rule, params string[] readOnlyField) : this(type, gridView, TableName, columnField, IDField, DislayField, getField, NameFields, Subjects, FilterField, InitGridCol, Rule, null, readOnlyField) { }
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; }
public void _init(GroupElementType type, string TableName, string IDField, string DislayField, string[] NameFields, string[] Subjects, DMBasicGrid.InitGridColumns InitGridCol, DMBasicGrid.GetRule Rule, DelegationLib.DefinePermission permission, params string[] editField) { dmGridTemplate1._init(type, TableName, IDField, DislayField, NameFields, Subjects, InitGridCol, Rule, permission, editField); this.DislayField = DislayField; }