public int Insert(ref string errMessage, List <CameraInfo> listCam, DeviceInfo oDeviceInfo)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            int iDeviceId = 0;
            int iRtn      = 0;

            try
            {
                // using (TransactionScope transaction = new TransactionScope())
                //{
                iRtn      = DeviceDataAccess.Insert(db, oDeviceInfo);
                iDeviceId = DeviceDataAccess.GetMaxDeviceId(db);
                foreach (CameraInfo item in listCam)
                {
                    item.DeviceId = iDeviceId;
                    CameraDataAccess.Insert(db, item);
                }
                //  transaction.Complete();
                // }
                return(iRtn);
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(-1);
            }
        }
        public int Insert(ref string errMessage, DeviceInfo oDeviceInfo)
        {
            Database db = DatabaseFactory.CreateDatabase();

            errMessage = "";
            try
            {
                return(DeviceDataAccess.Insert(db, oDeviceInfo));
            }
            catch (Exception ex)
            {
                errMessage = ex.Message + ex.StackTrace;
                logger.Error("Error Message:" + ex.Message + " Trace:" + ex.StackTrace);
                return(-1);
            }
        }