コード例 #1
0
        /// <summary>
        /// method to check user availability
        /// </summary>
        /// <param name="UserID">takes userid as input</param>
        /// <returns>returns true if user exists else false</returns>
        public Boolean CheckUser(string UserID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                PersonalizationDAL personalizationdal = new PersonalizationDAL();
                //calling data access layer method
                UserEntity user = personalizationdal.GetUser(UserID);
                //if user exists return true
                if (user != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while checking user existance : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }
コード例 #2
0
        /// <summary>
        /// method to get user details
        /// </summary>
        /// <param name="UserID">takes user id as input</param>
        /// <returns> returns user along with associated devices and backends </returns>
        public UserDTO GetUser(string UserID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                PersonalizationDAL personalizationdal = new PersonalizationDAL();
                UserEntity         user = personalizationdal.GetUser(UserID);
                if (user != null)
                {
                    //converting userentity to user data transfer object
                    UserDTO userdto = DataProvider.ResponseObjectMapper <UserDTO, UserEntity>(user);
                    //getting devices and backends associated to that user
                    UserBackend userbackend = new UserBackend();
                    UserDevice  userdevice  = new UserDevice();
                    ///getting devices and backends associated to that user
                    IEnumerable <UserDeviceDTO>  userdevices  = userdevice.GetUserAllDevices(UserID);
                    IEnumerable <UserBackendDTO> userbackends = userbackend.GetUserAllBackends(UserID);
                    userdto.userbackends = userbackends;
                    userdto.userdevices  = userdevices;
                    return(userdto);
                }
                else
                {
                    return(null);
                }
            }
            catch (DataAccessException DALexception)
            {
                throw DALexception;
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                //LoggerHelper.WriteToLog(exception + " - Error in BL while retrieving user : "
                //+exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error);
                throw new BusinessLogicException();
            }
        }