Ejemplo n.º 1
0
 private void LoadAndUpShow()
 {
     //string strSql = "select ID,RoomName,IsSingle,WsdAddr1,WsdAddr2,FireAddr1,FireAddr2,RelayAddr,AirAddr,AirFactory,AirAddr2,AirFactory2,IsExistCsj,IsExistJrq,IsExistXf from tb_RoomInfo ";
     //gridControl1.DataSource = datalogic.GetDataTable(strSql);
     listRoomInfo            = TbRoominfo.FindAll("", "Id ASC", "", 0, 0);
     gridControl1.DataSource = listRoomInfo;
 }
Ejemplo n.º 2
0
        private void LoadRoomName()
        {
            //string strSql = "select RoomName from tb_RoomInfo ";
            //DataTable dt = datalogic.GetDataTable(strSql);
            IList <TbRoominfo> list = TbRoominfo.FindAll("", "ID ASC", "", 0, 0);

            this.cbbRoomName.SelectedIndexChanged -= new System.EventHandler(this.cbbRoomName_SelectedIndexChanged);
            try
            {
                if (list != null && list.Count > 0)
                {
                    cbbRoomName.DataSource    = list;
                    cbbRoomName.DisplayMember = "RoomName";
                    cbbRoomName.ValueMember   = "ID";
                }
                this.cbbRoomName.SelectedIndexChanged += new System.EventHandler(this.cbbRoomName_SelectedIndexChanged);
                if (cbbRoomName.Items.Count > 0)
                {
                    cbbRoomName.SelectedIndex = 0;
                    LoadRoomDeviceInfo(Convert.ToInt16(cbbRoomName.SelectedValue));
                }
                //foreach (DataRow dr in dt.Rows)
                //{
                //    string strName = dr["RoomName"].ToString();
                //    cbbRoomName.Items.Add(strName);
                //}
                //if (cbbRoomName.Items.Count > 0)
                //    cbbRoomName.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 加载房间设备 一个房间对应的温湿度、烟感、空调控制器地址等
        /// </summary>
        public void LoadRooms()
        {
            clsEnvirControl.listRoom.Clear();
            //string strSql = "select ID,RoomName,WsdAddr1,WsdAddr2,FireAddr1,FireAddr2,RelayAddr,AirAddr,AirFactory,AirAddr2,AirFactory2 from tb_RoomInfo ";
            //DataTable dtRoom = datalogic.GetDataTable(strSql);
            IList <TbRoominfo> list = TbRoominfo.FindAll("", "ID ASC", "", 0, 0);

            if (list != null && list.Count > 0)
            {
                foreach (TbRoominfo roominfo in list)
                {
                    try
                    {
                        int       iWsd1  = 0;
                        int       iWsd2  = 0;
                        int       iAir1  = 0;
                        int       iAir2  = 0;
                        int       iRelay = 0;
                        RoomClass room   = new RoomClass(roominfo.RoomName);
                        room.YGCount    = roominfo.YGCount;
                        room.WSDCount   = roominfo.WSDCount;
                        room.KTCount    = roominfo.KTCount;
                        room.IsExistCSJ = roominfo.IsExistCsj == DeviceUsing.启用.ToString() ? true : false;
                        room.IsExistJDQ = roominfo.IsExistRealy == DeviceUsing.启用.ToString() ? true : false;
                        room.IsExistJRQ = roominfo.IsExistJrq == DeviceUsing.启用.ToString() ? true : false;
                        room.IsExistXF  = roominfo.IsExistXf == DeviceUsing.启用.ToString() ? true : false;
                        //温湿度
                        if (!string.IsNullOrEmpty(roominfo.WsdAddr1))
                        {
                            iWsd1 = Convert.ToInt32(roominfo.WsdAddr1);
                        }
                        if (!string.IsNullOrEmpty(roominfo.WsdAddr2))
                        {
                            iWsd2 = Convert.ToInt32(roominfo.WsdAddr2);
                        }
                        if (roominfo.WSDCount > 0)
                        {
                            if (iWsd1 != 0)
                            {
                                clsWsd wsd = new clsWsd(iWsd1);
                                room.listWsd.Add(wsd);
                            }
                            if (iWsd2 != 0)
                            {
                                clsWsd wsd = new clsWsd(iWsd2);
                                room.listWsd.Add(wsd);
                            }
                        }

                        //烟感
                        if (!string.IsNullOrEmpty(roominfo.FireAddr1))
                        {
                            clsFire fire = new clsFire(roominfo.FireAddr1);
                            room.listFire.Add(fire);
                        }
                        if (!string.IsNullOrEmpty(roominfo.FireAddr2))
                        {
                            clsFire fire = new clsFire(roominfo.FireAddr2);
                            room.listFire.Add(fire);
                        }
                        //空调控制器
                        if (roominfo.KTCount >= 2)
                        {//2个空调
                            if (!string.IsNullOrEmpty(roominfo.AirAddr))
                            {
                                iAir1 = Convert.ToInt32(roominfo.AirAddr);
                            }
                            if (!string.IsNullOrEmpty(roominfo.AirAddr2))
                            {
                                iAir2 = Convert.ToInt32(roominfo.AirAddr2);
                            }
                            if (iAir1 != 0)
                            {
                                AirFactoryType airType = AirFactoryType.大金;
                                if (roominfo.AirFactory != "大金")
                                {
                                    airType = AirFactoryType.其他;
                                }
                                clsAir air = new clsAir(iAir1, airType);
                                room.listAir.Add(air);
                            }
                            if (iAir2 != 0)
                            {
                                AirFactoryType airType = AirFactoryType.大金;
                                if (roominfo.AirFactory2 != "大金")
                                {
                                    airType = AirFactoryType.其他;
                                }
                                clsAir air = new clsAir(iAir2, airType);
                                room.listAir.Add(air);
                            }
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(roominfo.AirAddr))
                            {
                                iAir1 = Convert.ToInt32(roominfo.AirAddr);
                            }
                            if (iAir1 != 0)
                            {
                                AirFactoryType airType = AirFactoryType.大金;
                                if (roominfo.AirFactory != "大金")
                                {
                                    airType = AirFactoryType.其他;
                                }
                                clsAir air = new clsAir(iAir1, airType);
                                room.listAir.Add(air);
                            }
                        }

                        //继电器板
                        if (!string.IsNullOrEmpty(roominfo.RelayAddr))
                        {
                            iRelay = Convert.ToInt32(roominfo.RelayAddr);
                        }
                        if (iRelay != 0)
                        {
                            room.roomRelay = new clsRelay(iRelay);
                        }
                        clsEnvirControl.listRoom.Add(room);
                    }
                    catch (Exception ex)
                    {
                        if (frmMain.blDebug)
                        {
                            MessageUtil.ShowTips(ex.Message);
                        }
                    }
                }
                RoomClass roomrelay = clsEnvirControl.listRoom.Find(p => p.roomRelay != null);
                foreach (RoomClass room in clsEnvirControl.listRoom)
                {
                    if (room.roomRelay == null)
                    {
                        room.roomRelay = roomrelay.roomRelay;
                    }
                }
            }
        }