lixiaojun
2024-12-09 725f20b576bdd40d57d9a1e806ce3f6f39181a84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace HStation.WinFrmUI
{
    public partial class BluntheadSingleMatchingForm : DevExpress.XtraEditors.XtraUserControl
    {
        public BluntheadSingleMatchingForm()
        {
            InitializeComponent();
            this.gridView3.SetNormalView();
        }
 
        private HydroBluntheadMatchingViewModel _BluntheadMatchingViewModel;
        private BLL.AssetsBluntheadMain _BluntheadBll;
        private List<BluntheadSingleMatchingViewModel> _allBindingList;
 
        public async void SetBindingData(HydroBluntheadMatchingViewModel BluntheadMatchingViewModel)
        {
            _BluntheadMatchingViewModel = BluntheadMatchingViewModel;
            _allBindingList = new List<BluntheadSingleMatchingViewModel>();
            _BluntheadBll = new BLL.AssetsBluntheadMain();
            var allAssetsBluntheadMain = await _BluntheadBll.GetAll();
            foreach (var Main in allAssetsBluntheadMain)
            {
                _allBindingList.Add(new BluntheadSingleMatchingViewModel(Main));
            }
            this.BluntheadSingleMatchingViewModelBindingSource.DataSource = _allBindingList;
            this.BluntheadSingleMatchingViewModelBindingSource.ResetBindings(false);
            this.searchControl1.Text = _BluntheadMatchingViewModel.ModelType;
        }
 
        //选择项切换事件
        private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            var vm = this.gridView3.GetCurrentViewModel(_allBindingList);
            if (vm != null)
            {
                _BluntheadMatchingViewModel.MatchingDbId = vm.ID.ToString();
                _BluntheadMatchingViewModel.MatchingMinorLoss = vm.MinorLoss;
                _BluntheadMatchingViewModel.MatchingCaliber = vm.Caliber;
                _BluntheadMatchingViewModel.MatchingMaterial = vm.Material;
                _BluntheadMatchingViewModel.MatchingModelType = vm.ModelType;
            }
        }
    }
}