| | |
| | | using Yw.Model; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | | using DevExpress.XtraPrinting; |
| | | using Yw.Model; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | var name = this.txtName.Text.Trim(); |
| | | var code = this.txtCode.Text.Trim(); |
| | | var modelType = this.txtModelType.Text.Trim(); |
| | | _allBindingList = _allList; |
| | | |
| | | var name = this.txtName.Text.Trim(); |
| | | if (!string.IsNullOrEmpty(name)) |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.Contains(name)).ToList(); |
| | | } |
| | | var code = this.txtCode.Text.Trim(); |
| | | if (!string.IsNullOrEmpty(code)) |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => !string.IsNullOrEmpty(x.Code) && x.Code.Contains(code)).ToList(); |
| | | } |
| | | var modelType = this.txtModelType.Text.Trim(); |
| | | if (!string.IsNullOrEmpty(modelType)) |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => !string.IsNullOrEmpty(x.ModelType) && x.ModelType.Contains(modelType)).ToList(); |
| | | } |
| | | double? diameterMin = this.txtDiameterMin.EditValue == null ? null : double.Parse(this.txtDiameterMin.EditValue.ToString()); |
| | | if (diameterMin.HasValue) |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => x.Diameter >= diameterMin.Value).ToList(); |
| | | } |
| | | double? diameterMax = this.txtDiameterMax.EditValue == null ? null : double.Parse(this.txtDiameterMax.EditValue.ToString()); |
| | | if (diameterMax.HasValue) |
| | | { |
| | | _allBindingList = _allBindingList.Where(x => x.Diameter <= diameterMax.Value).ToList(); |
| | | } |
| | | this.hydroPipeViewModelBindingSource.DataSource = _allBindingList; |
| | | this.hydroPipeViewModelBindingSource.ResetBindings(false); |
| | |
| | | { |
| | | this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
| | | this.colDbLocked.Visible = false; |
| | | this.colBeginGroup.Visible = false; |
| | | this.colName.Visible = true; |
| | | this.colCode.Visible = true; |
| | | this.colModelType.Visible = true; |
| | |
| | | { |
| | | this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
| | | this.colDbLocked.Visible = true; |
| | | this.colBeginGroup.Visible = true; |
| | | this.colName.Visible = true; |
| | | this.colCode.Visible = true; |
| | | this.colModelType.Visible = true; |
| | |
| | | { |
| | | this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
| | | this.colDbLocked.Visible = true; |
| | | this.colBeginGroup.Visible = true; |
| | | this.colName.Visible = true; |
| | | this.colCode.Visible = true; |
| | | this.colModelType.Visible = true; |
| | |
| | | { |
| | | this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; |
| | | this.colDbLocked.Visible = true; |
| | | this.colBeginGroup.Visible = true; |
| | | this.colName.Visible = true; |
| | | this.colCode.Visible = true; |
| | | this.colModelType.Visible = true; |
| | |
| | | { |
| | | this.groupForHead.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; |
| | | this.colDbLocked.Visible = true; |
| | | this.colBeginGroup.Visible = true; |
| | | this.colName.Visible = true; |
| | | this.colCode.Visible = true; |
| | | this.colModelType.Visible = true; |
| | |
| | | this.colSet.Visible = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public GridView GetGridView() |
| | | { |
| | | return this.gridView1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void ExportToXlsx() |
| | | { |
| | | var filePath = FileDialogHelper.SaveFile("导出Excel文件", "Excel文件|*.xlsx"); |
| | | if (string.IsNullOrEmpty(filePath)) |
| | | { |
| | | return; |
| | | } |
| | | var options = new XlsxExportOptions |
| | | { |
| | | ExportMode = XlsxExportMode.SingleFile, // 导出模式 |
| | | ShowGridLines = true, // 显示网格线 |
| | | TextExportMode = TextExportMode.Value, // 导出文本模式 |
| | | SheetName = "管道" // 工作表名称 |
| | | }; |
| | | this.gridView1.ExportToXlsx(filePath, options); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |