lixiaojun
2024-09-29 7447363976c9ac94791c687dedc302f9a3f77090
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using HStation.Vmo;
using System.Reflection;
 
namespace HStation.WinFrmUI
{
    public partial class XhsProjectSimulationInfoPage : DocumentPage
    {
        public XhsProjectSimulationInfoPage()
        {
            InitializeComponent();
            this.PageTitle.Caption = "项目概况";
            this.PageTitle.HeaderSvgImage = this.svgImg32[0];
        }
 
        private XhsProjectVmo _project = null;//项目
        private XhsProjectSiteVmo _projectSite = null;//项目站
        private Yw.Model.HydroModelInfo _hydroInfo = null;//水力信息
 
        /// <summary>
        /// 绑定数据
        /// </summary>
        public async Task SetBindingData
            (
                XhsProjectVmo project,
                XhsProjectSiteVmo projectSite,
                Yw.Model.HydroModelInfo hydroInfo
            )
        {
            if (project == null)
            {
                return;
            }
            _project = project;
            _projectSite = projectSite;
            _hydroInfo = hydroInfo;
            if (_projectSite == null)
            {
                _projectSite = await BLLFactory<HStation.BLL.XhsProjectSite>.Instance.GetDefaultByProjectID(_project.ID);
            }
            if (_hydroInfo == null)
            {
                var hydroRelation = await BLLFactory<Yw.BLL.HydroModelRelation>.Instance
                    .GetDefaultByObjectTypeAndObjectIDOfPurpose(HStation.Xhs.DataType.XhsProjectSite, _projectSite.ID, HStation.Xhs.Purpose.Simulation);
                _hydroInfo = await BLLFactory<Yw.BLL.HydroModelInfo>.Instance.GetByID(hydroRelation.ModelID);
            }
        }
 
 
        /// <summary>
        /// 初始化数据
        /// </summary>
        public override void InitialDataSource()
        {
            base.InitialDataSource();
            if (_project == null)
            {
                return;
            }
            this.PageTitle.Caption = $"{_project.Name}\r\n项目概况";
        }
 
        private async void widgetView1_QueryControl(object sender, DevExpress.XtraBars.Docking2010.Views.QueryControlEventArgs e)
        {
            switch (e.Document.Tag)
            {
                case "project-info":
                    {
                        var ctrl = new XhsProjectSimulationProjectInfoCtrl();
                        e.Control = ctrl;
                        ctrl.SetBindingData(_project);
                    }
                    break;
                case "bimface-info":
                    {
                        var ctrl = new XhsProjectSimulationBimfaceInfoCtrl();
                        e.Control = ctrl;
                        await ctrl.SetBindingData(_project, _projectSite);
                    }
                    break;
                case "parter-list-info":
                    {
                        var ctrl = new XhsProjectSimulationHydroInfoCtrl();
                        e.Control = ctrl;
                        await ctrl.SetBindingData(_project, _projectSite, _hydroInfo);
                    }
                    break;
                default: break;
            }
 
        }
    }
}