Exemplo n.º 1
0
        public async Task <GeoLocProps> getGeoLocations()   //(string ip)
        {
            string ip = Request.HttpContext.Connection.RemoteIpAddress.ToString();

            // string ip = "108.16.31.96";

            if (string.IsNullOrEmpty(ip))
            {
                ip = Request.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
            }

            GeoLocProps model = await GeoLocProps.QueryGeographicalLocationAsync(ip);

            return(model);
        }
Exemplo n.º 2
0
        public IActionResult Post([FromBody] ViewModels.ParticipantViewModel Participantvalues)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            CertifiedVals = ScoreValLogic.Certify(Participantvalues);
            GeoLocProps GetGeoLocation = getGeoLocations().Result;
            string      Address        = string.Format("{0} {1} {2}", Participantvalues.City, " , ", Participantvalues.State);
            MapPoint    mapCords       = latlangofAddr(Address, GetGeoLocation.Latitude, GetGeoLocation.Longitude);
            bool        ZipCordsMatch  = VerifyZipCords(GetGeoLocation.ZipCode, Participantvalues.Zip);

            scoremodel = CalculateScore.CalscoreVal(CertifiedVals, mapCords, ZipCordsMatch);
            UserAgent.UserAgent ua = BrowserLookup();



            storetoDB(Participantvalues, scoremodel, GetGeoLocation, ua, mapCords);
            return(Ok());
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------------------------------------------------------



        //--------------------------------------------------------------------------------------------------------------------------

        public void storetoDB(ViewModels.ParticipantViewModel Participantvalues, ScoreModel score, GeoLocProps geo, UserAgent.UserAgent useragent, MapPoint mapCoords)
        {
            ParticipantDBViewModel dbModel = CertifyParticipant.storingtoDB(Participantvalues, score, geo, useragent, mapCoords);

            Participant participant = Mapper.Map <Participant>(dbModel);


            SurveyOptionsDBModel surveymodel = CalculateScore.getthesurveyObject();

            DAL.Models.Survey surveydal = new DAL.Models.Survey();
            //defining the survey object
            surveydal.Survey_Name       = surveymodel.Survey_Name;
            surveydal.Survey_Active     = surveymodel.Survey_Active;
            surveydal.SurveyId          = surveymodel.SurveyId;
            surveydal.CalAddressScore   = surveymodel.CalAddressScore;
            surveydal.CalAgeScore       = surveymodel.CalAgeScore;
            surveydal.CalSocialScore    = surveymodel.CalSocialScore;
            surveydal.CalTwoFactorScore = surveymodel.CalTwoFactorScore;

            _unitOfWork.ParticipantRepository.InsertSurveyParticipant(participant);

            _unitOfWork.ParticipantRepository.InsertSurveyParticipantTable(participant, surveydal);
        }
Exemplo n.º 4
0
        public static ParticipantDBViewModel storingtoDB(ParticipantViewModel Participantvalues, ScoreModel score, GeoLocProps geo, UserAgent.UserAgent useragent, MapPoint mapCords)
        {
            ParticipantDBViewModel dbModel = new ParticipantDBViewModel();

            dbModel.Age                    = Participantvalues.Age;
            dbModel.AgeValid               = score.AgeValid;
            dbModel.City                   = Participantvalues.City;
            dbModel.CityValid              = score.CityValid;
            dbModel.Date_of_Birth          = DateTime.Parse(Participantvalues.MonthofBirth + "/" + Participantvalues.YearofBirth);
            dbModel.EmailAddress           = Participantvalues.EmailAddress;
            dbModel.FirstName              = Participantvalues.FirstName;
            dbModel.FirstName_Match        = score.FirstName_Match;
            dbModel.LastName               = Participantvalues.LastName;
            dbModel.LastName_Match         = score.LastName_Match;
            dbModel.cords_IpAddrMatch      = score.Coordinates_Match;
            dbModel.OtherGenderType        = Participantvalues.othergender;
            dbModel.GenderIdentity         = Participantvalues.GenderIdentity;
            dbModel.OtherSexualOrientation = Participantvalues.otherSex;
            dbModel.OtherRace              = Participantvalues.OtherRace;
            dbModel.Password               = "";
            dbModel.Hispanic               = Participantvalues.Hispanic;
            dbModel.PhoneNumber            = Participantvalues.PhoneNumber;
            dbModel.Race                   = Participantvalues.Race;
            dbModel.SexualOrientation      = Participantvalues.SexualOrientation;
            dbModel.State                  = Participantvalues.State;
            dbModel.StateValid             = score.StateValid;
            dbModel.Verified               = score.Verified;
            dbModel.Zip                    = Participantvalues.Zip;
            dbModel.geo_IP                 = geo.IP;
            dbModel.geo_City               = geo.City;
            dbModel.geo_CountryName        = geo.CountryName;
            dbModel.geo_RegionName         = geo.RegionName;
            dbModel.geo_ZipCode            = geo.ZipCode;
            dbModel.geo_lattude            = geo.Latitude;
            dbModel.geo_longitude          = geo.Longitude;
            dbModel.OS      = useragent.OS.Name.ToString();
            dbModel.Browser = useragent.Browser.Name.ToString();

            dbModel.AddrLatitude  = mapCords.Latitude;
            dbModel.AddrLongitude = mapCords.Longitude;
            dbModel.latlangMatch  = mapCords.MatchCords;

            dbModel.FinalScaoreVal = score.FinalScaoreVal;
            dbModel.TwoFactorScore = score.TwoFactorScore;
            dbModel.SocialScore    = score.SocialScore;
            dbModel.AgeScore       = score.AgeScore;
            dbModel.AddressScore   = score.AddressScore;
            dbModel.RegisterDate   = DateTime.Now.ToString("U");
            return(dbModel);
        }