Beispiel #1
0
        public IpPropertiesModal GetIpAddressDetails(string IpAddress)
        {
            if (IpAddress == "::1")
            {
                IpAddress = Faker.Internet.IPv4();
            }

            return(_IIPRequestDetails.GetCountryDetailsByIP(IpAddress));
        }
        public Task <WeatherModel> GetCurrectWeatherDetails(string userIpAddress)
        {
            IpPropertiesModal ipPropertiesModal = new IpPropertiesModal();
            WeatherModel      weatherModel      = new WeatherModel();

            ipPropertiesModal = _IIPRequestDetails.GetCountryDetailsByIP(userIpAddress);

            var getdashBoardRow1DetailsTask = Task.Run(() =>
                                                       _IWeatherForecast.GetWeatherForecastByCoOrdinates(
                                                           ipPropertiesModal.Lat
                                                           , ipPropertiesModal.Lon)
                                                       );

            getdashBoardRow1DetailsTask.Wait();
            getdashBoardRow1DetailsTask.Result.CurrentCityName =
                ipPropertiesModal.City;

            getdashBoardRow1DetailsTask.Result.CurrentCountryName = ipPropertiesModal.CountryCode
                                                                    + ", " + ipPropertiesModal.Country;
            return(getdashBoardRow1DetailsTask);
        }
Beispiel #3
0
        public (UserAccountModel UserAccount, List <UserRolesModel> UserRoles) ValidateUserLoginAndCredential(UserAccountModel userAccountModel)
        {
            bool isValidUser = false;
            Guid cookieUniqueId;

            cookieUniqueId = Guid.NewGuid();
            UserAccountModel      getUserAccount    = new UserAccountModel();
            List <UserRolesModel> userRoles         = new List <UserRolesModel>();
            IpPropertiesModal     ipPropertiesModal = new IpPropertiesModal();

            getUserAccount.CookieUniqueId = cookieUniqueId;
            if (userAccountModel.UserIpAddress == "::1")
            {
                userAccountModel.UserIpAddress = Faker.Internet.IPv4();
            }

            try
            {
                var resultSet = this._IUserAccountRepository.GetUserDetailsForLogin(userAccountModel);

                ipPropertiesModal                    = _IIPRequestDetails.GetCountryDetailsByIP(userAccountModel.UserIpAddress);
                ipPropertiesModal.IpAddress          = userAccountModel.UserIpAddress;
                ipPropertiesModal.CreatedByUserName  = userAccountModel.UserName;
                ipPropertiesModal.ModifiedByUserName = userAccountModel.UserName;
                ipPropertiesModal.UserName           = userAccountModel.UserName;
                ipPropertiesModal.CreatedOn          = DateTime.Now;
                ipPropertiesModal.ModifiedOn         = DateTime.Now;
                ipPropertiesModal.CookieUniqueId     = cookieUniqueId;

                if (resultSet.Set1 == null)
                {
                    isValidUser = false;
                }
                else
                {
                    getUserAccount = (UserAccountModel)resultSet.Set1.FirstOrDefault();
                    userRoles      = resultSet.Set2.ToList();

                    userAccountModel.Password = DecryptStringAES(userAccountModel.CryptLoginPassword);
                    string passwordConcated             = userAccountModel.Password + getUserAccount.PasswordSalt;
                    string generatedHashFromPassAndSalt = Hash.Create(HashType.SHA512, passwordConcated, string.Empty, false);
                    if (String.Compare(generatedHashFromPassAndSalt, getUserAccount.PasswordHash) == 0)
                    {
                        isValidUser = true;
                    }
                    userAccountModel            = getUserAccount;
                    ipPropertiesModal.UserId    = userAccountModel.UserId;
                    ipPropertiesModal.CreatedBy = userAccountModel.UserId;
                }
                getUserAccount.IsLoginSuccess = isValidUser;

                ipPropertiesModal.IsLoginSuccess = isValidUser;
                var dbUpdateResult = _IAppAnalyticsRepository.SaveIpAddressDetailsOnLogin(ipPropertiesModal);
            }
            catch (Exception Ex)
            {
                var dbUpdateResult = _IAppAnalyticsRepository.SaveIpAddressDetailsOnLogin(ipPropertiesModal);
            }
            userAccountModel.CookieUniqueId = cookieUniqueId;
            return(userAccountModel, userRoles);
        }