/// <summary>
 /// Creates a new device on the Device table in the DB
 /// If the Device ID is null or an empty string the device is new and we can attempt to create a new device, otherwise it is not new and we should pass
 /// </summary>
 /// <param name="D_Name"></param>
 /// <param name="Imei"></param>
 /// <param name="SerialNumber"></param>
 /// <returns>The number of items added to the tatabase or if return value -1 indicates that the devices can not be created
 /// or that an error in the insert happend</returns>
 public int CreateNewDevice(string D_Name, string Imei, string SerialNumber)
 {
     if (IsNew)
     {
         if (string.IsNullOrEmpty(D_Name))
         {
             return(-1);
         }
         else
         {
             IsNew = false;
             Data_Broker DB = new Data_Broker();
             return(DB.InsertNewDevice(D_Name, Imei, SerialNumber));
         }
     }
     else
     {
         return(-1);
     }
 }
        /// <summary>
        /// We list the ID's of all the devices in the DataBase that are signaled as Status TESTING
        /// </summary>
        /// <returns>An Array of ID's in String</returns>
        public string[] TestingDeviceIDList()
        {
            var DB = new Data_Broker();

            return(DB.ListDeviceByState(8));
        }
        /// <summary>
        /// We list the ID's of all the devices in the DataBase that are signaled as Status IN MAINTENANCE
        /// </summary>
        /// <returns>An Array of ID's in String</returns>
        public string[] MaintenanceDeviceIDList()
        {
            var DB = new Data_Broker();

            return(DB.ListDeviceByState(7));
        }
        /// <summary>
        /// We list the ID's of all the devices in the DataBase that are signaled as Status IN THE FIELD
        /// </summary>
        /// <returns>An Array of ID's in String</returns>
        public string[] InFieldDeviceIDList()
        {
            var DB = new Data_Broker();

            return(DB.ListDeviceByState(6));
        }
        /// <summary>
        /// We list the ID's of all the devices in the DataBase that are signaled as Status OPERATIONAL
        /// </summary>
        /// <returns>An Array of ID's in String</returns>
        public string[] OperationalDeviceIDList()
        {
            var DB = new Data_Broker();

            return(DB.ListDeviceByState(4));
        }
        /// <summary>
        /// We list the ID's of all the devices in the DataBase that are signaled as Status DEPRECIATED
        /// </summary>
        /// <returns>An Array of ID's in String</returns>
        public string[] DepreciatedIDDeviceList()
        {
            var DB = new Data_Broker();

            return(DB.ListDeviceByState(5));
        }
        /// <summary>
        /// Adds a new device to the database (this is a striped down device that can not be used until added to Octave)
        /// New devices are only added when provisioning
        /// </summary>
        /// <param name="DeviceName">The name of the device on the Octave platform. NOTE this name can not be changed in OCTAVE once it has been set</param>
        /// <param name="Imei">The IMEI number of the device</param>
        /// <param name="SerialNumber">The Sierrawireless Serial number</param>
        /// <returns></returns>
        public int AddNewOctaveDevice(string DeviceName, string Imei, string SerialNumber)
        {
            Data_Broker DB = new Data_Broker();

            return(DB.InsertNewDevice(DeviceName, Imei, SerialNumber));
        }