コード例 #1
0
        /// <summary>
        ///method to remove userdevices
        /// </summary>
        /// <param name="UserID">takes userid as input</param>
        public void RemoveDevices(string UserID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserDeviceDAL userdevicedal = new UserDeviceDAL();
                //get all user devices to remove
                List <UserDeviceEntity> alluserdevices = userdevicedal.GetUserAllDevices(UserID);
                if (alluserdevices != null && alluserdevices.Count > 0)
                {
                    //calling data access layer method to remove
                    userdevicedal.RemoveDevices(alluserdevices);
                }
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while removing userdevices : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
コード例 #2
0
        /// <summary>
        /// method to delete single userdevice
        /// </summary>
        /// <param name="userID">takes userid as input</param>
        /// <param name="userDeviceID">takes user device id as input</param>
        /// <returns>returns deleted user backend entity</returns>
        public UserDeviceEntity DeleteUserDevice(string userID, string userDeviceID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserDeviceDAL userdevicedal = new UserDeviceDAL();
                //calling data access layer method
                UserDeviceEntity userdeviceentity = userdevicedal.DeleteUserDevice(userID, userDeviceID);
                return(userdeviceentity);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while deleting single userdevice : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
コード例 #3
0
        /// <summary>
        /// method to get single userdevice
        /// </summary>
        /// <param name="userID">takes userid as input</param>
        /// <param name="userDeviceID">takes user device id as input</param>
        /// <returns>returns user device with id associated to user in the form of personalization response</returns>
        public PersonalizationResponseDTO <UserDeviceDTO> GetUserDevice(string userID, string userDeviceID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserDeviceDAL    userdevicedal    = new UserDeviceDAL();
                UserDeviceEntity userdeviceentity = userdevicedal.GetUserDevice(userID, userDeviceID);
                //converting userdevice entity to Response data transfer object
                var ResponseUserDevice = new PersonalizationResponseDTO <UserDeviceDTO>();
                if (userdeviceentity != null)
                {
                    UserDeviceDTO userdevicedto = UserDeviceEntityDTOMapper(userdeviceentity);
                    ResponseUserDevice.result = userdevicedto;
                }
                else
                {
                    ResponseUserDevice.result = null;
                }
                return(ResponseUserDevice);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while retreiving single userdevice: "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
コード例 #4
0
        /// <summary>
        /// method to get userdevices
        /// </summary>
        /// <param name="UserID">takes userid as input</param>
        /// <returns>returns list of user device</returns>
        public IEnumerable <UserDeviceDTO> GetUserAllDevices(string UserID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserDeviceDAL userdevicedal = new UserDeviceDAL();
                //calling data access layer method
                List <UserDeviceEntity> alluserdevices     = userdevicedal.GetUserAllDevices(UserID);
                List <UserDeviceDTO>    userdevicesdtolist = new List <UserDeviceDTO>();
                //check for null
                if (alluserdevices != null && alluserdevices.Count > 0)
                {
                    //converting userdevice entity to userdevice dto
                    foreach (UserDeviceEntity userdeviceentity in alluserdevices)
                    {
                        userdevicesdtolist.Add(UserDeviceEntityDTOMapper(userdeviceentity));
                    }
                }
                else
                {
                    userdevicesdtolist = null;
                }


                return((IEnumerable <UserDeviceDTO>)userdevicesdtolist);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while retreiving userdevices : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
コード例 #5
0
        /// <summary>
        ///method to add userdevices
        /// </summary>
        /// <param name="deviceofuser">takes list of user devices as input</param>
        public void AddDevices(List <UserDeviceEntity> deviceofuser)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                UserDeviceDAL userdevicedal = new UserDeviceDAL();
                //calling data access layer method
                userdevicedal.AddDevices(deviceofuser);
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while adding userdevices : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }