Beispiel #1
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;
     return(_dbFileVersionService.GetDevicesByLoopForControllerType8003(loop));
 }
Beispiel #2
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);
        }
Beispiel #3
0
 public bool AddDevice(Model.LoopModel loop)
 {
     try
     {
         List <DeviceInfo8003> lstDevices = loop.GetDevices <DeviceInfo8003>();
         foreach (var device in lstDevices)
         {
             device.Loop.ID = loop.ID;
             device.LoopID  = loop.ID;
             StringBuilder sbDeviceInfoSQL = new StringBuilder("REPLACE INTO DeviceInfo8003(");
             sbDeviceInfoSQL.Append("ID,");
             sbDeviceInfoSQL.Append("Code,");
             sbDeviceInfoSQL.Append("Disable,");
             sbDeviceInfoSQL.Append("Feature,");
             sbDeviceInfoSQL.Append("DelayValue,");
             sbDeviceInfoSQL.Append("SensitiveLevel,");
             sbDeviceInfoSQL.Append("LinkageGroup1,");
             sbDeviceInfoSQL.Append("LinkageGroup2,");
             sbDeviceInfoSQL.Append("LinkageGroup3,");
             sbDeviceInfoSQL.Append("sdpKey,");
             sbDeviceInfoSQL.Append("BroadcastZone,");
             sbDeviceInfoSQL.Append("ZoneNo,");
             sbDeviceInfoSQL.Append("Location,");
             sbDeviceInfoSQL.Append("LoopID,");
             sbDeviceInfoSQL.Append("TypeCode)");
             sbDeviceInfoSQL.Append(" VALUES(");
             sbDeviceInfoSQL.Append(device.ID + ",'");
             sbDeviceInfoSQL.Append(device.Code + "','");
             sbDeviceInfoSQL.Append(device.Disable + "','");
             sbDeviceInfoSQL.Append(device.Feature + "','");
             sbDeviceInfoSQL.Append(device.DelayValue + "','");
             sbDeviceInfoSQL.Append(device.SensitiveLevel + "','");
             sbDeviceInfoSQL.Append(device.LinkageGroup1 + "','");
             sbDeviceInfoSQL.Append(device.LinkageGroup2 + "','");
             sbDeviceInfoSQL.Append(device.LinkageGroup3 + "','");
             sbDeviceInfoSQL.Append(device.sdpKey + "','");
             sbDeviceInfoSQL.Append(device.BroadcastZone + "','");
             sbDeviceInfoSQL.Append(device.ZoneNo + "','");
             sbDeviceInfoSQL.Append(device.Location + "','");
             sbDeviceInfoSQL.Append(device.LoopID + "','");
             sbDeviceInfoSQL.Append(device.TypeCode + "');");
             _databaseService.ExecuteBySql(sbDeviceInfoSQL);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
Beispiel #4
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);
        }
Beispiel #5
0
 public bool AddDevice(Model.LoopModel loop)
 {
     try
     {
         List <DeviceInfo8053> lstDevices = loop.GetDevices <DeviceInfo8053>();
         foreach (var device in lstDevices)
         {
             device.Loop.ID = loop.ID;
             device.LoopID  = loop.ID;
             _dbFileVersionService.AddDeviceForControllerType8053(device);
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message, ex);
         return(false);
     }
     return(true);
 }
Beispiel #6
0
        public List <Model.LoopModel> GetLoopsByController(Model.ControllerModel controller)
        {
            List <LoopModel> lstLoops   = new List <LoopModel>();
            StringBuilder    sbQuerySQL = new StringBuilder("select ID,Code,Name,DeviceAmount from Loop where controllerID=" + controller.ID);

            System.Data.DataTable dt = _databaseService.GetDataTableBySQL(sbQuerySQL);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Model.LoopModel model = new Model.LoopModel();
                model.ID           = Convert.ToInt16(dt.Rows[i]["id"]);
                model.Code         = dt.Rows[i]["Code"].ToString();
                model.Name         = dt.Rows[i]["Name"].ToString();
                model.DeviceAmount = Convert.ToInt16(dt.Rows[i]["DeviceAmount"]);
                model.Controller   = controller;
                model.ControllerID = controller.ID;
                lstLoops.Add(model);
            }
            return(lstLoops);
        }
Beispiel #7
0
 public bool AddLoopInfo(Model.LoopModel loop)
 {
     try
     {
         StringBuilder sbLoopSQL;
         //此处未显示加入ID,由SQLite自动生成
         sbLoopSQL = new StringBuilder("Replace into Loop(ID,Code,Name,DeviceAmount,controllerID) values(");
         sbLoopSQL.Append(loop.ID + ",'");
         sbLoopSQL.Append(loop.Code + "','");
         sbLoopSQL.Append(loop.Name + "',");
         sbLoopSQL.Append(loop.DeviceAmount + ",");
         sbLoopSQL.Append(loop.ControllerID + ");");
         _databaseService.ExecuteBySql(sbLoopSQL);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Beispiel #8
0
 protected override void SetDownloadedDeviceInfoTotalAmountInCurrentLoop(Model.LoopModel loopModel)
 {
     DownloadedDeviceInfoTotalAmountInCurrentLoop = loopModel.GetDevices <DeviceInfo8021>().Count; //设置当前回路的器件总数2017-04-06
 }
Beispiel #9
0
 protected override bool ExistSameDeviceCode(Model.LoopModel loop)
 {
     throw new NotImplementedException();
 }
Beispiel #10
0
 public List <Model.LoopModel> CopyLoopInfo(Model.LoopModel loop)
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 public bool AddDeviceForControllerType8003(Model.LoopModel loop)
 {
     throw new System.NotImplementedException();
 }
Beispiel #12
0
 public int UpdateLoopInfo(Model.LoopModel loop)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 public Model.LoopModel GetLoopInfo(Model.LoopModel loop)
 {
     throw new NotImplementedException();
 }
Beispiel #14
0
 public bool AddDevice(Model.LoopModel loop)
 {
     try
     {
         List <DeviceInfo8001> lstDevices = loop.GetDevices <DeviceInfo8001>();
         foreach (var device in lstDevices)
         {
             device.Loop.ID = loop.ID;
             device.LoopID  = loop.ID;
             //StringBuilder sbDeviceInfoSQL = new StringBuilder("REPLACE INTO DeviceInfo8001(");
             //sbDeviceInfoSQL.Append("ID,");
             //sbDeviceInfoSQL.Append("Code,");
             //sbDeviceInfoSQL.Append("Disable,");
             //sbDeviceInfoSQL.Append("Feature,");
             //sbDeviceInfoSQL.Append("DelayValue,");
             //sbDeviceInfoSQL.Append("SensitiveLevel,");
             //sbDeviceInfoSQL.Append("BoardNo,");
             //sbDeviceInfoSQL.Append("SubBoardNo,");
             //sbDeviceInfoSQL.Append("KeyNo,");
             //sbDeviceInfoSQL.Append("BroadcastZone,");
             //sbDeviceInfoSQL.Append("LinkageGroup1,");
             //sbDeviceInfoSQL.Append("LinkageGroup2,");
             //sbDeviceInfoSQL.Append("LinkageGroup3,");
             //sbDeviceInfoSQL.Append("BuildingNo,");
             //sbDeviceInfoSQL.Append("ZoneNo,");
             //sbDeviceInfoSQL.Append("FloorNo,");
             //sbDeviceInfoSQL.Append("RoomNo,");
             //sbDeviceInfoSQL.Append("Location,");
             //sbDeviceInfoSQL.Append("SDPKey,");
             //sbDeviceInfoSQL.Append("MCBID,");
             //sbDeviceInfoSQL.Append("LoopID,");
             //sbDeviceInfoSQL.Append("TypeCode) ");
             //sbDeviceInfoSQL.Append(" VALUES(");
             //sbDeviceInfoSQL.Append(device.ID + ",'");
             //sbDeviceInfoSQL.Append(device.Code + "','");
             //sbDeviceInfoSQL.Append(device.Disable + "','");
             //sbDeviceInfoSQL.Append(device.Feature + "','");
             //sbDeviceInfoSQL.Append(device.DelayValue + "','");
             //sbDeviceInfoSQL.Append(device.SensitiveLevel + "','");
             //sbDeviceInfoSQL.Append(device.BoardNo + "','");
             //sbDeviceInfoSQL.Append(device.SubBoardNo + "','");
             //sbDeviceInfoSQL.Append(device.KeyNo + "','");
             //sbDeviceInfoSQL.Append(device.BroadcastZone + "','");
             //sbDeviceInfoSQL.Append(device.LinkageGroup1 + "','");
             //sbDeviceInfoSQL.Append(device.LinkageGroup2 + "','");
             //sbDeviceInfoSQL.Append(device.LinkageGroup3 + "','");
             //sbDeviceInfoSQL.Append(device.BuildingNo + "','");
             //sbDeviceInfoSQL.Append(device.ZoneNo + "','");
             //sbDeviceInfoSQL.Append(device.FloorNo + "','");
             //sbDeviceInfoSQL.Append(device.RoomNo + "','");
             //sbDeviceInfoSQL.Append(device.Location + "','");
             //sbDeviceInfoSQL.Append(device.sdpKey + "','");
             //sbDeviceInfoSQL.Append(device.MCBID + "','");
             //sbDeviceInfoSQL.Append(device.LoopID + "','");
             //sbDeviceInfoSQL.Append(device.TypeCode + "');");
             //_databaseService.ExecuteBySql(sbDeviceInfoSQL);
             _dbFileVersionService.AddDeviceForControllerType8001(device);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }