| | |
| | | this.PageTitle.SvgImageSize = new Size(24, 24); |
| | | } |
| | | |
| | | private BLL.AdaptingManage _bll = null; |
| | | private BLL.PipeLineManage _bll = null; |
| | | |
| | | private List<PipeLineViewModel> _allBindingList = new List<PipeLineViewModel>(); |
| | | |
| | | //初始化数据 |
| | | public override async void InitialDataSource() |
| | | { |
| | | _bll = new BLL.AdaptingManage(); |
| | | var alllist = await _bll.GetByAdaptingType(Service.Assets.eAdaptingType.PipeLine); |
| | | _bll = new BLL.PipeLineManage(); |
| | | var alllist = await _bll.GetAll(); |
| | | foreach (var item in alllist) |
| | | { |
| | | var values = await new BLL.PipeLineRoughnessCoefficient().GetByPipeID(item.ID); |
| | | var names = CoefficientDisplayNameHelper.GetStringName(values); |
| | | _allBindingList.Add(new PipeLineViewModel(item, names.hazen, names.darcy, names.manning)); |
| | | _allBindingList.Add(new PipeLineViewModel(item)); |
| | | } |
| | | this.pipeLineViewModelBindingSource.DataSource = _allBindingList; |
| | | this.pipeLineViewModelBindingSource.ResetBindings(false); |
| | |
| | | private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new AddPipeLineMainDlg(); |
| | | dlg.SetBindingData(Service.Assets.eAdaptingType.PipeLine); |
| | | dlg.ReloadDataEvent += async (rhs, cofficientModel) => |
| | | dlg.SetBindingData(); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var id = await _bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | var bll = new BLL.PipeLineRoughnessCoefficient(); |
| | | var names = CoefficientDisplayNameHelper.GetStringName(cofficientModel); |
| | | cofficientModel.ForEach(x => x.PipeLineID = id); |
| | | if (await bll.Inserts(cofficientModel)) |
| | | { |
| | | _allBindingList.Add(new PipeLineViewModel(rhs, names.hazen, names.darcy, names.manning)); |
| | | this.pipeLineViewModelBindingSource.ResetBindings(false); |
| | | return true; |
| | | } |
| | | rhs.ID = id; |
| | | _allBindingList.Add(new PipeLineViewModel(await _bll.GetByID(id))); |
| | | this.pipeLineViewModelBindingSource.ResetBindings(false); |
| | | return true; |
| | | } |
| | | return false; |
| | | }; |
| | |
| | | return; |
| | | } |
| | | var dlg = new EditPipeLineMainDlg(); |
| | | var adapting = await _bll.GetByID(vm.ID); |
| | | if (adapting == null) |
| | | var PipeLine = await _bll.GetByID(vm.ID); |
| | | if (PipeLine == null) |
| | | return; |
| | | var cofficientList = await new BLL.PipeLineRoughnessCoefficient().GetByPipeID(vm.ID); |
| | | if (cofficientList == null) |
| | | return; |
| | | dlg.SetBindingData(adapting, cofficientList); |
| | | dlg.ReloadDataEvent += async (rhs, cofficientModel) => |
| | | dlg.SetBindingData(PipeLine); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | if (await _bll.Update(rhs)) |
| | | { |
| | | var names = CoefficientDisplayNameHelper.GetStringName(cofficientModel); |
| | | vm.Reset(rhs, names.hazen, names.darcy, names.manning); |
| | | vm.Reset(rhs); |
| | | this.pipeLineViewModelBindingSource.ResetBindings(false); |
| | | return true; |
| | | } |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //说明 |
| | | private void BtnDescription_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new DescriptionDlg(); |
| | | dlg.ShowDialog(); |
| | | } |
| | | } |
| | | } |