| | |
| | | using DevExpress.XtraRichEdit.API.Native; |
| | | |
| | | namespace HStation.WinFrmUI.Xhs |
| | | namespace HStation.WinFrmUI.Xhs |
| | | { |
| | | public partial class PumpMainChoicePage : DevExpress.XtraEditors.XtraUserControl, IWizardPage<PumpMainChoiceViewModel> |
| | | { |
| | | public PumpMainChoicePage() |
| | | { |
| | | InitializeComponent(); |
| | | this.gridView1.SetNormalView(30); |
| | | this.gridView1.OptionsView.ShowDetailButtons = true; |
| | | this.gridView1.OptionsView.ShowGroupPanel = false; |
| | | } |
| | | |
| | | private BLL.PumpSeries _seriesBll = null; |
| | |
| | | |
| | | private BLL.PumpGroupAndMainMap _groupMapBll = null; |
| | | |
| | | private List<PumpMainChoieViewModel> _allBindingList = null; |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | | /// </summary> |
| | | public async void InitialPage(PumpMainChoiceViewModel t) |
| | | { |
| | | _seriesBll = new BLL.PumpSeries(); |
| | | _groupBll = new BLL.PumpGroup(); |
| | | _pumpBll = new BLL.PumpMain(); |
| | | _groupMapBll = new BLL.PumpGroupAndMainMap(); |
| | | /* _seriesBll = new BLL.PumpSeries(); |
| | | _groupBll = new BLL.PumpGroup(); |
| | | _pumpBll = new BLL.PumpMain(); |
| | | _groupMapBll = new BLL.PumpGroupAndMainMap();*/ |
| | | var list = new List<HydroPumpViewModel>(); |
| | | list.Add(new HydroPumpViewModel { ID = 1, Name = "父", testChildrens = new List<TestChildren> { new TestChildren { Id = 2, Name = "子" } } }); |
| | | this.hydroPumpViewModelBindingSource.DataSource = list; |
| | | PageStateChangedEvent.Invoke(); |
| | | } |
| | | |
| | |
| | | public bool CanPrev() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | private List<PumpMainChoieViewModel> _allBindingList = null; |
| | | |
| | | //根据泵型号模糊查询(树显示) |
| | | private async void simpleLabelSearch_Click(object sender, EventArgs e) |
| | | { |
| | | TextPopupPumpChoice.Properties.PopupControl = popupContainerControl1; |
| | | _allBindingList = new List<PumpMainChoieViewModel>(); |
| | | var allSeries = await _seriesBll.GetAll(); |
| | | var allGroup = await _groupBll.GetAll(); |
| | | var allPumpMain = await _pumpBll.GetAll(); |
| | | var allGroupMap = await _groupMapBll.GetAll(); |
| | | if (TextPopupPumpChoice.EditValue == null) |
| | | { |
| | | return; |
| | | } |
| | | //泵型号 |
| | | foreach (var item in allPumpMain) |
| | | { |
| | | if (item.Name.Contains(this.TextPopupPumpChoice.Text.Trim())) |
| | | { |
| | | var groupMap = allGroupMap.Find(x => x.PumpMainID == item.ID); |
| | | if (groupMap != null) |
| | | { |
| | | var group = allGroup.Find(x => x.ID == groupMap.PumpGroupID); |
| | | if (group != null) |
| | | { |
| | | var series = allSeries.Find(x => x.ID == group.PumpSeriesID); |
| | | if (series != null) |
| | | { |
| | | if (_allBindingList.Find(x => x.ID == series.ID) == null) |
| | | { |
| | | _allBindingList.Add(new PumpMainChoieViewModel(series)); |
| | | } |
| | | if (_allBindingList.Find(x => x.ID == group.ID) == null) |
| | | { |
| | | _allBindingList.Add(new PumpMainChoieViewModel(item, group.ID)); |
| | | } |
| | | _allBindingList.Add(new PumpMainChoieViewModel(group)); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var series = allSeries.Find(x => x.ID == item.PumpSeriesID); |
| | | if (series != null) |
| | | { |
| | | if (_allBindingList.Find(x => x.ID == series.ID) == null) |
| | | { |
| | | _allBindingList.Add(new PumpMainChoieViewModel(series)); |
| | | } |
| | | _allBindingList.Add(new PumpMainChoieViewModel(item)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.treeList1.DataSource = _allBindingList; |
| | | TextPopupPumpChoice.ShowPopup(); |
| | | } |
| | | |
| | | //模糊查询(表格显示) |
| | | private async void simpleLabelItemVagueSearch_Click(object sender, EventArgs e) |
| | | { |
| | | if (TextPopupPumpChoice.EditValue == null) |
| | | { |
| | | return; |
| | | } |
| | | _allBindingList = new List<PumpMainChoieViewModel>(); |
| | | TextPopupPumpChoice.Properties.PopupControl = popupContainerControl2; |
| | | var allPumpMain = await _pumpBll.GetAll(); |
| | | foreach (var Main in allPumpMain) |
| | | { |
| | | if (Main.Name.Contains(TextPopupPumpChoice.Text)) |
| | | { |
| | | _allBindingList.Add(new PumpMainChoieViewModel(Main)); |
| | | } |
| | | } |
| | | this.gridControl1.DataSource = _allBindingList; |
| | | TextPopupPumpChoice.Size = new Size(500, 300); |
| | | TextPopupPumpChoice.ShowPopup(); |
| | | } |
| | | |
| | | //选择项变换 |
| | | private async void treeList1_SelectionChanged(object sender, EventArgs e) |
| | | { |
| | | var vm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | | if (!vm.IsPump) |
| | | { |
| | | return; |
| | | } |
| | | var model = await _pumpBll.GetByID(vm.ID); |
| | | if (model == null) |
| | | return; |
| | | |
| | | pumpMainForm1.SetBindingData(model); |
| | | } |
| | | //treeList1.CloseEditForm(); |
| | | } |
| | | |
| | | private void BtnAddPumpMain_Click(object sender, EventArgs e) |