Esempio n. 1
0
        /// <summary>
        /// 初始化设施列表
        /// </summary>
        private void InitFacilityListView()
        {
            this.lstFacility.Items.Clear();
            List <Facility> facilityList = Facility.FindAll();

            foreach (var facility in facilityList)
            {
                var strings      = new string[] { facility.Name, facility.FarmName, facility.FacilityTypeName };
                var listViewItem = new ListViewItem(strings);
                listViewItem.Tag = facility;
                this.lstFacility.Items.Add(listViewItem);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 初始化设施列表
        /// </summary>
        private void InitFacilityListView()
        {
            this.listView1.Items.Clear();
            List <Facility> facilityList = Facility.FindAll();

            foreach (var fac in facilityList)
            {
                var strings = new[]
                {
                    fac.ID.ToString(), fac.Name, fac.Code1, fac.Code2, fac.Code3, fac.FacilityTypeName, fac.FarmName,
                         fac.ContactPhone, fac.CreateTime.ToString(CultureInfo.InvariantCulture),
                    fac.UpdateTime.ToString(CultureInfo.InvariantCulture), fac.Upload.ToString(),
                    fac.Version.ToString(), fac.Status.ToString(), fac.Address, fac.Introduce, fac.ContactMan,
                    fac.ContactMobile, fac.Remark, fac.PhotoUrl
                };
                var listViewItem = new ListViewItem(strings);
                listViewItem.Tag = fac;
                this.listView1.Items.Add(listViewItem);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 加载树结构
        /// </summary>
        private void InitTreeView()
        {
            this.treeView1.Nodes.Clear();

            // 获取所有的设施列表
            List <Facility> facilityList = Facility.FindAll();

            if (facilityList.Count > 0 && facilityList.Any())
            {
                var firstNode = new TreeNode(facilityList[0].FarmName)
                {
                    Tag = "FisrtPag"
                };
                this.treeView1.Nodes.Add(firstNode);

                foreach (var facility in facilityList)
                {
                    var allnode = new TreeNode(facility.Name)
                    {
                        ImageIndex = 0, Tag = facility
                    };

                    //采集设备
                    var collectnode = new TreeNode("采集设备")
                    {
                        ImageIndex = 1, Tag = "SensorDeviceUnit"
                    };
                    List <FacilitySensorDeviceUnit> sensorDeviceUnitList =
                        FacilitySensorDeviceUnit.FindAllByFacilityID(facility.ID);
                    if (sensorDeviceUnitList == null)
                    {
                        return;
                    }

                    foreach (var sensorDeviceUnit in sensorDeviceUnitList)
                    {
                        var treeNode =
                            new TreeNode(SensorDeviceUnit.FindByID(sensorDeviceUnit.SensorDeviceUnitID).Name.ToString());
                        treeNode.Tag = sensorDeviceUnit;
                        collectnode.Nodes.Add(treeNode);
                    }
                    allnode.Nodes.Add(collectnode);

                    //控制设备
                    var controlnode = new TreeNode("控制设备")
                    {
                        ImageIndex = 1, Tag = "ControlDeviceUnit"
                    };
                    List <FacilityControlDeviceUnit> controlDeviceUnitList =
                        FacilityControlDeviceUnit.FindAllByFacilityID(facility.ID);
                    if (controlDeviceUnitList == null)
                    {
                        return;
                    }
                    foreach (var controlDeviceUnit in controlDeviceUnitList)
                    {
                        var treeNode =
                            new TreeNode(
                                ControlDeviceUnit.FindByGroupNum(controlDeviceUnit.ControlDeviceUnitGroupNum)[0].Name
                                .ToString());
                        treeNode.Tag = controlDeviceUnit;
                        controlnode.Nodes.Add(treeNode);
                    }
                    allnode.Nodes.Add(controlnode);

                    ////摄像机设备
                    //var cameranode = new TreeNode("摄像机设备") { ImageIndex = 1, Tag = "facilityCamera" };
                    //List<FacilityCamera> cameraList = FacilityCamera.FindAllByFacilityID(facility.ID);
                    //if (cameraList == null)
                    //{
                    //    return;
                    //}

                    //foreach (FacilityCamera facilityCamera in cameraList)
                    //{
                    //    var treeNode = new TreeNode(facilityCamera.CameraName);
                    //    treeNode.Tag = facilityCamera;
                    //    cameranode.Nodes.Add(treeNode);
                    //}
                    //allnode.Nodes.Add(cameranode);

                    ////展示设备
                    //var showDevicenode = new TreeNode("显示设备") { ImageIndex = 1, Tag = "showDevice" };
                    //List<ShowDevice> showDeviceList = ShowDevice.FindAll();
                    //if (showDeviceList == null)
                    //{
                    //    return;
                    //}

                    //foreach (ShowDevice showDevice in showDeviceList)
                    //{
                    //    var treeNode = new TreeNode(showDevice.Name);
                    //    treeNode.Tag = showDevice;
                    //    showDevicenode.Nodes.Add(treeNode);
                    //}
                    //allnode.Nodes.Add(showDevicenode);
                    this.treeView1.Nodes.Add(allnode);
                }

                this.treeView1.ExpandAll();
            }
        }