public void KhoHangHoa() { FilterCase obj = new FilterCase(1, "1", "", new string[] { "MA_HANG", "TEN_HANG", "TEN_NHOM", "MA_PHIEU", "NGAY_PHAT_SINH", "NGUOI_PHAT_SINH", "DOI_TAC" }, new string[] { "Mã hàng hóa", "Tên hàng hóa", "Tên nhóm hàng", "Số phiếu", "Ngày phát sinh", "Người phát sinh", "Đối tác" }, "select * from F_HH1"); PLFilter frm = new PLFilter(obj); ProtocolForm.ShowModalDialog(FrameworkParams.MainForm, frm); }
public static BarButtonItem addSaveQueryDialog(XtraForm form, BarManager barManager, PopupMenu menu, GridControl gridControl, string dataSetID, string masterQueryNoCondition, params ProtocolVN.Framework.Win.SaveQueryDialog.HookAfterExecAdvQuery[] hooks) { BarButtonItem advancedSearch = HelpControl.addBarButtonItem(barManager, menu, "Tìm kiếm nâng cao"); advancedSearch.Glyph = FWImageDic.FIND_IMAGE20; advancedSearch.ItemClick += delegate(object sender, ItemClickEventArgs e) { FilterCase obj = new FilterCase(FrameworkParams.currentUser.id, dataSetID, "Truy vấn mới", masterQueryNoCondition); SaveQueryDialog q = new SaveQueryDialog(obj, gridControl); if (hooks != null && hooks.Length == 1) { q.hook = hooks[0]; } q.Owner = form; q.Show(); }; return advancedSearch; }
public SaveQueryDialog(FilterCase _objFilter, GridControl gridControlQL) { InitializeComponent(); this.ObjFilter = _objFilter; this.splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1; if (gridControlQL.DataSource == null) { //String query = _objFilter.QUERYSOURCE; //if (!query.EndsWith("1=1")) // query = query + " where 1=-1"; //else // query = query + " and 1=-1"; string query = "select * from (" + _objFilter.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlQL.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } this.gridControlQL = gridControlQL; filterControl1.SourceControl = gridControlQL; filterControl1.MenuManager = gridControlQL.MenuManager; InitOptions(); FilterControlHelp.InitCombobox(cbbSqlFilter1, ObjFilter); }
public PLFilter(FilterCase _objFilter) { this.ObjFilter = _objFilter; InitializeComponent(); filterControl1.MenuManager = gridControl1.MenuManager; InitOptions(); FilterControlHelp.InitCombobox(cbbSqlFilter1, ObjFilter); gridViewVN1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None; try { string query = ""; if (_objFilter.QUERYSOURCE.EndsWith("1=1")) { query = _objFilter.QUERYSOURCE + " and 1=-1"; } else { query = _objFilter.QUERYSOURCE + " where 1=-1"; } DataSet ds = DABase.getDatabase().LoadDataSet(query); gridControl1.DataSource = ds.Tables[0]; for (int i = 0; i < ObjFilter.FILEDS.Length; i++) { GridColumn column = gridViewVN1.Columns[ObjFilter.FILEDS[i]]; if(column!=null) column.Caption = ObjFilter.CAPTION[i]; } for (int j = 0; j < gridViewVN1.Columns.Count; j++) { if (ObjFilter.CheckFieldExist(gridViewVN1.Columns[j].FieldName) == false) gridViewVN1.Columns[j].Visible = false; } } catch (Exception ex) { PLException.AddException(ex); } }
void itemSaveFilter_Click(object sender, EventArgs e) { try { XtraForm f = (XtraForm)this.GridControl.FindForm(); if (f != null) { FilterCase obj = new FilterCase(FrameworkParams.currentUser.id, this._GetPLGUI(), "Truy vấn mới", this._fullQueryData); SaveQueryDialog q = new SaveQueryDialog(obj, this.GridControl); q.Owner = f; q.Show(); } } catch { } }
/// <summary>Step 3: Xác định các control trong filter part và Khởi tạo control trong phần filter. /// Các control trong phần filter này là những control chỉ chọn /// </summary> public override void PLLoadFilterPart() { barButtonItemDelete.Glyph = FWImageDic.REMOVE_IMAGE20; barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;//Xem trước filterControl1.SourceControl = gridControlMaster; filterControl1.MenuManager = gridControlMaster.MenuManager; //this.barCheckItemFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //this.popupControlContainerFilter.Visible = true; gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; filterCase = new FilterCase(FrameworkParams.currentUser.id, CHUONG_TRINH.TABLE_NAME, "Chương trình", UpdateRow()); filterControl1.SetDefaultColumn(filterControl1.FilterColumns[CHUONG_TRINH.TIET_MUC]); filterControl1.ShowDateTimeOperators = false; HelpGrid.SetReadOnlyHaveMemoCtrl(gridViewMaster, gridViewDetail, gridViewBienMuc); try { if (gridControlMaster.DataSource == null) { string query = "select * from (" + filterCase.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlMaster.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.NGAY_PHAT_DAU_TIEN]); filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.THOI_HAN_BAN_QUYEN_DISPLAY]); } catch { } }
/// <summary>Step 3: Xác định các control trong filter part và Khởi tạo control trong phần filter. /// Các control trong phần filter này là những control chỉ chọn /// </summary> public override void PLLoadFilterPart() { filterControl1.SourceControl = gridControlMaster; filterControl1.MenuManager = gridControlMaster.MenuManager; filterControl1.SetDefaultColumn(filterControl1.FilterColumns[CHUONG_TRINH.TIET_MUC]); filterCase = new FilterCase(FrameworkParams.currentUser.id, CHUONG_TRINH_POST_MASTER.TABLE_NAME, "Post/Master", UpdateRow()); filterControl1.ShowDateTimeOperators = false; AppCtrl.InitAutocompleteBienMucName(TenTap); AppCtrl.InitAutocompleteNoiDung(NoiDung); DMPostMaster.InitCtrl(PostMaster, true); DMTietMuc.InitCtrl(TietMuc, true); AppCtrl.InitCtrlNhanVien(NguoiNhap, true); AppCtrl.InitCtrlPhongBan(PhongBan, true); DMHardDisks.InitCtrl(SoDKCBHD, true); DMLoaiBang.InitCtrl(LoaiLuuTru, true); gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; ngayNhap.Default = ProtocolVN.Framework.Win.Trial.SelectionTypes.FromDateToDate; HelpControlExt.AutoSetTabIndex(this.popupControlContainerFilter.Controls); HelpGrid.SetReadOnlyHaveMemoCtrl(gridViewMaster, gridViewMaster, gridViewDetail); barSubItemInNhan.Enabled = false; barSubItemInNhan.PaintStyle = BarItemPaintStyle.CaptionGlyph; barSubItemInNhan.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanDID.png"); barButtonItemInBeatcamTrong.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanTrong.png"); barButtonItemInBeatacamNgoai.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanNgoai.png"); try { if (gridControlMaster.DataSource == null) { string query = "select * from (" + filterCase.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlMaster.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.NGAY_PHAT_DAU_TIEN]); filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.THOI_HAN_BAN_QUYEN_DISPLAY]); } catch { } }
/// <summary> /// Hiển thị hộp thoại truy vấn nâng cao và cho phép lưu câu truy vấn /// </summary> public static void showSaveQueryDialog(XtraForm form, String dataSetID, String masterQueryNoCondition, GridControl gridCtrl, bool isModal) { FilterCase obj = new FilterCase(FrameworkParams.currentUser.id, dataSetID, "Save Query Dialog", masterQueryNoCondition); SaveQueryDialog q = new SaveQueryDialog(obj, gridCtrl); XtraForm owner = (form == null ? FrameworkParams.MainForm : form); q.Owner = owner; if (isModal) { q.ShowDialog(); } else { q.Show(); } }
/// <summary>Step 3: Xác định các control trong filter part và Khởi tạo control trong phần filter. /// Các control trong phần filter này là những control chỉ chọn /// </summary> public override void PLLoadFilterPart() { filterControl1.SourceControl = gridControlMaster; filterControl1.MenuManager = gridControlMaster.MenuManager; gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; filterCase = new FilterCase(FrameworkParams.currentUser.id, BIEN_MUC.TABLE_NAME, "Biên mục", UpdateRow()); filterControl1.SetDefaultColumn(filterControl1.FilterColumns[BIEN_MUC.TIET_MUC]); //filterControl1.ShowDateTimeConstants = false; filterControl1.ShowDateTimeOperators = false; filterControl1.BeforeShowValueEditor += new ShowValueEditorEventHandler(filterControl1_BeforeShowValueEditor); try { if (gridControlMaster.DataSource == null) { string query = "select * from (" + filterCase.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlMaster.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.NGAY_PHAT_DAU_TIEN]); filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.THOI_HAN_BAN_QUYEN_DISPLAY]); } catch { } HelpGrid.SetReadOnlyHaveMemoCtrl(gridViewMaster); gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; ckcCotHienThi.ItemCheck += delegate(object sender, ItemCheckEventArgs e) { if (e.Index == 0)//chọn tất cả { if (e.State == System.Windows.Forms.CheckState.Checked) { ckcCotHienThi.CheckAll(); } else if (e.State == System.Windows.Forms.CheckState.Unchecked) { ckcCotHienThi.UnCheckAll(); } } else { int checkedCount = ckcCotHienThi.CheckedIndices.Count; if (e.State == System.Windows.Forms.CheckState.Checked) { if (checkedCount >= ckcCotHienThi.Items.Count - 1) ckcCotHienThi.Items[0].CheckState = System.Windows.Forms.CheckState.Checked; if (checkedCount > 0 && checkedCount < ckcCotHienThi.Items.Count - 1) ckcCotHienThi.Items[0].CheckState = System.Windows.Forms.CheckState.Indeterminate; } else if (e.State == System.Windows.Forms.CheckState.Unchecked) { if (checkedCount == 0) ckcCotHienThi.Items[0].CheckState = System.Windows.Forms.CheckState.Unchecked; if (checkedCount > 0 && checkedCount < ckcCotHienThi.Items.Count) ckcCotHienThi.Items[0].CheckState = System.Windows.Forms.CheckState.Indeterminate; } } }; if (gridViewMaster.Columns.Count > 0) ckcCotHienThi.Items.Add("CHON_TAT_CA", "(Chọn tất cả)"); List<BandedGridColumn> defaultCol = new List<BandedGridColumn> { timkiem.CotNoiDung,timkiem.CotTietMuc,timkiem.CotSoTap,timkiem.CotTongTap,timkiem.CotSoLanPhat,timkiem.CotPhatLanDau }; DataSet ds = new DataSet(); DataTable tbl = new DataTable("COT_HIEN_THI"); tbl.Columns.AddRange(new DataColumn[]{ new DataColumn("ID",typeof(Int64)), new DataColumn("NAME") }); ds.Tables.Add(tbl); for (int i = 0; i < gridViewMaster.Columns.Count;i++ ) { BandedGridColumn col = gridViewMaster.Columns[i]; System.Windows.Forms.CheckState state = System.Windows.Forms.CheckState.Unchecked; if (defaultCol.Contains(col)) { col.Visible = true; state = System.Windows.Forms.CheckState.Checked; } ckcCotHienThi.Items.Add(col, col.Caption, state, true); tbl.Rows.Add((Int64)i, col.Caption); } TruongCap1._init(ds.Copy().Tables[0], "NAME", "ID", "", "NAME", "Tên", TruongCap1.Width); TruongCap2._init(ds.Copy().Tables[0], "NAME", "ID", "", "NAME", "Tên", TruongCap1.Width); TruongCap3._init(ds.Copy().Tables[0], "NAME", "ID", "", "NAME", "Tên", TruongCap1.Width); gridControlMaster.EmbeddedNavigator.TextStringFormat = "Tổng số biên mục: {1}"; }
/// <summary>Step 3: Xác định các control trong filter part và Khởi tạo control trong phần filter. /// Các control trong phần filter này là những control chỉ chọn /// </summary> public override void PLLoadFilterPart() { barButtonItemDelete.Glyph = FWImageDic.REMOVE_IMAGE20; filterControl1.SourceControl = gridControlMaster; filterControl1.MenuManager = gridControlMaster.MenuManager; //this.barCheckItemFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; //this.popupControlContainerFilter.Visible = true; gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; filterCase = new FilterCase(FrameworkParams.currentUser.id, BIEN_MUC.TABLE_NAME, "Biên mục", UpdateRow()); filterControl1.SetDefaultColumn(filterControl1.FilterColumns[BIEN_MUC.TIET_MUC]); //filterControl1.ShowDateTimeConstants = false; filterControl1.ShowDateTimeOperators = false; filterControl1.ShowFilterControlMenu += new DevExpress.XtraEditors.Filtering.ShowFilterControlMenuEventHandler(filterControl1_ShowFilterControlMenu); filterControl1.BeforeShowValueEditor += new ShowValueEditorEventHandler(filterControl1_BeforeShowValueEditor); try { if (gridControlMaster.DataSource == null) { string query = "select * from (" + filterCase.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlMaster.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.NGAY_PHAT_DAU_TIEN]); filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.THOI_HAN_BAN_QUYEN_DISPLAY]); } catch { } comboKenhPhat = new RepositoryItemLookUpEdit(); comboKenhPhat.DataSource = HelpDB.getDBService().LoadDataSet( string.Format("SELECT * from {0}", DMDaiTruyenHinh.TABLE_MAP)).Tables[0]; comboKenhPhat.DisplayMember = "NAME"; comboKenhPhat.ValueMember = "ID"; }
/// <summary> /// Lấy danh sách tất cả các câu truy vấn đã lưu /// </summary> /// <param name="Input"></param> public static void InitCombobox(PLCombobox Input, FilterCase filter) { DataSet ds = new DataSet(); DatabaseFB db = DABase.getDatabase(); System.Data.Common.DbCommand cmd = db.GetSQLStringCommand("select * from FW_QUERY_STORE where USERID = @USERID and DATASETID = @DATASETID"); db.AddInParameter(cmd, "@USERID", DbType.Int64, filter.USERID); db.AddInParameter(cmd, "@DATASETID", DbType.String, filter.DATASETID); db.LoadDataSet(cmd, ds, "FW_QUERY_STORE"); if (ds.Tables.Count == 0 || (ds.Tables.Count == 1 && ds.Tables[0] == null)) PLException.AddException(new Exception("Thiếu bảng FW_QUERY_STORE")); //Tùy chọn nguồn dữ liệu Input.DataSource = ds.Tables[0]; //Giá trị hiển thị khi chọn Input.DisplayField = "TITLE"; //Giá trị nhận được khi lấy giá trị Input.ValueField = "ID"; Input._init(); }
/// <summary>Step 3: Xác định các control trong filter part và Khởi tạo control trong phần filter. /// Các control trong phần filter này là những control chỉ chọn /// </summary> public override void PLLoadFilterPart() { filterControl1.SourceControl = gridControlMaster; filterControl1.MenuManager = gridControlMaster.MenuManager; filterControl1.SetDefaultColumn(filterControl1.FilterColumns[CHUONG_TRINH.TIET_MUC]); filterCase = new FilterCase(FrameworkParams.currentUser.id, CHUONG_TRINH.TABLE_NAME, "Chương trình", UpdateRow()); filterControl1.ShowDateTimeOperators = false; barButtonItemDelete.Glyph = FWImageDic.REMOVE_IMAGE20; barButtonItem4.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;//Xem trước TimeslotTu.Properties.HourFormat = DevExpress.XtraEditors.Controls.HourFormat.Hour24; TimeslotDen.Properties.HourFormat = DevExpress.XtraEditors.Controls.HourFormat.Hour24; TimeslotTu.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; TimeslotDen.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; TimeslotDen.EditValue = null; TimeslotTu.EditValue = null; AppCtrl.InitAutocompleteNoiDung(NoiDung); AppCtrl.InitAutocompleteTenGoc(TenGoc); AppCtrl.InitAutocompleteCategory(Category); DMBanQuyenThuoc.InitCtrl(BanQuyenThuoc, true); DMNuocSanXuat.InitCtrl(QuocGia, true); DMTietMuc.InitCtrl(TietMuc, true); DMDonViCungCap.InitCtrl(DonViCungCap, true); AppCtrl.InitCtrlPhongBan(PhongBan, true); DMLoaiBang.InitCtrl(LoaiLuuTru, true); DMHardDisks.InitCtrl(SoDKCBHD, true); AppCtrl.InitAutocompleteBienMucName(TenTap); gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; ngayNhap.Default = ProtocolVN.Framework.Win.Trial.SelectionTypes.None; HelpControlExt.AutoSetTabIndex(this.popupControlContainerFilter.Controls); HelpGrid.SetReadOnlyHaveMemoCtrl(gridViewMaster, gridViewDetail, gridViewBienMuc); PhongBan._SelectedIDs = new long[] { FrameworkParams.LoginCompanyID}; splitContainerControl2.PanelVisibility = SplitPanelVisibility.Panel1; barSubItemInNhan.Enabled = false; barSubItemInNhan.PaintStyle = BarItemPaintStyle.CaptionGlyph; barSubItemInNhan.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanDID.png"); barButtonItemInBeatcamTrong.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanTrong.png"); barButtonItemInBeatacamNgoai.Glyph = FrameworkParams.imageStore.GetImage1616("btnInNhanNgoai.png"); //gridViewMaster.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; //splitContainerControl1.Panel1.LookAndFeel.UseDefaultLookAndFeel = false; //splitContainerControl1.Panel1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat; //splitContainerControl1.Panel1.Appearance.BorderColor = System.Drawing.Color.Red; //splitContainerControl1.Panel1.Appearance.Options.UseBorderColor = true; //splitContainerControl1.Panel1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple; //splitContainerControl2.Panel1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat; //splitContainerControl2.Panel1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat; try { if (gridControlMaster.DataSource == null) { string query = "select * from (" + filterCase.QUERYSOURCE + ") SAVE_QUERY where 1 = -1"; gridControlMaster.DataSource = HelpDB.getDatabase().LoadDataSet(query).Tables[0]; } filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.NGAY_PHAT_DAU_TIEN]); filterControl1.FilterColumns.Remove(filterControl1.FilterColumns[BIEN_MUC.THOI_HAN_BAN_QUYEN_DISPLAY]); } catch { } }