示例#1
0
        /// <summary>
        /// 添加设备信息
        /// </summary>
        /// <param name="dev"></param>
        /// <param name="devBll"></param>
        private static bool AddDevInfo(DevInfoBackup dev, DevInfoBll devBll)
        {
            try
            {
                DevInfo devInfo = GetDevInfo(dev);
                DevPos  devPos  = GetDevPos(dev);
                devInfo.SetPos(devPos);
                //if (string.IsNullOrEmpty(devInfo.Local_DevID))
                //{

                //}
                DevInfo infoTemp = devBll.Find(i => i.Local_DevID == devInfo.Local_DevID);
                if (infoTemp == null)
                {
                    return(devBll.Add(devInfo));//新设备,加入
                }
                else
                {
                    UpgradeDevInfo(infoTemp, devInfo);//已经存在的设备,更新
                    bool value = devBll.Edit(infoTemp);
                    if (!value)
                    {
                        Log.Info("Error: EditDevinfo Error");
                    }
                    return(value);
                }
            }
            catch (Exception e)
            {
                Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
                return(false);
            }
        }
示例#2
0
 /// <summary>
 /// 添加摄像头信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddCameraInfo(CameraInfoBackup cameraDev, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = CameraToDevInfo(cameraDev);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         DevInfo infoTemp = bll.DevInfos.Find(i => i.Local_DevID == devInfo.Local_DevID);
         //Devinfo中,能通过Devid找到的就更新。找不到就新增
         if (infoTemp == null)
         {
             bll.DevInfos.Add(devInfo);
             Dev_CameraInfo cameraBackup = GetCameraInfo(cameraDev, devInfo);
             cameraBackup.RtspUrl = cameraDev.RtspURL;
             bll.Dev_CameraInfos.Add(cameraBackup);
         }
         else
         {
             UpgradeDevInfo(infoTemp, devInfo);
             bool value = bll.DevInfos.Edit(infoTemp);
             if (!value)
             {
                 Log.Info("Error: EditDevinfo Error");
             }
             Dev_CameraInfo cameraBackup = GetCameraInfo(cameraDev, infoTemp);
             if (!string.IsNullOrEmpty(cameraDev.RtspURL))
             {
                 cameraBackup.RtspUrl = cameraDev.RtspURL;
             }
             Dev_CameraInfo cameraDatabase = bll.Dev_CameraInfos.Find(cameraT => cameraT.Local_DevID == infoTemp.Local_DevID);
             if (cameraDatabase == null)
             {
                 bll.Dev_CameraInfos.Add(cameraBackup);
             }
             else
             {
                 UpgradeCameraInfo(cameraBackup, cameraDatabase);
                 bool valueT = bll.Dev_CameraInfos.Edit(cameraDatabase);
                 if (!valueT)
                 {
                     Log.Info("Error: EditDevinfo Error");
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
示例#3
0
 /// <summary>
 /// 添加设备信息
 /// </summary>
 /// <param name="dev"></param>
 /// <param name="devBll"></param>
 private static void AddDevInfo(DevInfoBackup dev, DevInfoBll devBll)
 {
     try
     {
         DevInfo devInfo = GetDevInfo(dev);
         DevPos  devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         devBll.Add(devInfo);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
示例#4
0
 /// <summary>
 /// 添加门禁信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddDoorAccessInfo(DoorAccess doorAccess, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = DoorAccessToDevInfo(doorAccess);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         bll.DevInfos.Add(devInfo);
         DbModel.Location.AreaAndDev.Dev_DoorAccess doorAccessDev = GetDoorAccessInfo(doorAccess, devInfo);
         bll.Dev_DoorAccess.Add(doorAccessDev);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
示例#5
0
 /// <summary>
 /// 添加摄像头信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddCameraInfo(CameraInfoBackup cameraDev, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = CameraToDevInfo(cameraDev);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         bll.DevInfos.Add(devInfo);
         Dev_CameraInfo camera = GetCameraInfo(cameraDev, devInfo);
         bll.Dev_CameraInfos.Add(camera);
     }
     catch (Exception e)
     {
         Console.WriteLine("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
示例#6
0
 /// <summary>
 /// 添加门禁信息
 /// </summary>
 /// <param name="cameraDev"></param>
 /// <param name="bll"></param>
 private static void AddDoorAccessInfo(DoorAccess doorAccess, Bll bll)
 {
     try
     {
         DevInfoBackup dev     = DoorAccessToDevInfo(doorAccess);
         DevInfo       devInfo = GetDevInfo(dev);
         DevPos        devPos  = GetDevPos(dev);
         devInfo.SetPos(devPos);
         DevInfo infoTemp = bll.DevInfos.Find(i => i.Local_DevID == devInfo.Local_DevID);
         if (infoTemp == null)
         {
             bll.DevInfos.Add(devInfo);
             DbModel.Location.AreaAndDev.Dev_DoorAccess doorAccessDev = GetDoorAccessInfo(doorAccess, devInfo);
             bll.Dev_DoorAccess.Add(doorAccessDev);
         }
         else
         {
             UpgradeDevInfo(infoTemp, devInfo);
             bool value = bll.DevInfos.Edit(infoTemp);
             if (!value)
             {
                 Log.Info("Error: EditDevinfo Error");
             }
             DbModel.Location.AreaAndDev.Dev_DoorAccess doorAccessBackup   = GetDoorAccessInfo(doorAccess, infoTemp);
             DbModel.Location.AreaAndDev.Dev_DoorAccess doorAccessDatabase = bll.Dev_DoorAccess.Find(door => door.Local_DevID == devInfo.Local_DevID);
             if (doorAccessDatabase == null)
             {
                 bll.Dev_DoorAccess.Add(doorAccessBackup);
             }
             else
             {
                 UpgradeDoorAccessInfo(doorAccessBackup, doorAccessDatabase);
                 bool valueT = bll.Dev_DoorAccess.Edit(doorAccessDatabase);
                 if (!valueT)
                 {
                     Log.Info("Error:Edit Dev_DoorAccess Error");
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.Info("Error in DevInfoHelper.AddDevInfo:" + e.ToString());
     }
 }
示例#7
0
 /// <summary>
 /// 添加基站设备
 /// </summary>
 /// <param name="devList">设备列表</param>
 /// <param name="devBlls">数据信息</param>
 /// <param name="areaId">设备所属区域ID</param>
 private static void AddLocationDev(List <LocationDevice> devList, ArchorBll archorBll, Area area)
 {
     for (int i = 0; i < devList.Count; i++)
     {
         var     locationDev = devList[i];
         DevInfo devInfo     = GetDevInfo(locationDev, area);
         DevPos  devPos      = GetDevPos(locationDev, devInfo.Local_DevID);
         Archor  archor      = GetAnchorInfo(locationDev, devInfo.Id);
         archor.ParentId = area.Id;
         if (string.IsNullOrEmpty(archor.Code) || archor.Code.Contains("Code"))
         {
             archor.Code = "Code_" + i;
         }
         devInfo.SetPos(devPos);
         archor.DevInfo = devInfo;
         archorBll.Add(archor);
         //devBlls.Add(devInfo);
     }
 }