public frmThongKeLPS() { InitializeComponent(); new TPhieuThongKeFix(this, true); pivotGridMaster.OptionsChartDataSource.ChartDataVertical = false; checkListCol = AppCtrl.AddTuyBienCot(barManager1, MainBar, new[]{fieldKenhPhat, fieldTietMuc, fieldNoiDung,fieldTenGoc,fieldTongTap, fieldNuocSX, fieldNgayPhatTapDau,fieldThuPhat, fCodeCT ,fCategory, fHangSanXuat, fDonViCungCap,fRanking,fMoiCu,fTheLoai, fSotapNgay,fieldThongTinhThem}, new[] { true, true, true, false, false, true, true ,true, true,true,true,true,true,true,true,false,true}); AppCtrl.FormatButtonTimKiem(this); barItemPrint = AppCtrl.InitPrintGrid(this, true); HelpControl.RedCheckEdit(ckcPhatChinh, ckcPhatLai, ckcTapSoKhacRong, ckctapSoRong); ckcPhatChinh.Checked = true; ckcPhatLai.Checked = true; ckcTapSoKhacRong.Checked = true; ckctapSoRong.Checked = true; pivotGridMaster.FieldValueDisplayText += new PivotFieldDisplayTextEventHandler(pivotGridMaster_FieldValueDisplayText); this.Load += new EventHandler(frmThongKeLPS_Load); var editor = checkListCol.CreateEditor(); }
public frmLibXemLichPhatSongQL() { InitializeComponent(); IDField =BIEN_MUC.BM_ID; DisplayField = BIEN_MUC.MA_BANG; fix = new PhieuQuanLy10Fix(this); AppCtrl.InitPrintGrid(this,true); repositoryItemCheckedCotHienThi = AppCtrl.AddTuyBienCot(barManager1, MainBar, gridViewMaster, new string[] {colKenhPhat.Name, colNgay.Name,colGio.Name,colThoiLuong.Name,colTietMuc.Name ,colNoiDung.Name,colTapso.Name,colMaBang.Name,colLoaiLuuTru.Name,colThongSo.Name ,colTinhTrang.Name,colPopUp.Name,colTTDinhKem.Name,colKe.Name,colNgan.Name ,colTang.Name,colSoLanPhat.Name,colPhatLanDau.Name,colDVSH.Name ,colDVCC.Name,colNuocSX.Name,colDTKG.Name,colRating.Name,colNamSX.Name,colTenGoc.Name,colThongTinThem.Name}); //if (repositoryItemCheckedCotHienThi.GetCheckedItems().ToString() != string.Empty) //{ // // if (colKenhPhat.Visible) colKenhPhat.Group(); // // if (colNgay.Visible) colNgay.Group(); // //if (colTietMuc.Visible) colTietMuc.Group(); //} AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,repositoryItemCheckedCotHienThi); AppCtrl.AddRefresh(this); _msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' biên mục đang chọn?"; _msgNotifyDeleteFail = "Thao tác 'Xóa' biên mục \"{0}\" thực hiện không thành công. Vui lòng kiểm tra lại dữ liệu."; }
/// <summary> /// Init the repository lookup edit for a banded column /// </summary> /// <param name="column">Banded column</param> /// <param name="dataSource">Data source of repository</param> public void InitColumnRepository(BandedGridColumn column, List <HRTimeSheetParamsInfo> dataSource) { //RepositoryItemBOSLookupEdit rep = new RepositoryItemBOSLookupEdit(); //rep.DataSource = dataSource; //rep.DisplayMember = "HRTimeSheetParamNo"; //rep.ValueMember = "HRTimeSheetParamNo"; //rep.ShowHeader = false; //rep.TextEditStyle = TextEditStyles.Standard; //rep.NullText = string.Empty; //LookUpColumnInfo lookupColumn = new LookUpColumnInfo(); //lookupColumn.FieldName = "HRTimeSheetParamNo"; //rep.Columns.Add(lookupColumn); //column.ColumnEdit = rep; RepositoryItemCheckedComboBoxEdit rep = new RepositoryItemCheckedComboBoxEdit(); rep.DataSource = dataSource; rep.DisplayMember = "HRTimeSheetParamNo"; rep.ValueMember = "HRTimeSheetParamNo"; rep.TextEditStyle = TextEditStyles.Standard; rep.NullText = string.Empty; //LookUpColumnInfo lookupColumn = new LookUpColumnInfo(); //lookupColumn.FieldName = "HRTimeSheetParamNo"; //rep.Columns.Add(lookupColumn); column.ColumnEdit = rep; }
public static void BindingCheckedComboBoxSource(RepositoryItemCheckedComboBoxEdit edit, DataTable dataSource, string displayMember, string valueMember) { edit.DisplayMember = displayMember; edit.ValueMember = valueMember; edit.DataSource = null; edit.DataSource = dataSource; }
internal static void CheckedComboBoxEditor_货品类别(RepositoryItemCheckedComboBoxEdit properties) { var list = 货品类别Logic.GetList(); properties.DataSource = list; properties.ValueMember = "编码"; properties.DisplayMember = "类别名称"; }
protected override void SetupRepositoryItem(RepositoryItem item) { base.SetupRepositoryItem(item); if (TypeHasFlagsAttribute()) { RepositoryItemCheckedComboBoxEdit checkedItem = ((RepositoryItemCheckedComboBoxEdit)item); checkedItem.BeginUpdate(); checkedItem.Items.Clear(); noneValue = GetNoneValue(); //checkedItem.SelectAllItemVisible = false; //Dennis: this is required to show localized items in the editor. foreach (object value in EnumDescriptor.Values) { if (!IsNoneValue(value)) { checkedItem.Items.Add(value, EnumDescriptor.GetCaption(value), CheckState.Unchecked, true); } } //Dennis: use this method if you don't to show localized items in the editor. //checkedItem.SetFlags(GetUnderlyingType()); checkedItem.EndUpdate(); checkedItem.ParseEditValue += checkedEdit_ParseEditValue; checkedItem.CustomDisplayText += checkedItem_CustomDisplayText; checkedItem.Disposed += checkedItem_Disposed; } }
void checkedItem_Disposed(object sender, EventArgs e) { RepositoryItemCheckedComboBoxEdit checkedItem = (RepositoryItemCheckedComboBoxEdit)sender; checkedItem.ParseEditValue -= checkedEdit_ParseEditValue; checkedItem.CustomDisplayText -= checkedItem_CustomDisplayText; checkedItem.Disposed -= checkedItem_Disposed; }
//filter control public override void applyCustomEditShownFilterControl(IDataBindingSource src, ShowValueEditorEventArgs e) { RepositoryItemCheckedComboBoxEdit rle = new RepositoryItemCheckedComboBoxEdit(); e.CustomRepositoryItem = rle; rle.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; setupRle(src, rle, e.CurrentNode.FirstOperand.PropertyName); }
/// <summary> /// Khởi tạo cho RepositoryItemCheckedComboBoxEdit /// </summary> /// <param name="ri"></param> /// <param name="type"></param> public static void InitWithType(this RepositoryItemCheckedComboBoxEdit ri, Type type) { // Thiết lập Display Member ri.DisplayMember = TypeListFieldNameAttributes <DisplayFieldAttribute> .Inst[type].FirstOrDefault().Name; // Thiết lập Value Member ri.ValueMember = TypeListFieldNameAttributes <ValueFieldAttribute> .Inst[type].FirstOrDefault().Name; }
public static void SetOptionDataSource(RepositoryItemCheckedComboBoxEdit control, DataTable table, string columnName) { table = Sort(table, columnName, "ASC"); control.Items.Clear(); for(int i=0; i<table.Rows.Count; i++) { control.Items.Add(table.Rows[i][columnName].ToString()); } }
public static void SetOptionDataSource(RepositoryItemCheckedComboBoxEdit control, DataTable table, string columnName) { table = Sort(table, columnName, "ASC"); control.Items.Clear(); for (int i = 0; i < table.Rows.Count; i++) { control.Items.Add(table.Rows[i][columnName].ToString()); } }
private void WindwardPropertyGridControl_CustomRecordCellEdit(object sender, DevExpress.XtraVerticalGrid.Events.GetCustomRowCellEditEventArgs e) { if (GetPropertyDescriptor(e.Row) is PropertySpecificationDescriptor desc && desc.Specification.IsValueListFlags) { RepositoryItemCheckedComboBoxEdit riFlags = new RepositoryItemCheckedComboBoxEdit(); riFlags.Items.AddRange(desc.Specification.ValueList.ToArray()); e.RepositoryItem = riFlags; } }
/// <summary> /// 绑定控件的字典数据 /// </summary> public static DataTable BindDictItems(this RepositoryItemCheckedComboBoxEdit control, DataTable dataSource, string displayMember, string valueMember) { control.DataSource = dataSource; control.DisplayMember = displayMember; control.ValueMember = valueMember; control.NullText = string.Empty; return(dataSource); }
/// <summary> /// 绑定 CheckedComboBox /// </summary> /// <param name="dt"></param> /// <param name="lst"></param> /// <param name="description"></param> /// <param name="value"></param> public static void BindCheckedComboBoxEdit(DataTable dt, RepositoryItemCheckedComboBoxEdit lst, string description, string value) { lst.DataSource = dt; lst.DisplayMember = description; lst.ValueMember = value; lst.SelectAllItemCaption = "选择全部"; lst.SelectAllItemVisible = true; lst.ShowButtons = false; lst.GetItems(); }
public static RepositoryItemCheckedComboBoxEdit CreateTreeCheckedComboBoxEdit(this TreeListColumn treeColumn) { RepositoryItemCheckedComboBoxEdit repositoryItem = new RepositoryItemCheckedComboBoxEdit { AutoHeight = false }; treeColumn.TreeList.RepositoryItems.Add(repositoryItem); treeColumn.ColumnEdit = repositoryItem; return(repositoryItem); }
/// <summary> /// 绑定控件的字典数据 /// </summary> public static List <string> BindDictItems(this RepositoryItemCheckedComboBoxEdit control, List <string> list, bool emptyFlag = true) { if (emptyFlag) { list.Insert(0, ""); } control.Items.Clear(); control.Items.AddRange(list.ToArray()); return(list); }
/// <summary> /// 创建GridView的列编辑为CheckedComboBoxEdit /// </summary> /// <param name="gridColumn">GridColumn列对象</param> /// <returns></returns> public static RepositoryItemCheckedComboBoxEdit CreateCheckedComboBoxEdit(this GridColumn gridColumn) { RepositoryItemCheckedComboBoxEdit repositoryItem = new RepositoryItemCheckedComboBoxEdit { AutoHeight = false }; gridColumn.View.GridControl.RepositoryItems.Add(repositoryItem); gridColumn.ColumnEdit = repositoryItem; return(repositoryItem); }
private List <ModuleDto> curModules; // 角色的权限表(包含未授权的模块,权限为0) #region 权限下拉框 /// <summary> /// 权限表中嵌入下拉框 /// </summary> /// <returns></returns> private RepositoryItemCheckedComboBoxEdit InitRepository() { RepositoryItemCheckedComboBoxEdit ri = new RepositoryItemCheckedComboBoxEdit(); ri.Name = "cbxPermission"; //checkedComboBoxEdit1"; // 生成下拉列表中的所有权限内容 ri.SetFlags(typeof(PermissionValue)); removeCombinedFlags(ri); return(ri); }
public frmPCTXemLichPhatSong(object id, bool? IsAdd) { this.IsAdd = IsAdd; InitializeComponent(); InitGrid(); barButtonItemCapNhat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; repositoryItemCheckedCotHienThi = AppCtrl.AddTuyBienCot(barManager1, bar3, gridViewMaster, new string[] {CotKenhPhat.Name,CotNgayPhatSong.Name,CotGioPhatSong.Name,CotThoiLuong.Name ,CotTietMuc.Name,CotNoiDung.Name,CotTapSo.Name,CotMaBang.Name ,CotSoLanDaPhat.Name,CotNgayPhatLanDau.Name,CotDonViSoHuu.Name,CotDonViCungCap.Name ,CotNuocSanXuat.Name,CotDoiTuongKhanGia.Name,CotRating.Name}); HelpControlExt.AutoSetTabIndex(this); }
/// <summary> /// 权限表中嵌入下拉框 /// </summary> /// <returns></returns> private RepositoryItemCheckedComboBoxEdit InitRepository() { RepositoryItemCheckedComboBoxEdit ri = new RepositoryItemCheckedComboBoxEdit(); ri.Name = "cbxPermission"; //checkedComboBoxEdit1"; ri.GetItemEnabled += new GetCheckedComboBoxItemEnabledEventHandler(this.cbxPermission_GetItemEnabled); // 生成下拉列表中的所有权限内容 ri.SetFlags(typeof(PermissionValue)); removeCombinedFlags(ri); return(ri); }
public CurveTemplateView() { InitializeComponent(); _gridViewBinder = new GridViewBinder <CurveTemplateDTO>(mainView); _lineStyleRepository = new UxRepositoryItemLineStyles(mainView); _lineThicknessRepository = new UxRepositoryItemComboBox(mainView); _symbolRepository = new UxRepositoryItemSymbols(mainView); _colorRepository = new UxRepositoryItemColorPickEditWithHistory(mainView); _buttonRepository = new UxRepositoryItemButtonEdit(ButtonPredefines.Delete); _quantityTypeRepository = new UxRepositoryItemCheckedComboBoxEdit(mainView, typeof(QuantityType)); _deleteButton = _buttonRepository.Buttons[0]; mainView.AllowsFiltering = false; }
public frmBienMucAdvanceQL() { InitializeComponent(); TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; DisplayField = BIEN_MUC.MA_BANG; Fix = new PhieuQuanLy10BandedFix(this); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); BandedGridColumn colBanQuyen = new BandedGridColumn();//Cột dùng để lọc, ko hiện trên lưới colBanQuyen.Caption = TimKiem.CotThoiHanBanQuyen.Caption; gridViewMaster.Columns.Add(colBanQuyen); TimKiem.gridBandNguonGoc.Columns.Add(colBanQuyen); HelpGridColumn.CotDateEdit(colBanQuyen, BIEN_MUC.THOI_HAN_BAN_QUYEN); BandedGridColumn colIsBanQuyen = new BandedGridColumn();//Cột dùng để lọc, ko hiện trên lưới colIsBanQuyen.Caption = "Thời hạn bản quyền (loại)"; gridViewMaster.Columns.Add(colIsBanQuyen); TimKiem.gridBandNguonGoc.Columns.Add(colIsBanQuyen); AppCtrl.InitCotBanQuyen(colIsBanQuyen, BIEN_MUC.IS_THOI_HAN_BAN_QUYEN); checkListCol = TimKiem.AddTuyBienCot(this.barManager1, MainBar, colBanQuyen,colIsBanQuyen); AppCtrl.InitPrintGrid(this,false); AppCtrl.FormatButtonTimKiem(this); BarButtonItem xemtatCa = AppCtrl.AddXemTatCa(this, checkListCol); xemtatCa.ItemClick += delegate(object sender, ItemClickEventArgs e) { popupControlContainerFilter.Visible = true; dockPanel1.Visibility = DevExpress.XtraBars.Docking.DockVisibility.AutoHide; dockPanel1.HideSliding(); filterControl1.SetDefaultColumn(null); filterControl1.FilterString = null; filterControl1.SetDefaultColumn(filterControl1.FilterColumns[BIEN_MUC.TIET_MUC]); }; filterControl1.FilterChanged += delegate(object sender, FilterChangedEventArgs e) { if (e.Action == FilterChangedAction.ClearAll || (e.Action == FilterChangedAction.RemoveNode && filterControl1.FilterString == "")) { gridViewMaster.ClearColumnsFilter(); } }; this.dockManager1.Load += new EventHandler(dockManager1_Load); _msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' biên mục đang chọn?"; _msgNotifyDeleteFail = "Thao tác 'Xóa' biên mục \"{0}\" thực hiện không thành công. Vui lòng kiểm tra lại dữ liệu."; }
public frmBienMucDeletedQL() { InitializeComponent(); TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; DisplayField = BIEN_MUC.MA_BANG; Fix = new PhieuQuanLy10BandedFix(this); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); checkListCol = TimKiem.AddTuyBienCot(barManager1, MainBar); AppCtrl.InitPrintGrid(this,false); AppCtrl.SetMaskNam(NamSXTu, NamSXDen); // AppCtrl.SetTenYear(NamSXTu, NamSXDen); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,checkListCol); AppCtrl.AddRefresh(this); }
protected void BuildColumnFilter(GridColumn gridColumn, RepositoryItemCheckedComboBoxEdit checkedComboBoxEdit) { var typeFilterList = checkedComboBoxEdit.Items.Cast <CheckedListBoxItem>() .Where(p => p.CheckState == CheckState.Checked) .Select(p => (string)p.Value).ToList(); if (typeFilterList.Count == 0) { gridColumn.FilterInfo = null; return; } var containsOp = new InOperator(gridColumn.FieldName, typeFilterList); gridColumn.FilterInfo = new ColumnFilterInfo(containsOp); }
private static void BoundDatabase(RepositoryItemCheckedComboBoxEdit lue, DataTable dt, bool displayCombination, string DisplayFileName, string ValueFileName) { string str = DisplayFileName; if (displayCombination) { Common.AddColumns(dt, ValueFileName, DisplayFileName); str = Common.DefNewColName; } lue.DisplayMember = str; lue.ValueMember = ValueFileName; lue.DataSource = dt; lue.DropDownRows = GetShowSourceRows(dt.Rows.Count); }
private void removeCombinedFlags(RepositoryItemCheckedComboBoxEdit ri) { for (int i = ri.Items.Count - 1; i > 0; i--) { Enum val1 = ri.Items[i].Value as Enum; for (int j = i - 1; j >= 0; j--) { Enum val2 = ri.Items[j].Value as Enum; if (val1.HasFlag(val2)) { ri.Items.RemoveAt(i); break; } } } }
/// <summary> /// 多选 /// </summary> /// <param name="dateElement"></param> /// <returns></returns> private RepositoryItemCheckedComboBoxEdit SetRepositoryItemCheckedComboBoxEdit(DataElementEntity dateElement) { try { RepositoryItemCheckedComboBoxEdit repositoryItemCheckedComboBoxEdit = new RepositoryItemCheckedComboBoxEdit(); repositoryItemCheckedComboBoxEdit.DataSource = dateElement.BaseOptionList; repositoryItemCheckedComboBoxEdit.SelectAllItemCaption = "选中所有"; repositoryItemCheckedComboBoxEdit.ShowButtons = false; repositoryItemCheckedComboBoxEdit.DisplayMember = "Name"; repositoryItemCheckedComboBoxEdit.ValueMember = "Id"; return(repositoryItemCheckedComboBoxEdit); } catch (Exception ex) { throw ex; } }
public frmThongKePCT() { InitializeComponent(); new TPhieuThongKeFix(this, true); pivotGridMaster.OptionsChartDataSource.ChartDataVertical = false; checkListCol = AppCtrl.AddTuyBienCot(barManager1, MainBar, pivotGridMaster, new PivotGridField[]{fieldKenhPhat, fieldTietMuc, fieldNoiDung,fieldTenGoc,fieldTongTap, fieldNuocSX, fieldNgayPhatTapDau}, new bool[] { true, true, true, false, false, true, true }); AppCtrl.FormatButtonTimKiem(this); AppCtrl.InitPrintGrid(this, true); HelpControl.RedCheckEdit(ckcPhatChinh, ckcPhatLai, ckcTapSoKhacRong, ckctapSoRong); ckcPhatChinh.Checked = true; ckcPhatLai.Checked = true; ckcTapSoKhacRong.Checked = true; ckctapSoRong.Checked = true; }
public frmQLKhoLuuHD() { InitializeComponent(); TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; DisplayField =BIEN_MUC.MA_BANG; this._UsingExportToFileItem = true; fix = new PhieuQuanLy10BandedFix(this); // PMSupport.SetTitle(this, Status); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); checkListCol = AppCtrl.AddTuyBienCot(this.barManager1, this.MainBar, gridViewMaster, TimKiem.CotTietMuc.Name, TimKiem.CotMaBang.Name, TimKiem.CotSoTap.Name, TimKiem.CotTongTap.Name, TimKiem.CotNoiLuuTru.Name, TimKiem.CotNgayNhap.Name, TimKiem.CotTTDinhKem.Name); AppCtrl.InitPrintGrid(this,false); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,checkListCol); AppCtrl.AddRefresh(this); }
/// <summary> /// 绑定控件的字典数据 /// </summary> public static List <CListItem> BindDictItems(this RepositoryItemCheckedComboBoxEdit control, List <CListItem> list, bool emptyFlag = true) { if (emptyFlag) { list.Insert(0, new CListItem("")); } List <CheckedListBoxItem> checkList = new List <CheckedListBoxItem>(); foreach (CListItem item in list) { checkList.Add(new CheckedListBoxItem(item.Value, item.Text)); } control.Items.Clear(); control.Items.AddRange(list.ToArray()); return(list); }
public UserGroupForm(MainForm mainForm, DataTable dtUserGroups, DataTable dtRoles) { this.mainForm = mainForm; InitializeComponent(); this.vGridControl.OptionsView.MinRowAutoHeight = 22; this.vGridControl.RowHeaderWidth = 120; this.vGridControl.RecordWidth = this.vGridControl.Width - this.vGridControl.RowHeaderWidth - 1; this.vGridControl.FocusedRowChanged += new DevExpress.XtraVerticalGrid.Events.FocusedRowChangedEventHandler(vGridControl_FocusedRowChanged); comboBoxEdit = new RepositoryItemCheckedComboBoxEdit(); comboBoxEdit.EditValueChanged += new EventHandler(comboBoxEdit_EditValueChanged); textEdit = new RepositoryItemTextEdit(); textEdit.EditValueChanged += new EventHandler(textEdit_EditValueChanged); this.dtUserGroups = dtUserGroups; this.dtRoles = dtRoles; }
public frmLichPhatSongQL() { InitializeComponent(); IDField = "LPS_ID"; DisplayField = "LPS_ID"; fix = new PhieuQuanLy10Fix(this); AppCtrl.InitPrintGrid(this,true); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,null); repositoryItemCheckedCotHienThi = AppCtrl.AddTuyBienCot(barManager1, this.MainBar, gridViewMaster, new string[] {colKenhPhat.Name,colNgayPhatSong.Name,colGioPhatSong.Name,colThoiLuong.Name ,colTietMuc.Name,colNoiDung.Name,colTapSo.Name,colMaBang.Name ,colThongTinThem.Name,colGhiChu.Name}); AppCtrl.AddRefresh(this); _msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' lịch phát sóng đang chọn?"; _msgNotifyDeleteFail = "Thao tác 'Xóa' lịch phát sóng \"{0}\" thực hiện không thành công. Vui lòng kiểm tra lại dữ liệu."; }
private static void repositoryItemCheckedComboBoxEditLoaiNhanVien_Validating(object sender, System.ComponentModel.CancelEventArgs e) { RepositoryItemCheckedComboBoxEdit cbo = (RepositoryItemCheckedComboBoxEdit)sender; foreach (CheckedListBoxItem item in cbo.Items) { if (item.Value.Equals("-1")) { foreach (CheckedListBoxItem item2 in cbo.Items) { if (!item2.Value.Equals("-1")) { item2.CheckState = CheckState.Unchecked; } } break; } } }
protected override void SetupRepositoryItem(RepositoryItem item) { base.SetupRepositoryItem(item); if (TypeHasFlagsAttribute()) { RepositoryItemCheckedComboBoxEdit checkedItem = ((RepositoryItemCheckedComboBoxEdit)item); checkedItem.BeginUpdate(); noneValue = GetNoneValue(); checkedItem.SetFlags(GetUnderlyingType()); //Dennis: this is required to show localized items in the editor. foreach (CheckedListBoxItem itm in checkedItem.Items) { itm.Description = EnumDescriptor.GetCaption(itm.Value); } checkedItem.EndUpdate(); checkedItem.ParseEditValue += checkedEdit_ParseEditValue; checkedItem.CustomDisplayText += checkedItem_CustomDisplayText; checkedItem.Disposed += checkedItem_Disposed; } }
public frmTimKiemDonGian() { InitializeComponent(); TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; DisplayField = BIEN_MUC.MA_BANG; Fix = new PhieuQuanLy10BandedFix(this); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); checkListCol = TimKiem.AddTuyBienCot(barManager1, MainBar); AppCtrl.InitPrintGrid(this,false); AppCtrl.SetMaskNam(NamSXTu, NamSXDen); //AppCtrl.SetTenYear(NamSXTu, NamSXDen); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,checkListCol); AppCtrl.AddRefresh(this); //_msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' biên mục \"{0}\" ?"; _msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' biên mục đang chọn?"; _msgNotifyDeleteFail = "Thao tác 'Xóa' biên mục \"{0}\" thực hiện không thành công. Vui lòng kiểm tra lại dữ liệu."; }
private AppGridTimKiemBienMuc TimKiem; //Khai báo cột trong đây #endregion Fields #region Constructors public frmBienMucQL() { InitializeComponent(); TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; DisplayField = BIEN_MUC.MA_BANG; Fix = new PhieuQuanLy10BandedFix(this); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); checkListCol = TimKiem.AddTuyBienCot(this.barManager1, this.MainBar); AppCtrl.InitPrintGrid(this,false); AppCtrl.SetMaskNam(NamSXTu, NamSXDen); //AppCtrl.SetTenYear(NamSXTu, NamSXDen); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this,checkListCol); AppCtrl.AddRefresh(this); barButtonItemAddNext.Glyph = FrameworkParams.imageStore.GetImage2020("btnAddNext.png"); _msgConfirmBeforeDelete = "Bạn có muốn 'Xóa' biên mục đang chọn?"; _msgNotifyDeleteFail = "Thao tác 'Xóa' biên mục \"{0}\" thực hiện không thành công. Vui lòng kiểm tra lại dữ liệu."; barButtonItemAddNext.Enabled = false; gridViewMaster.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(gridViewMaster_FocusedRowChanged); }
public void InitColumnRepository() { ArrangementShiftEntities entity = (ArrangementShiftEntities)CurrentModuleEntity; VinaGridControl employeeArrangementShiftsGridControl = (VinaGridControl)Controls["fld_dgcHREmployeeArrangementShifts"]; RepositoryItemCheckedComboBoxEdit reposItemCheckedCombo = new RepositoryItemCheckedComboBoxEdit(); ADWorkingShiftsController objWorkingShiftsController = new ADWorkingShiftsController(); List <ADWorkingShiftsInfo> mainParams = (List <ADWorkingShiftsInfo>)objWorkingShiftsController.GetListFromDataSet(objWorkingShiftsController.GetAllObjects()); reposItemCheckedCombo.DataSource = mainParams; reposItemCheckedCombo.DisplayMember = "ADWorkingShiftName"; reposItemCheckedCombo.ValueMember = "ADWorkingShiftName"; employeeArrangementShiftsGridControl.RepositoryItems.Add(reposItemCheckedCombo); GridView gridView = (GridView)employeeArrangementShiftsGridControl.MainView; for (int i = 4; i < gridView.Columns.Count; i++) { gridView.Columns[i].ColumnEdit = reposItemCheckedCombo; } reposItemCheckedCombo.EditValueChanged += new EventHandler(ReposItemCheckedCombo_EditValueChanged); }
private void setupRle(IDataBindingSource src, RepositoryItemCheckedComboBoxEdit rle, string fn) { //rle.DisplayMember = DisplayMember; //rle.ValueMember = ValueMember; GetFieldOptionsListEventData qd = new GetFieldOptionsListEventData { Data = null, FieldName = fn, DataBindingSource = src }; src.EditorsHost.onGetOptionsList(this, qd); if (qd.Data != null) { CheckedListBoxItemCollection coll = rle.Items; coll.BeginUpdate(); try { qd.Data.Cast <object>().ToList().ForEach(o => coll.Add(o)); } finally { coll.EndUpdate(); } } }
/// <summary> /// Hiển thị các cột đã được chọn /// </summary> /// <param name="gridView"></param> /// <param name="cotHienThi"></param> public static void DisplayTheoTuyBienCot(PivotGridControl pivot, RepositoryItemCheckedComboBoxEdit cotHienThi) { //gridView.ClearGrouping(); List<string> chekedItem = new List<string>(); List<string> allItem = new List<string>(); foreach (CheckedListBoxItem item in cotHienThi.Items) { allItem.Add(item.Value.ToString()); if (item.CheckState == CheckState.Checked) chekedItem.Add(item.Value.ToString()); } foreach (PivotGridField field in pivot.Fields) { if (allItem.Contains(field.Name) == false) continue; field.Visible = false; if (chekedItem.Contains(field.Name)) { field.Visible = true; // field.vi = i++; } // else field.Visible = false; } pivot.BestFit(); }
/// <summary> /// Hiển thị các cột đã được chọn /// </summary> /// <param name="gridView"></param> /// <param name="cotHienThi"></param> public static void DisplayTheoTuyBienCot(GridView gridView, RepositoryItemCheckedComboBoxEdit cotHienThi) { //gridView.ClearGrouping(); List<string> listCotHienThi = new List<string>(cotHienThi.GetCheckedItems().ToString().Split(',')); int i = 0; foreach (GridColumn column in gridView.Columns) { if (listCotHienThi.Exists(delegate(string visibleName) { return string.Compare(visibleName.Trim(), column.Name) == 0; })){ column.Visible = true; column.VisibleIndex = i++; } else column.Visible = false; } gridView.BestFitColumns(); }
public static BarButtonItem AddXemTatCa(PhieuQuanLy10Change frm, RepositoryItemCheckedComboBoxEdit listChoseColumn) { return AddXemTatCa(frm.barManager1, frm.MainBar, frm.barButtonItemSearch, frm.popupControlContainerFilter, frm.barCheckItemFilter, frm.gridViewMaster, listChoseColumn, frm.UpdateRow()); }
public static BarButtonItem AddXemTatCa(TimPopupBandedChange frm,RepositoryItemCheckedComboBoxEdit listChoseColumn, string filterString) { return AddXemTatCa(frm.barManager1, frm.MainBar, frm.barButtonItemSearch, frm.popupControlContainerFilter, frm.barCheckItemFilter, frm.gridViewMaster, listChoseColumn, filterString); }
public override void applyCustomRowCellEdit(IDataBindingSource src, CustomRowCellEditEventArgs e) { RepositoryItemCheckedComboBoxEdit rle = e.RepositoryItem as RepositoryItemCheckedComboBoxEdit; rle.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; }
private void Init(bool multiSelect) { InitializeComponent(); this.MultiSelect = multiSelect; TimKiem = new AppGridTimKiemBienMuc(gridViewMaster); IDField = BIEN_MUC.BM_ID; new TimPopupBandedFix(this); AppCtrl.SetAutoHideEmptyBand(gridViewMaster); checkListCol = TimKiem.AddTuyBienCotSeachPopup(barManager1, MainBar); AppCtrl.InitPrintGrid(this, false); AppCtrl.SetMaskNam(NamSXTu, NamSXDen); //AppCtrl.SetTenYear(NamSXTu, NamSXDen); AppCtrl.FormatButtonTimKiem(this); AppCtrl.AddXemTatCa(this, checkListCol,BIEN_MUC.FILTER_STRING); AppCtrl.AddRefresh(this); this.WindowState = System.Windows.Forms.FormWindowState.Normal; this.MinimumSize = new System.Drawing.Size(400, 300); this.Size = new System.Drawing.Size(800, 500); }
void filterControl1_BeforeShowValueEditor(object sender, DevExpress.XtraEditors.Filtering.ShowValueEditorEventArgs e) { if (e.CurrentNode.FirstOperand.PropertyName == BIEN_MUC.DOI_TUONG_KHAN_GIA) { DataTable dt = HelpDB.getDBService().LoadDataSet( string.Format("SELECT * from {0}", DMDoiTuongKG.TABLE_MAP)).Tables[0]; RepositoryItemCheckedComboBoxEdit checkDoiTuongKhanGia = new RepositoryItemCheckedComboBoxEdit(); checkDoiTuongKhanGia.DataSource = dt; checkDoiTuongKhanGia.DisplayMember = "NAME"; checkDoiTuongKhanGia.ValueMember = "NAME"; e.CustomRepositoryItem = checkDoiTuongKhanGia; } else if (e.CurrentNode.FirstOperand.PropertyName == BIEN_MUC.TU_KHOA) { RepositoryItemCheckedComboBoxEdit checkTuKhoa = new RepositoryItemCheckedComboBoxEdit(); checkTuKhoa.DataSource = HelpDB.getDBService().LoadDataSet( string.Format("SELECT * from {0}", DMTuKhoa.TABLE_MAP)).Tables[0]; checkTuKhoa.DisplayMember = "NAME"; checkTuKhoa.ValueMember = "NAME"; e.CustomRepositoryItem = checkTuKhoa; } else if (e.CurrentNode.FirstOperand.PropertyName == BIEN_MUC.NUOC_SAN_XUAT) { RepositoryItemCheckedComboBoxEdit checkNuocSanXuat = new RepositoryItemCheckedComboBoxEdit(); checkNuocSanXuat.DataSource = HelpDB.getDBService().LoadDataSet( string.Format("SELECT * from {0}", DMNuocSanXuat.TABLE_MAP)).Tables[0]; checkNuocSanXuat.DisplayMember = "NAME"; checkNuocSanXuat.ValueMember = "NAME"; e.CustomRepositoryItem = checkNuocSanXuat; } else if (e.CurrentNode.FirstOperand.PropertyName == BIEN_MUC.NOI_DUNG) { PLRepositoryTextEditAutocomplete re = new PLRepositoryTextEditAutocomplete(); re._Init(BIEN_MUC.TABLE_NAME, BIEN_MUC.NOI_DUNG, BIEN_MUC.IS_DELETE + "='N'"); e.CustomRepositoryItem = re; } else if (e.CurrentNode.FirstOperand.PropertyName == BIEN_MUC.THOI_LUONG) { RepositoryItemTextEdit timeCode = new RepositoryItemTextEdit(); timeCode.Properties.Mask.AutoComplete = DevExpress.XtraEditors.Mask.AutoCompleteType.Optimistic; timeCode.Properties.Mask.EditMask = "[0-9][0-9]:[0-5][0-9]:[0-5][0-9]:(([0-1][0-9])|([2][0-3]))"; timeCode.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx; timeCode.Properties.Mask.ShowPlaceHolders = true; e.CustomRepositoryItem = timeCode; } }
private static BarEditItem AddTuyBienCot(BarManager barManager, LinksInfo linksInfo, string caption, GridView gridView, GridColumn[] excludeColumns, params string[] defaultColumns) { var repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit { AutoHeight = false, BestFitWidth = 180, Name = "repositoryItemCheckedCotHienThi" }; // // repositoryItemCheckedCotHienThi // // var barEditItemCotHienThi = new BarEditItem { Caption = string.IsNullOrEmpty(caption) ? "&Cột hiển thị" : caption, Edit = repositoryItemCheckedCotHienThi, Name = "barEditItem1", PaintStyle = BarItemPaintStyle.CaptionGlyph, Width = 200 }; // // barEditItemCotHienThi // // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new RepositoryItem[] { repositoryItemCheckedCotHienThi }); // linksInfo.Add(new LinkPersistInfo(barEditItemCotHienThi, true)); //Gán. các cột vào CheckedComboBox var columns = gridView.Columns.Cast<GridColumn>().OrderBy(cl => cl.Caption); if (excludeColumns == null || excludeColumns.Length == 0) { foreach (GridColumn column in columns) { //repositoryItemCheckedCotHienThi.Items.Add(column.Name, column.Caption); repositoryItemCheckedCotHienThi.Items.Add(column, !string.IsNullOrEmpty(column.CustomizationCaption) ? column.CustomizationCaption : column.Caption); } } else { var listExcludeCol = new List<GridColumn>(excludeColumns); foreach (GridColumn column in columns) { if (listExcludeCol.Any(c => c.Name == column.Name)) { column.Visible = false; column.OptionsColumn.AllowShowHide = false; continue; } //repositoryItemCheckedCotHienThi.Items.Add(column.Name, column.Caption); repositoryItemCheckedCotHienThi.Items.Add(column, !string.IsNullOrEmpty(column.CustomizationCaption) ? column.CustomizationCaption : column.Caption); } } //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, CloseUpEventArgs e) { var value = new StringBuilder(); foreach ( CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit). Properties.SeparatorChar. ToString()); ((GridColumn)item.Value).Visible = true; } else { ((GridColumn)item.Value).Visible = false; } } e.Value = value.Length > 0 ? value.ToString().Remove(value.Length - 1) : string.Empty; gridView.BestFitColumns(); }; // //Kiểm tra đã tồn tại layout cho gridView var str = new StringBuilder(FrameworkParams.currentUser.username); str.Append(gridView.GridControl.FindForm().Name + gridView.GridControl.Name + gridView.Name); var listFile = new List<FileInfo>(new DirectoryInfo(FrameworkParams.LAYOUT_FOLDER).GetFiles()); if (listFile.Exists(delegate(FileInfo e) { if (e.Name.Length >= str.Length) return String.CompareOrdinal(str.ToString(), e.Name.Substring(0, str.Length)) == 0; return false; })) { defaultColumns = null; gridView.GridControl.Load += delegate { var displayText = new StringBuilder(); var listDefaultColumn = (from GridColumn column in gridView.Columns where column.Visible || column.GroupIndex >= 0 select column.Name).ToList(); for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) { var temp = (GridColumn)repositoryItemCheckedCotHienThi.Items[i].Value; if (listDefaultColumn.Contains(temp.Name)) { repositoryItemCheckedCotHienThi.Items[i].CheckState = CheckState.Checked; displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i] .Description + repositoryItemCheckedCotHienThi. SeparatorChar.ToString()); temp.Visible = true; } else temp.Visible = false; } if (displayText.ToString() != string.Empty) barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); repositoryItemCheckedCotHienThi. SynchronizeEditValueWithCheckedItems = false; }; } //------------------------------ //Set các cột hiển thị mặc định if (defaultColumns != null) { var listDefaultColumn = new List<string>(defaultColumns); var displayText = new StringBuilder(); for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) { var temp = (GridColumn)repositoryItemCheckedCotHienThi.Items[i].Value; if (listDefaultColumn.Contains(temp.Name)) { repositoryItemCheckedCotHienThi.Items[i].CheckState = CheckState.Checked; displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); temp.Visible = true; } else temp.Visible = false; } if (displayText.ToString() != string.Empty) barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; // DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); } gridView.ColumnPositionChanged += delegate(object sender, EventArgs e) { var col = (GridColumn)sender; CheckedListBoxItem item = repositoryItemCheckedCotHienThi.Items[col]; if (item == null) return; item.CheckState = col.Visible ? CheckState.Checked : CheckState.Unchecked; barEditItemCotHienThi.EditValue = repositoryItemCheckedCotHienThi.GetCheckedItems().ToString(); }; return barEditItemCotHienThi; }
private static RepositoryItemCheckedComboBoxEdit InitCotMultiChoice(bool isReadOnly, GridColumn col, string tableName, string valueField, string displayField, string fieldName, string fieldSort) { string newFieldName = fieldName + AppConst.EXT_FIELD; var rep = new RepositoryItemCheckedComboBoxEdit(); var ds = HelpDB.getDatabase().LoadDataSet( string.Format("select {0},{1} from {2} order by {3} ", valueField, displayField, tableName, fieldSort), tableName); if (ds == null || ds.Tables.Count == 0) return rep; if (isReadOnly) { foreach (DataRow row in ds.Tables[0].Rows) { rep.Items.Add(row[valueField], row[displayField].ToString(), CheckState.Unchecked, false); } } else rep.DataSource = ds.Tables[0]; rep.ValueMember = valueField; rep.DisplayMember = displayField; rep.ShowButtons = false; rep.TextEditStyle = TextEditStyles.DisableTextEditor; rep.SelectAllItemVisible = false; col.ColumnEdit = rep; col.FieldName = newFieldName; var grid = col.View as GridView; grid.GridControl.DataSourceChanged += (sender, e) => { if (isReadOnly) { col.OptionsColumn.AllowFocus = true; col.OptionsColumn.AllowEdit = true; col.OptionsColumn.ReadOnly = false; } var dtSource = ((GridControl)sender).DataSource as DataTable; if (dtSource.Columns.Contains(newFieldName) == false) dtSource.Columns.Add(newFieldName, typeof(string)); foreach (DataRow row in dtSource.Rows) { if (row[fieldName].ToString() != "") { row[newFieldName] = RefactorIDs(row[fieldName]); } } dtSource.AcceptChanges(); //((GridControl)sender).DataSource = dtSource; }; if (isReadOnly == false) { grid.CellValueChanged += delegate(object sender, CellValueChangedEventArgs e) { if (e.Column.FieldName == newFieldName) { DataRow r = grid.GetDataRow(e.RowHandle); if (e.Value.ToString() == "") r[fieldName] = DBNull.Value; else r[fieldName] = "," + e.Value.ToString().Replace(" ", "") + ","; } }; } return rep; }
public void InitCtrlData2(RepositoryItemCheckedComboBoxEdit combox, int index, LP_Temple lp, string sqlSentence, DSOFramerControl dsoFramerWordControl1, LP_Record currRecord) { string ctrltype = ""; if (lp.CtrlType.IndexOf(',') == -1) ctrltype = lp.CtrlType; else ctrltype = lp.CtrlType.Substring(0, lp.CtrlType.IndexOf(',')); /* * * SELECT cellname, SqlSentence,SqlColName FROM LP_Temple where SqlSentence !='' * * */ IList li = new ArrayList(); if (sqlSentence.IndexOf("Excel:") == 0) { int index1 = sqlSentence.LastIndexOf(":"); string tablename = sqlSentence.Substring(6, index1 - 6); string cellpos = sqlSentence.Substring(index1 + 1); string[] arrCellPos = cellpos.Split('|'); arrCellPos = StringHelper.ReplaceEmpty(arrCellPos).Split('|'); string strcellvalue = ""; Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook; ExcelAccess ea = new ExcelAccess(); ea.MyWorkBook = wb; ea.MyExcel = wb.Application; Excel.Worksheet sheet; sheet = wb.Application.Sheets[tablename] as Excel.Worksheet; for (int i = 0; i < arrCellPos.Length; i++) { Excel.Range range = sheet.get_Range(sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]], sheet.Cells[GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]]);//坐标 strcellvalue += range.Value2; } li.Add(strcellvalue); } else if (sqlSentence != "") { if (sqlSentence.IndexOf("{recordid}") > -1) { sqlSentence = sqlSentence.Replace("{recordid}", currRecord.ID); } if (sqlSentence.IndexOf("{orgcode}") > -1) { sqlSentence = sqlSentence.Replace("{orgcode}", MainHelper.User.OrgCode); } if (sqlSentence.IndexOf("{userid}") > -1) { sqlSentence = sqlSentence.Replace("{userid}", MainHelper.User.UserID); } Regex r1 = new Regex(@"(?<={)[0-9]+(?=})"); while (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { string strSQL = "select ControlValue from WF_TableFieldValueView where" + " UserControlId='" + listLPID[0].ParentID + "' " + "and FieldId='" + listLPID[0].LPID + "' and ID='" + currRecord.ID + "'"; li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", strSQL); if (li.Count > 0) { sqlSentence = sqlSentence.Replace("{" + sortid + "}", li[0].ToString()); } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } else { sqlSentence = sqlSentence.Replace("{" + sortid + "}", "没有找到对应的值,请检查SQL语句设置"); break; } } r1 = new Regex(@"(?<={编号规则一:)[0-9]+(?=})"); if (r1.Match(sqlSentence).Value != "") { string sortid = r1.Match(sqlSentence).Value; IList<LP_Temple> listLPID = ClientHelper.PlatformSqlMap.GetList<LP_Temple>("SelectLP_TempleList", " where sortID = '" + sortid + "' and parentid = '" + lp.ParentID + "'"); if (listLPID.Count > 0) { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } else { sqlSentence = sqlSentence.Replace("{编号规则一:" + sortid + "}", "出错,没有找到单位控件"); } } sqlSentence = sqlSentence.Replace("\r\n", ""); try { li = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", sqlSentence); } catch (Exception ex) { li.Add(sqlSentence + "出错:" + ex.Message); } if (sqlSentence.IndexOf("where 9=9") == -1) { foreach (string strname in li) { combox.Items.Add(strname); } } else { switch (li[0].ToString()) { case "{年}": combox.Items.Clear(); for (int j = 0; j <= 20; j++) { combox.Items.Add(string.Format("{0}", j + DateTime.Now.Year)); } break; case "{月}": combox.Items.Clear(); for (int j = 1; j <= 12; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{日}": combox.Items.Clear(); for (int j = 1; j <= 31; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{时}": combox.Items.Clear(); for (int j = 1; j <= 24; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; case "{分}": case "{秒}": combox.Items.Clear(); for (int j = 0; j <= 59; j++) { combox.Items.Add(string.Format("{0:D2}", j)); } break; default: string strexpress = li[0].ToString(); r1 = new Regex(@"[0-9]+\+[0-9]+"); if (r1.Match(strexpress).Value != "") { int istart = 1; int ilen = 10; r1 = new Regex(@"[0-9]+(?=\+)"); if (r1.Match(strexpress).Value != "") { istart = Convert.ToInt32(r1.Match(strexpress).Value); } r1 = new Regex(@"(?<=\+)[0-9]+"); if (r1.Match(strexpress).Value != "") { ilen = Convert.ToInt32(r1.Match(strexpress).Value); ; } for (int i = istart; i <= ilen; i++) { combox.Items.Add(string.Format("{0}", i)); } } else { string[] strItem = SelectorHelper.ToDBC(strexpress).Split(','); for (int i = 0; i < strItem.Length; i++) { combox.Items.Add(strItem[i]); } } break; } } } }
/// <summary> /// 绑定下拉列表控件为指定的数据字典列表 /// </summary> /// <param name="control">下拉列表控件</param> /// <param name="dictTypeName">数据字典类型名称</param> /// <param name="emptyFlag">是否添加空行</param> public static List <CListItem> BindDictItems(this RepositoryItemCheckedComboBoxEdit control, string dictTypeName, bool emptyFlag = true) { List <CListItem> list = BLLFactory <DictData> .Instance.GetDictListItemByDictType(dictTypeName); return(control.BindDictItems(list, emptyFlag)); }
public override void applyCustomEditShown(IDataBindingSource src, ViewEditorShownEventArgs e) { RepositoryItemCheckedComboBoxEdit rle = e.RepositoryItem as RepositoryItemCheckedComboBoxEdit; setupRle(src, rle, e.FieldName); }
public static RepositoryItemCheckedComboBoxEdit AddTuyBienCot(BarManager barManager, Bar menuBar, PivotGridField[] choseFields, bool[] defaultCheck) { var repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit { AutoHeight = false, BestFitWidth = 180, Name = "repositoryItemCheckedCotHienThi" }; // // repositoryItemCheckedCotHienThi // // var barEditItemCotHienThi = new BarEditItem { Caption = "&Cột hiển thị", Edit = repositoryItemCheckedCotHienThi, Name = "barEditItemHienThi", PaintStyle = BarItemPaintStyle.CaptionGlyph, Width = 200 }; // // barEditItemCotHienThi // // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new RepositoryItem[] { repositoryItemCheckedCotHienThi }); // menuBar.LinksPersistInfo.Add(new LinkPersistInfo(barEditItemCotHienThi, true)); //Gán các cột vào CheckedComboBox // choseFields = choseFields.OrderBy(f => f.Caption).ToArray(); var checkedListItems = new CheckedListBoxItem[choseFields.Length]; for (int i = 0; i < choseFields.Length; i++) { PivotGridField field = choseFields[i]; var ischeck = defaultCheck[i]; var item = new CheckedListBoxItem(field, field.Caption, ischeck ? CheckState.Checked : CheckState.Unchecked); checkedListItems[i] = item; } var list = checkedListItems.OrderBy(c => c.Description); repositoryItemCheckedCotHienThi.Items.AddRange(list.ToArray()); var checkedItems = list.Where(l => l.CheckState == CheckState.Checked); var text = checkedItems.Aggregate("", (current, item) => current + (" " + item.Description + repositoryItemCheckedCotHienThi.SeparatorChar)); repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; barEditItemCotHienThi.Hint = text.TrimEnd(repositoryItemCheckedCotHienThi.SeparatorChar); barEditItemCotHienThi.EditValue = barEditItemCotHienThi.Hint; //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, CloseUpEventArgs e) { var value = new StringBuilder(); foreach ( CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit). Properties.SeparatorChar. ToString()); ((PivotGridField)item.Value).Visible = true; } else { ((PivotGridField)item.Value).Visible = false; } } var description = value.Length > 0 ? value.ToString().Remove(value.Length - 1) : string.Empty; e.Value = text; barEditItemCotHienThi.Hint = description; }; //Set các cột hiển thị mặc định //if (choseFields != null) //{ // List<string> listDefaultField = new List<string>(choseFields); // StringBuilder displayText = new StringBuilder(); // for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) // { // if (listDefaultField.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())) // { // repositoryItemCheckedCotHienThi.Items[i].CheckState = CheckState.Checked; // displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); // } // } // if (displayText.ToString() != string.Empty) // barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); // repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; // DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); //} return repositoryItemCheckedCotHienThi; }
/// <summary> /// /// </summary> /// <param name="barManager"></param> /// <param name="menuBar"></param> /// <param name="gridView"></param> /// <param name="defaultColumns"></param> /// <returns></returns> public static RepositoryItemCheckedComboBoxEdit AddTuyBienCot(BarManager barManager, Bar menuBar, GridView gridView,GridColumn[] excludeColumns, params string[] defaultColumns) { RepositoryItemCheckedComboBoxEdit repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit(); // // repositoryItemCheckedCotHienThi // repositoryItemCheckedCotHienThi.AutoHeight = false; repositoryItemCheckedCotHienThi.BestFitWidth = 180; repositoryItemCheckedCotHienThi.Name = "repositoryItemCheckedCotHienThi"; // BarEditItem barEditItemCotHienThi = new BarEditItem(); // // barEditItemCotHienThi // barEditItemCotHienThi.Caption = "&Cột hiển thị"; barEditItemCotHienThi.Edit = repositoryItemCheckedCotHienThi; barEditItemCotHienThi.Name = "barEditItem1"; barEditItemCotHienThi.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; barEditItemCotHienThi.Width = 200; // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { repositoryItemCheckedCotHienThi}); // menuBar.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(barEditItemCotHienThi, true)); //Gán các cột vào CheckedComboBox if (excludeColumns == null||excludeColumns.Length==0) { foreach (GridColumn column in gridView.Columns) { repositoryItemCheckedCotHienThi.Items.Add(column.Name, column.Caption); } } else { List<GridColumn> listExcludeCol = new List<GridColumn>(excludeColumns); foreach (GridColumn column in gridView.Columns) { if (listExcludeCol.Contains(column)) { column.Visible = false; column.OptionsColumn.AllowShowHide = false; continue; } repositoryItemCheckedCotHienThi.Items.Add(column.Name, column.Caption); } } //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, DevExpress.XtraEditors.Controls.CloseUpEventArgs e) { StringBuilder value = new StringBuilder(); foreach (CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == System.Windows.Forms.CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit).Properties.SeparatorChar.ToString()); } } if (value.Length > 0) e.Value = value.ToString().Remove(value.Length - 1); else e.Value = string.Empty; }; // //Kiểm tra đã tồn tại layout cho gridView StringBuilder str = new StringBuilder(FrameworkParams.currentUser.username); str.Append(gridView.GridControl.FindForm().Name + gridView.GridControl.Name + gridView.Name); List<FileInfo> listFile = new List<FileInfo>(new DirectoryInfo(FrameworkParams.LAYOUT_FOLDER).GetFiles()); if(listFile.Exists(delegate (FileInfo e){ if (e.Name.Length >= str.Length) return string.Compare(str.ToString(), e.Name.Substring(0, str.Length)) == 0; return false; })) { defaultColumns = null; gridView.GridControl.Load += delegate(object sender, EventArgs e) { List<string> listDefaultColumn = new List<string>(); StringBuilder displayText = new StringBuilder(); foreach (GridColumn column in gridView.Columns) { if (column.Visible || column.GroupIndex >= 0) listDefaultColumn.Add(column.Name); } for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) { if (listDefaultColumn.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())) { repositoryItemCheckedCotHienThi.Items[i].CheckState = System.Windows.Forms.CheckState.Checked; displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); } } if (displayText.ToString() != string.Empty) barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; }; } //------------------------------ //Set các cột hiển thị mặc định if (defaultColumns != null) { List<string> listDefaultColumn = new List<string>(defaultColumns); StringBuilder displayText = new StringBuilder(); for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) { if(listDefaultColumn.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())){ repositoryItemCheckedCotHienThi.Items[i].CheckState = System.Windows.Forms.CheckState.Checked; displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); } } if (displayText.ToString() != string.Empty) barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); } return repositoryItemCheckedCotHienThi; }
public static RepositoryItemCheckedComboBoxEdit InitPivotFieldMulti(PivotGridField Field, string FieldName, string Caption, int VisibleIndex, int Width, string tableName) { Field.Area = PivotArea.RowArea; Field.AreaIndex = VisibleIndex; Field.Caption = Caption; Field.Width = Width; const string valueField = "ID"; const string displayField = "NAME"; const string fieldSort = "NAME"; var rep = new RepositoryItemCheckedComboBoxEdit(); var ds = HelpDB.getDatabase().LoadDataSet( string.Format("select {0},{1} from {2} order by {3} ", valueField, displayField, tableName, fieldSort), tableName); if (ds == null || ds.Tables.Count == 0) return rep; //if (isReadOnly) //{ // foreach (DataRow row in ds.Tables[0].Rows) // { // rep.Items.Add(row[valueField], row[displayField].ToString(), CheckState.Unchecked, false); // } //} //else rep.DataSource = ds.Tables[0]; rep.ValueMember = valueField; rep.DisplayMember = displayField; rep.ShowButtons = false; rep.TextEditStyle = TextEditStyles.DisableTextEditor; rep.SelectAllItemVisible = false; Field.FieldEdit = rep; Field.FieldName = FieldName; return rep; }
public static RepositoryItemCheckedComboBoxEdit AddTuyBienCot(BarManager barManager, Bar menuBar, PivotGridControl pivot,PivotGridField[] choseFields, bool[] defaultCheck) { RepositoryItemCheckedComboBoxEdit repositoryItemCheckedCotHienThi = new RepositoryItemCheckedComboBoxEdit(); // // repositoryItemCheckedCotHienThi // repositoryItemCheckedCotHienThi.AutoHeight = false; repositoryItemCheckedCotHienThi.BestFitWidth = 180; repositoryItemCheckedCotHienThi.Name = "repositoryItemCheckedCotHienThi"; // BarEditItem barEditItemCotHienThi = new BarEditItem(); // // barEditItemCotHienThi // barEditItemCotHienThi.Caption = "&Cột hiển thị"; barEditItemCotHienThi.Edit = repositoryItemCheckedCotHienThi; barEditItemCotHienThi.Name = "barEditItem1"; barEditItemCotHienThi.PaintStyle = DevExpress.XtraBars.BarItemPaintStyle.CaptionGlyph; barEditItemCotHienThi.Width = 200; // barManager.Items.Add(barEditItemCotHienThi); barManager.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { repositoryItemCheckedCotHienThi}); // menuBar.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(barEditItemCotHienThi, true)); //Gán các cột vào CheckedComboBox PivotGridField field = null; StringBuilder text = new StringBuilder(); for (int i = 0; i < choseFields.Length; i++) { field = choseFields[i]; if (defaultCheck[i]) { repositoryItemCheckedCotHienThi.Items.Add(field.Name, field.Caption, CheckState.Checked, true); field.Visible = true; text.Append(" " + field.Caption + repositoryItemCheckedCotHienThi.SeparatorChar); } else { repositoryItemCheckedCotHienThi.Items.Add(field.Name, field.Caption, CheckState.Unchecked, true); field.Visible = false; } } repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; barEditItemCotHienThi.EditValue = text.ToString().TrimEnd(repositoryItemCheckedCotHienThi.SeparatorChar); //------------------------------- // repositoryItemCheckedCotHienThi.CloseUp += delegate(object sender, DevExpress.XtraEditors.Controls.CloseUpEventArgs e) { StringBuilder value = new StringBuilder(); foreach (CheckedListBoxItem item in (sender as CheckedComboBoxEdit).Properties.Items) { if (item.CheckState == System.Windows.Forms.CheckState.Checked) { value.Append(" " + item.Description + (sender as CheckedComboBoxEdit).Properties.SeparatorChar.ToString()); } } if (value.Length > 0) e.Value = value.ToString().Remove(value.Length - 1); else e.Value = string.Empty; }; //Set các cột hiển thị mặc định //if (choseFields != null) //{ // List<string> listDefaultField = new List<string>(choseFields); // StringBuilder displayText = new StringBuilder(); // for (int i = 0; i < repositoryItemCheckedCotHienThi.Items.Count; i++) // { // if (listDefaultField.Contains(repositoryItemCheckedCotHienThi.Items[i].Value.ToString())) // { // repositoryItemCheckedCotHienThi.Items[i].CheckState = System.Windows.Forms.CheckState.Checked; // displayText.Append(" " + repositoryItemCheckedCotHienThi.Items[i].Description + repositoryItemCheckedCotHienThi.SeparatorChar.ToString()); // } // } // if (displayText.ToString() != string.Empty) // barEditItemCotHienThi.EditValue = displayText.ToString().Remove(displayText.Length - 1); // repositoryItemCheckedCotHienThi.SynchronizeEditValueWithCheckedItems = false; // DisplayTheoTuyBienCot(gridView, repositoryItemCheckedCotHienThi); //} return repositoryItemCheckedCotHienThi; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RolesChangeRibbonForm)); this.sccRoles = new DevExpress.XtraEditors.SplitContainerControl(); this.cgcRole = new CommonLibrary.GridControlFolder.CommonGridControl(); this.bsRole = new System.Windows.Forms.BindingSource(); this.cgvRole = new CommonLibrary.GridControlFolder.CommonGridView(); this.colRoleName = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.cgcUsers = new CommonLibrary.GridControlFolder.CommonGridControl(); this.bsRoleUsers = new System.Windows.Forms.BindingSource(); this.cgvUsers = new CommonLibrary.GridControlFolder.CommonGridView(); this.colSurnameInitials = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.riccbeUsers = new DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit(); this.toolTip = new DevExpress.Utils.ToolTipController(); this.sccUsers = new DevExpress.XtraEditors.SplitContainerControl(); this.cgcAllUsers = new CommonLibrary.GridControlFolder.CommonGridControl(); this.bsUser = new System.Windows.Forms.BindingSource(); this.cgvAllUsers = new CommonLibrary.GridControlFolder.CommonGridView(); this.colUserId = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.colLastName = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.colFirstName = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.colMiddleName = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.colIsLocked = new CommonLibrary.GridControlFolder.CommonGridColumn(); this.pmUsers = new DevExpress.XtraBars.PopupMenu(); this.bbiChangePassword = new DevExpress.XtraBars.BarButtonItem(); this.bbiRemovePassword = new DevExpress.XtraBars.BarButtonItem(); this.bbiLockUser = new DevExpress.XtraBars.BarButtonItem(); this.bbiUnlock = new DevExpress.XtraBars.BarButtonItem(); this.bm = new DevExpress.XtraBars.BarManager(); this.barDockControlTop = new DevExpress.XtraBars.BarDockControl(); this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl(); this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl(); this.barDockControlRight = new DevExpress.XtraBars.BarDockControl(); ((System.ComponentModel.ISupportInitialize)(this.sccRoles)).BeginInit(); this.sccRoles.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cgcRole)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsRole)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvRole)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cgcUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsRoleUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.riccbeUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sccUsers)).BeginInit(); this.sccUsers.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cgcAllUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsUser)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvAllUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pmUsers)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bm)).BeginInit(); this.SuspendLayout(); // // sccRoles // this.sccRoles.Dock = System.Windows.Forms.DockStyle.Fill; this.sccRoles.Horizontal = false; this.sccRoles.Location = new System.Drawing.Point(0, 0); this.sccRoles.Name = "sccRoles"; this.sccRoles.Panel1.Controls.Add(this.cgcRole); this.sccRoles.Panel1.Text = "Panel1"; this.sccRoles.Panel2.Controls.Add(this.cgcUsers); this.sccRoles.Panel2.Text = "Panel2"; this.sccRoles.Size = new System.Drawing.Size(404, 681); this.sccRoles.SplitterPosition = 276; this.sccRoles.TabIndex = 2; this.sccRoles.Text = "sccRoles"; // // cgcRole // this.cgcRole.Cursor = System.Windows.Forms.Cursors.Default; this.cgcRole.DataSource = this.bsRole; this.cgcRole.Dock = System.Windows.Forms.DockStyle.Fill; this.cgcRole.Location = new System.Drawing.Point(0, 0); this.cgcRole.MainView = this.cgvRole; this.cgcRole.Name = "cgcRole"; this.cgcRole.Size = new System.Drawing.Size(404, 276); this.cgcRole.TabIndex = 3; this.cgcRole.UseEmbeddedNavigator = false; this.cgcRole.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.cgvRole}); // // bsRole // this.bsRole.DataSource = typeof(ServerInformation.Role); this.bsRole.CurrentChanged += new System.EventHandler(this.RoleCurrentChanged); // // cgvRole // this.cgvRole.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.colRoleName}); this.cgvRole.CustomPopupMenu = null; this.cgvRole.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; this.cgvRole.GridControl = this.cgcRole; this.cgvRole.Name = "cgvRole"; this.cgvRole.NewItemRowText = "Кликните здесь для добавления новой роли"; this.cgvRole.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused; this.cgvRole.OptionsCustomization.AllowQuickCustomisation = false; this.cgvRole.OptionsView.ShowDetailButtons = false; this.cgvRole.OptionsView.ShowGroupPanel = false; this.cgvRole.OptionsView.ShowViewCaption = true; this.cgvRole.ViewCaption = "Список ролей в системе"; this.cgvRole.DoBeforeDeleteRow += new CommonLibrary.GridControlFolder.CommonGridView.EventBeforeDelete(this.RoleBeforeDelete); this.cgvRole.DoCheckBeforeDrawIndicator += new System.EventHandler<CommonLibrary.UIFolder.GridControlFolder.EventRowHandlerArgs>(this.RoleDoCheckBeforeDrawIndicator); // // colRoleName // this.colRoleName.Caption = "Название роли"; this.colRoleName.FieldName = "Name"; this.colRoleName.Name = "colRoleName"; this.colRoleName.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways; this.colRoleName.Visible = true; this.colRoleName.VisibleIndex = 0; this.colRoleName.Width = 256; // // cgcUsers // this.cgcUsers.AllowDrop = true; this.cgcUsers.Cursor = System.Windows.Forms.Cursors.Default; this.cgcUsers.DataSource = this.bsRoleUsers; this.cgcUsers.Dock = System.Windows.Forms.DockStyle.Fill; this.cgcUsers.Location = new System.Drawing.Point(0, 0); this.cgcUsers.MainView = this.cgvUsers; this.cgcUsers.Name = "cgcUsers"; this.cgcUsers.RepositoryItems.AddRange(new DevExpress.XtraEditors.Repository.RepositoryItem[] { this.riccbeUsers}); this.cgcUsers.Size = new System.Drawing.Size(404, 400); this.cgcUsers.TabIndex = 2; this.cgcUsers.UseEmbeddedNavigator = false; this.cgcUsers.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.cgvUsers}); // // bsRoleUsers // this.bsRoleUsers.AllowNew = false; this.bsRoleUsers.DataSource = typeof(ServerInformation.User); // // cgvUsers // this.cgvUsers.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.colSurnameInitials}); this.cgvUsers.CustomPopupMenu = null; this.cgvUsers.FixedLineWidth = 1; this.cgvUsers.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; this.cgvUsers.GridControl = this.cgcUsers; this.cgvUsers.Name = "cgvUsers"; this.cgvUsers.NewItemRowText = "Кликните здесь для добавления пользователей к роли"; this.cgvUsers.OptionsCustomization.AllowAdd = false; this.cgvUsers.OptionsCustomization.AllowQuickCustomisation = false; this.cgvUsers.OptionsCustomization.AllowSelectionColumn = true; this.cgvUsers.OptionsSelection.CheckBoxSelectorColumnWidth = 25; this.cgvUsers.OptionsSelection.MultiSelect = true; this.cgvUsers.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect; this.cgvUsers.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Top; this.cgvUsers.OptionsView.ShowGroupPanel = false; this.cgvUsers.OptionsView.ShowViewCaption = true; this.cgvUsers.SortInfo.AddRange(new DevExpress.XtraGrid.Columns.GridColumnSortInfo[] { new DevExpress.XtraGrid.Columns.GridColumnSortInfo(this.colSurnameInitials, DevExpress.Data.ColumnSortOrder.Ascending)}); this.cgvUsers.ViewCaption = "Сотрудники, относящиеся к выбранной роли"; this.cgvUsers.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.UsersCustomRowCellEdit); this.cgvUsers.ShowingEditor += new System.ComponentModel.CancelEventHandler(this.UsersShowingEditor); // // colSurnameInitials // this.colSurnameInitials.Caption = "Сотрудник"; this.colSurnameInitials.FieldName = "SurnameInitials"; this.colSurnameInitials.Name = "colSurnameInitials"; this.colSurnameInitials.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways; this.colSurnameInitials.Visible = true; this.colSurnameInitials.VisibleIndex = 1; this.colSurnameInitials.Width = 193; // // riccbeUsers // this.riccbeUsers.AutoHeight = false; this.riccbeUsers.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); this.riccbeUsers.DisplayMember = "SurnameInitials"; this.riccbeUsers.Name = "riccbeUsers"; this.riccbeUsers.SelectAllItemCaption = "Выбрать всё"; this.riccbeUsers.ValueMember = "Id"; this.riccbeUsers.EditValueChanged += new System.EventHandler(this.UsersEditValueChanged); // // toolTip // this.toolTip.Rounded = true; this.toolTip.ShowBeak = true; // // sccUsers // this.sccUsers.Dock = System.Windows.Forms.DockStyle.Fill; this.sccUsers.Location = new System.Drawing.Point(0, 0); this.sccUsers.Name = "sccUsers"; this.sccUsers.Panel1.Controls.Add(this.sccRoles); this.sccUsers.Panel1.Text = "Panel1"; this.sccUsers.Panel2.Controls.Add(this.cgcAllUsers); this.sccUsers.Panel2.Text = "Panel2"; this.sccUsers.Size = new System.Drawing.Size(1086, 681); this.sccUsers.SplitterPosition = 404; this.sccUsers.TabIndex = 3; this.sccUsers.Text = "sccUsers"; // // cgcAllUsers // this.cgcAllUsers.AllowDrop = true; this.cgcAllUsers.Cursor = System.Windows.Forms.Cursors.Default; this.cgcAllUsers.DataSource = this.bsUser; this.cgcAllUsers.Dock = System.Windows.Forms.DockStyle.Fill; this.cgcAllUsers.Location = new System.Drawing.Point(0, 0); this.cgcAllUsers.MainView = this.cgvAllUsers; this.cgcAllUsers.Name = "cgcAllUsers"; this.cgcAllUsers.Size = new System.Drawing.Size(677, 681); this.cgcAllUsers.TabIndex = 5; this.cgcAllUsers.UseEmbeddedNavigator = false; this.cgcAllUsers.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.cgvAllUsers}); // // bsUser // this.bsUser.DataSource = typeof(ServerInformation.User); // // cgvAllUsers // this.cgvAllUsers.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { this.colUserId, this.colLastName, this.colFirstName, this.colMiddleName, this.colIsLocked}); this.cgvAllUsers.CustomPopupMenu = null; this.cgvAllUsers.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; this.cgvAllUsers.GridControl = this.cgcAllUsers; this.cgvAllUsers.Name = "cgvAllUsers"; this.cgvAllUsers.NewItemRowText = "Кликните здесь для добавления нового сотрудника"; this.cgvAllUsers.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDownFocused; this.cgvAllUsers.OptionsCustomization.AllowDelete = false; this.cgvAllUsers.OptionsCustomization.AllowQuickCustomisation = false; this.cgvAllUsers.OptionsDetail.EnableMasterViewMode = false; this.cgvAllUsers.OptionsView.ShowGroupPanel = false; this.cgvAllUsers.OptionsView.ShowViewCaption = true; this.cgvAllUsers.ViewCaption = "Список всех пользователей в системе"; this.cgvAllUsers.DoCheckBeforeDrawIndicator += new System.EventHandler<CommonLibrary.UIFolder.GridControlFolder.EventRowHandlerArgs>(this.CheckBeforeDrawImage); this.cgvAllUsers.PopupMenuShowing += new DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventHandler(this.UserPopupMenuShowing); this.cgvAllUsers.CellValueChanging += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.AllUsersCellValueChanging); this.cgvAllUsers.ValidateRow += new DevExpress.XtraGrid.Views.Base.ValidateRowEventHandler(this.AllUsersValidateRow); // // colUserId // this.colUserId.FieldName = "Id"; this.colUserId.Name = "colUserId"; this.colUserId.OptionsColumn.ReadOnly = true; // // colLastName // this.colLastName.Caption = "Фамилия"; this.colLastName.FieldName = "LastName"; this.colLastName.Name = "colLastName"; this.colLastName.Visible = true; this.colLastName.VisibleIndex = 0; // // colFirstName // this.colFirstName.Caption = "Имя"; this.colFirstName.FieldName = "FirstName"; this.colFirstName.Name = "colFirstName"; this.colFirstName.Visible = true; this.colFirstName.VisibleIndex = 1; // // colMiddleName // this.colMiddleName.Caption = "Отчество"; this.colMiddleName.FieldName = "MiddleName"; this.colMiddleName.Name = "colMiddleName"; this.colMiddleName.Visible = true; this.colMiddleName.VisibleIndex = 2; // // colIsLocked // this.colIsLocked.Caption = "Заблокирован"; this.colIsLocked.FieldName = "IsLocked"; this.colIsLocked.Name = "colIsLocked"; this.colIsLocked.Visible = true; this.colIsLocked.VisibleIndex = 3; // // pmUsers // this.pmUsers.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] { new DevExpress.XtraBars.LinkPersistInfo(this.bbiChangePassword), new DevExpress.XtraBars.LinkPersistInfo(this.bbiRemovePassword), new DevExpress.XtraBars.LinkPersistInfo(this.bbiLockUser), new DevExpress.XtraBars.LinkPersistInfo(this.bbiUnlock)}); this.pmUsers.Manager = this.bm; this.pmUsers.Name = "pmUsers"; this.pmUsers.BeforePopup += new System.ComponentModel.CancelEventHandler(this.UsersBeforePopup); // // bbiChangePassword // this.bbiChangePassword.Caption = "Изменить пароль"; this.bbiChangePassword.Glyph = ((System.Drawing.Image)(resources.GetObject("bbiChangePassword.Glyph"))); this.bbiChangePassword.Id = 4; this.bbiChangePassword.Name = "bbiChangePassword"; this.bbiChangePassword.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.NewPasswordUserClick); // // bbiRemovePassword // this.bbiRemovePassword.Caption = "Удалить пароль"; this.bbiRemovePassword.Glyph = ((System.Drawing.Image)(resources.GetObject("bbiRemovePassword.Glyph"))); this.bbiRemovePassword.Id = 3; this.bbiRemovePassword.Name = "bbiRemovePassword"; this.bbiRemovePassword.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.RemovePasswordUserClick); // // bbiLockUser // this.bbiLockUser.Caption = "Заблокировать сотрудника"; this.bbiLockUser.Glyph = ((System.Drawing.Image)(resources.GetObject("bbiLockUser.Glyph"))); this.bbiLockUser.Id = 5; this.bbiLockUser.Name = "bbiLockUser"; this.bbiLockUser.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.LockUserClick); // // bbiUnlock // this.bbiUnlock.Caption = "Разблокировать сотрудника"; this.bbiUnlock.Glyph = ((System.Drawing.Image)(resources.GetObject("bbiUnlock.Glyph"))); this.bbiUnlock.Id = 6; this.bbiUnlock.Name = "bbiUnlock"; this.bbiUnlock.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.UnlockUserClick); // // bm // this.bm.DockControls.Add(this.barDockControlTop); this.bm.DockControls.Add(this.barDockControlBottom); this.bm.DockControls.Add(this.barDockControlLeft); this.bm.DockControls.Add(this.barDockControlRight); this.bm.Form = this; this.bm.Items.AddRange(new DevExpress.XtraBars.BarItem[] { this.bbiRemovePassword, this.bbiChangePassword, this.bbiLockUser, this.bbiUnlock}); this.bm.MaxItemId = 9; // // barDockControlTop // this.barDockControlTop.CausesValidation = false; this.barDockControlTop.Dock = System.Windows.Forms.DockStyle.Top; this.barDockControlTop.Location = new System.Drawing.Point(0, 0); this.barDockControlTop.Size = new System.Drawing.Size(1086, 0); // // barDockControlBottom // this.barDockControlBottom.CausesValidation = false; this.barDockControlBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.barDockControlBottom.Location = new System.Drawing.Point(0, 681); this.barDockControlBottom.Size = new System.Drawing.Size(1086, 0); // // barDockControlLeft // this.barDockControlLeft.CausesValidation = false; this.barDockControlLeft.Dock = System.Windows.Forms.DockStyle.Left; this.barDockControlLeft.Location = new System.Drawing.Point(0, 0); this.barDockControlLeft.Size = new System.Drawing.Size(0, 681); // // barDockControlRight // this.barDockControlRight.CausesValidation = false; this.barDockControlRight.Dock = System.Windows.Forms.DockStyle.Right; this.barDockControlRight.Location = new System.Drawing.Point(1086, 0); this.barDockControlRight.Size = new System.Drawing.Size(0, 681); // // RolesChangeRibbonForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1086, 681); this.Controls.Add(this.sccUsers); this.Controls.Add(this.barDockControlLeft); this.Controls.Add(this.barDockControlRight); this.Controls.Add(this.barDockControlBottom); this.Controls.Add(this.barDockControlTop); this.Name = "RolesChangeRibbonForm"; this.ShowIcon = false; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Настройка ролей и сотрудников"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.RolesChangeRibbonFormLoad); this.Shown += new System.EventHandler(this.RolesChangeRibbonFormShown); ((System.ComponentModel.ISupportInitialize)(this.sccRoles)).EndInit(); this.sccRoles.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.cgcRole)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsRole)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvRole)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cgcUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsRoleUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.riccbeUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sccUsers)).EndInit(); this.sccUsers.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.cgcAllUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsUser)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cgvAllUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pmUsers)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bm)).EndInit(); this.ResumeLayout(false); }
public static BarButtonItem AddXemTatCa(BarManager barManager, Bar mainBar, BarButtonItem barButtonItemSearch,PopupControlContainer popUP,BarCheckItem filter, GridView gridViewMaster,RepositoryItemCheckedComboBoxEdit listChoseColumn, string filterString ) { int index = 0; for (int i = 0; i < mainBar.LinksPersistInfo.Count; i++) { LinkPersistInfo info =mainBar.LinksPersistInfo[i]; if (info.Item.Name == barButtonItemSearch.Name) { info.BeginGroup = false; index = i; break; } } BarButtonItem viewAll = new BarButtonItem(); viewAll.Caption = "Xem tất c&ả"; viewAll.PaintStyle = BarItemPaintStyle.CaptionGlyph; viewAll.Glyph = FrameworkParams.imageStore.GetImage2020("Picture.png"); viewAll.Visibility = BarItemVisibility.Always; viewAll.Appearance.ForeColor = Color.Red; Font bk = viewAll.Font; viewAll.Appearance.Font = new Font(bk, FontStyle.Bold); viewAll.Appearance.Options.UseFont = true; viewAll.Appearance.Options.UseForeColor = true; mainBar.LinksPersistInfo.Insert(index, new LinkPersistInfo(viewAll, true)); barManager.Items.Add(viewAll); viewAll.ItemClick += delegate(object sender, ItemClickEventArgs e) { try { if (listChoseColumn != null) { AppCtrl.DisplayTheoTuyBienCot(gridViewMaster, listChoseColumn); } QueryBuilder query = new QueryBuilder(filterString); foreach (string sort in BIEN_MUC.DEFAUT_SORT_ASC_FIELDS) { query.setAscOrderBy(sort); } DataSet ds = HelpDB.getDBService().LoadDataSet(query); if (ds != null && ds.Tables.Count > 0) gridViewMaster.GridControl.DataSource = ds.Tables[0]; else gridViewMaster.GridControl.DataSource = null; popUP.Visible = false; filter.Checked = false; foreach (Control ctrl in popUP.Controls) { if (ctrl is PLMultiCombobox) { PLMultiCombobox plm = ctrl as PLMultiCombobox; plm._setSelectedIDs(new long[] {-1}); } else if (ctrl is SpinEdit) { SpinEdit spin = ctrl as SpinEdit; spin.EditValue = null; } else if (ctrl is TextEdit) { TextEdit txt = ctrl as TextEdit; txt.Text = null; } else if (ctrl is DateEdit) { DateEdit date = ctrl as DateEdit; date.EditValue = null; } else if (ctrl is CheckedListBoxControl) { CheckedListBoxControl check = ctrl as CheckedListBoxControl; check.UnCheckAll(); } else if(ctrl is PLDateSelection) { PLDateSelection date = ctrl as PLDateSelection; if (date.AllowNull) date.SelectedType = SelectionTypes.None; } } } catch { } }; return viewAll; }
public static RepositoryItemCheckedComboBoxEdit InitCotMultiChoiceDirectly(GridColumn col, string tableName, string fieldName, string sortField) { const string valueField = "ID"; const string displayField = "NAME"; if (string.IsNullOrEmpty(sortField)) { sortField = displayField; } var rep = new RepositoryItemCheckedComboBoxEdit(); var ds = HelpDB.getDatabase().LoadDataSet( string.Format("select {0},{1} from {2} order by {3} ", valueField, displayField, tableName, sortField), tableName); if (ds == null || ds.Tables.Count == 0) return rep; if (true) { foreach (DataRow row in ds.Tables[0].Rows) { rep.Items.Add(row[valueField], row[displayField].ToString(), CheckState.Unchecked, false); } } else rep.DataSource = ds.Tables[0]; rep.ValueMember = valueField; rep.DisplayMember = displayField; rep.ShowButtons = false; rep.TextEditStyle = TextEditStyles.DisableTextEditor; rep.SelectAllItemVisible = false; col.ColumnEdit = rep; col.FieldName = fieldName; var grid = col.View as GridView; return rep; }
public override void applyRetrievedAttribute(IDataBindingSource src, FieldRetrievedEventArgs e) { RepositoryItemCheckedComboBoxEdit rle = e.RepositoryItem as RepositoryItemCheckedComboBoxEdit; setupRle(src, rle, e.FieldName); }