Beispiel #1
0
        /// <summary>
        /// Updates the device status.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <param name="selectedDeviceID">The selected device identifier.</param>
        /// <param name="buttonState">if set to <c>true</c> [button state].</param>
        /// <returns></returns>
        /// <Author> Daniel Molina </Author>
        /// <LastModification>  29/11/2017 - 16:20 </LastModification>
        /// <LastModificationBy> Daniel Molina </LastModificationBy>
        public static RoomDeviceResponse UpdateDeviceStatus(int roomId, int selectedDeviceID, bool buttonState)
        {
            try
            {
                //Validate the Device Status
                List <GetDeviceByRoomIdAndDeviceID_Result> lstDeviceByRoomIdAndDeviceId = DeviceController.GetDeviceByRoomIdAndDeviceId(roomId, selectedDeviceID);
                List <DevicesDTOPartial> retVal = new List <DevicesDTOPartial>();
                foreach (GetDeviceByRoomIdAndDeviceID_Result reg in lstDeviceByRoomIdAndDeviceId)
                {
                    retVal.Add(new DevicesDTOPartial(reg));
                }

                //Validate that the device State
                if (retVal[0].State == buttonState)
                {
                    Logger.Logger.Info(profileName, "Method Response: The device has the same status. Username:"******"PasswordRetriesListByUtilityID", "Endpoint not found exception", ex);
                return(new RoomDeviceResponse {
                    Code = (int)ResponseCode.Exception, Message = ResponseCode.Exception.ToString() + ": " + ex.Message
                });
            }
        }