Exemple #1
0
 /// <summary>
 /// 更新门禁数据库信息
 /// </summary>
 /// <param name="backup"></param>
 /// <param name="database"></param>
 private static void UpgradeDoorAccessInfo(DbModel.Location.AreaAndDev.Dev_DoorAccess backup, DbModel.Location.AreaAndDev.Dev_DoorAccess database)
 {
     database.ParentId    = backup.ParentId;
     database.DoorId      = backup.DoorId;
     database.DevInfoId   = backup.DevInfoId;
     database.Local_DevID = backup.Local_DevID;
 }
Exemple #2
0
 /// <summary>
 /// 获取门禁信息
 /// </summary>
 /// <param name="camDev"></param>
 /// <param name="dev"></param>
 /// <returns></returns>
 private static DbModel.Location.AreaAndDev.Dev_DoorAccess GetDoorAccessInfo(DoorAccess doorAccessDev, DevInfo dev)
 {
     DbModel.Location.AreaAndDev.Dev_DoorAccess info = new DbModel.Location.AreaAndDev.Dev_DoorAccess();
     info.ParentId    = doorAccessDev.ParentId;
     info.DoorId      = doorAccessDev.DoorId;
     info.DevInfoId   = dev.Id;
     info.Local_DevID = dev.Local_DevID;
     return(info);
 }
        public Dev_DoorAccess Clone()
        {
            Dev_DoorAccess copy = new Dev_DoorAccess();

            copy = this.CloneObjectByBinary();
            if (this.DevInfo != null)
            {
                copy.DevInfo = this.DevInfo;
            }
            return(copy);
        }
Exemple #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());
     }
 }
Exemple #5
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());
     }
 }