Example #1
0
        public bool GetDevicesByLoopForControllerType8003(ref Model.LoopModel loop)
        {
            List <DeviceInfo8003> lstDeviceInfo8003 = new List <DeviceInfo8003>();

            string strDeviceQuerySQL = "select bianhao,leixing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,zjczbh,GbZone,didian from ";

            strDeviceQuerySQL += loop.Code;
            DataTable dtDevices          = _databaseService.GetDataTableBySQL(new StringBuilder(strDeviceQuerySQL));
            int       dtDevicesRowsCount = dtDevices.Rows.Count;

            for (int j = 0; j < dtDevicesRowsCount; j++) //器件信息
            {
                DeviceInfo8003 device = new DeviceInfo8003();
                device.Code = dtDevices.Rows[j]["bianhao"].ToString();
                Int16?intTypeCode = dtDevices.Rows[j]["leixing"].ToString().Substring(0, 3).ToNullable <Int16>();
                device.TypeCode       = (short)intTypeCode;
                device.Disable        = dtDevices.Rows[j]["geli"].ToString().ToNullable <bool>();
                device.SensitiveLevel = dtDevices.Rows[j]["lingmd"].ToString().ToNullable <Int16>();
                device.LinkageGroup1  = dtDevices.Rows[j]["shuchu1"].ToString();
                device.LinkageGroup2  = dtDevices.Rows[j]["shuchu2"].ToString();
                device.LinkageGroup3  = dtDevices.Rows[j]["shuchu3"].ToString();
                device.DelayValue     = dtDevices.Rows[j]["yanshi"].ToString().ToNullable <Int16>();
                device.sdpKey         = dtDevices.Rows[j]["xianggh"].ToString();
                device.ZoneNo         = dtDevices.Rows[j]["zjczbh"].ToString().ToNullable <Int16>();
                device.BroadcastZone  = dtDevices.Rows[j]["GbZone"].ToString();
                device.Location       = dtDevices.Rows[j]["didian"].ToString();
                device.Loop           = loop;
                loop.SetDevice <DeviceInfo8003>(device);
                lstDeviceInfo8003.Add(device);
            }
            return(true);
        }
Example #2
0
        public Model.LoopModel GetDevicesByLoop(Model.LoopModel loop)
        {
            StringBuilder sbQuerySQL = new StringBuilder("select ID,Code,Disable,Feature,DelayValue,SensitiveLevel,LinkageGroup1,LinkageGroup2,LinkageGroup3,sdpKey,BroadcastZone,ZoneNo,Location,LoopID,TypeCode from DeviceInfo8003 where LoopID=" + loop.ID);

            System.Data.DataTable dt = _databaseService.GetDataTableBySQL(sbQuerySQL);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Model.DeviceInfo8003 model = new Model.DeviceInfo8003();
                model.ID             = Convert.ToInt32(dt.Rows[i]["ID"]);
                model.Code           = dt.Rows[i]["Code"].ToString();
                model.Disable        = (bool?)dt.Rows[i]["Disable"];
                model.Feature        = new Nullable <short>(Convert.ToInt16(dt.Rows[i]["Feature"]));
                model.DelayValue     = new Nullable <short>(Convert.ToInt16(dt.Rows[i]["DelayValue"]));
                model.SensitiveLevel = new Nullable <short>(Convert.ToInt16(dt.Rows[i]["SensitiveLevel"]));
                model.LinkageGroup1  = dt.Rows[i]["LinkageGroup1"].ToString();
                model.LinkageGroup2  = dt.Rows[i]["LinkageGroup2"].ToString();
                model.LinkageGroup3  = dt.Rows[i]["LinkageGroup3"].ToString();
                model.sdpKey         = Convert.ToInt32(dt.Rows[i]["sdpKey"]);
                model.BroadcastZone  = dt.Rows[i]["BroadcastZone"].ToString();
                model.ZoneNo         = new Nullable <short>(Convert.ToInt16(dt.Rows[i]["ZoneNo"]));
                model.Location       = dt.Rows[i]["Location"].ToString();
                model.LoopID         = Convert.ToInt32(dt.Rows[i]["LoopID"]);
                model.TypeCode       = Convert.ToInt16(dt.Rows[i]["TypeCode"]);
                model.Loop           = loop;
                model.LoopID         = loop.ID;
                loop.SetDevice <DeviceInfo8003>(model);
            }
            return(loop);
        }
Example #3
0
        public bool GetDevicesByLoopForControllerType8001(ref Model.LoopModel loop, Dictionary <string, string> dictDeviceMappingManualControlBoard)
        {
            List <DeviceInfo8001> lstDeviceInfo8001 = new List <DeviceInfo8001>();

            string strDeviceQuerySQL = "select bianhao,leixing,geli,lingmd,shuchu1,shuchu2,shuchu3,yanshi,xianggh,panhao,jianhao,cleixing,GbZone,didian,louhao,quhao,cenghao,fangjianhao,sdpkey from ";

            strDeviceQuerySQL += loop.Code;
            DataTable dtDevices          = _databaseService.GetDataTableBySQL(new StringBuilder(strDeviceQuerySQL));
            int       dtDevicesRowsCount = dtDevices.Rows.Count;

            for (int j = 0; j < dtDevicesRowsCount; j++)     //器件信息
            {
                DeviceInfo8001 device = new DeviceInfo8001();
                device.Code           = dtDevices.Rows[j]["bianhao"].ToString();
                device.Disable        = dtDevices.Rows[j]["geli"].ToString().ToNullable <bool>();
                device.SensitiveLevel = dtDevices.Rows[j]["lingmd"].ToString().ToNullable <Int16>();
                device.LinkageGroup1  = dtDevices.Rows[j]["shuchu1"].ToString();
                device.LinkageGroup2  = dtDevices.Rows[j]["shuchu2"].ToString();
                device.LinkageGroup3  = dtDevices.Rows[j]["shuchu3"].ToString();
                device.DelayValue     = dtDevices.Rows[j]["yanshi"].ToString().ToNullable <Int16>();
                device.BoardNo        = dtDevices.Rows[j]["xianggh"].ToString().ToNullable <Int16>();
                device.SubBoardNo     = dtDevices.Rows[j]["panhao"].ToString().ToNullable <Int16>();
                device.KeyNo          = dtDevices.Rows[j]["jianhao"].ToString().ToNullable <Int16>();
                Int16?intTypeCode = dtDevices.Rows[j]["leixing"].ToString().Substring(0, 3).ToNullable <Int16>();
                device.TypeCode      = (short)intTypeCode;
                device.BroadcastZone = dtDevices.Rows[j]["GbZone"].ToString();
                device.Location      = dtDevices.Rows[j]["didian"].ToString();
                device.BuildingNo    = dtDevices.Rows[j]["louhao"].ToString().ToNullable <Int16>();
                device.ZoneNo        = dtDevices.Rows[j]["quhao"].ToString().ToNullable <Int16>();
                device.FloorNo       = dtDevices.Rows[j]["cenghao"].ToString().ToNullable <Int16>();
                device.RoomNo        = dtDevices.Rows[j]["fangjianhao"].ToString().ToNullable <Int16>();
                device.sdpKey        = dtDevices.Rows[j]["sdpkey"].ToString();
                device.Loop          = loop;
                if (dictDeviceMappingManualControlBoard != null)
                {
                    if (dictDeviceMappingManualControlBoard.ContainsKey(device.Code))    //如果存在网络手动盘的信息定义,则设置MCBCode的值,建立与手动盘的关系
                    {
                        device.MCBCode = dictDeviceMappingManualControlBoard[device.Code];
                    }
                }
                //if(lstDeviceInfo8001.Count>0)
                //{
                //    _deviceAddressLength = lstDeviceInfo8001[0].Code.Length;
                //}
                loop.SetDevice <DeviceInfo8001>(device);
                lstDeviceInfo8001.Add(device);
            }
            return(true);
        }