Esempio n. 1
0
        public void AddLocationWeather(IList <WeatherModel> result, int requestId)
        {
            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                foreach (var item in result)
                {
                    var request = new CliqueWeather
                    {
                        CreatedAt     = DateTime.Now,
                        Humidity      = item.Humidity,
                        MaxTemp       = item.MaxTemp,
                        MinTemp       = item.MinTemp,
                        ModifiedAt    = DateTime.Now,
                        RequestId     = requestId,
                        Temp          = item.Temp,
                        Weather       = item.Weather,
                        WeatherDay    = item.WeatherDay,
                        WindDirection = item.WindDirection,
                        WindSpeed     = item.WindSpeed
                    };

                    entity.CliqueWeathers.Add(request);
                }

                entity.SaveChanges();
            }
        }
Esempio n. 2
0
 public bool UpdateRequestStatus(int status, int requestId)
 {
     using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
     {
         var response = entity.CliqueClaimRequests.SingleOrDefault(res => res.Id == requestId);
         response.Status = status;
         entity.SaveChanges();
     }
     return(true);
 }
Esempio n. 3
0
 public bool IsLocationTweetExist(CliqueClaimRequestModel model)
 {
     using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
     {
         var response = entity.CliqueLocationTweets.Where(res => res.RequestId == model.Id);
         entity.CliqueLocationTweets.RemoveRange(response);
         entity.SaveChanges();
     }
     return(false);
 }
Esempio n. 4
0
        public bool AddEvent(List <EventModel> modelList)
        {
            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                foreach (var item in modelList)
                {
                    var request = new CliqueEvent
                    {
                        EventId     = item.EventId,
                        Name        = item.Name,
                        Description = item.Description,
                        StartDate   = item.StartDate,
                        EndDate     = item.EndDate,
                        Venue       = item.Venue,
                        CreatedAt   = DateTime.Now,
                        ModifiedAt  = DateTime.Now
                    };
                    var existingItem = entity.CliqueEvents.FirstOrDefault(res => res.EventId == request.EventId);
                    if (existingItem == null)
                    {
                        entity.CliqueEvents.Add(request);
                        entity.SaveChanges();
                        item.Id = request.Id;
                    }
                    else
                    {
                        item.Id = existingItem.Id;
                    }

                    var mappingRequest = new CliqueLocationEvent
                    {
                        EventId    = item.Id,
                        RequestId  = item.RequestId,
                        CreatedAt  = DateTime.Now,
                        ModifiedAt = DateTime.Now
                    };
                    entity.CliqueLocationEvents.Add(mappingRequest);
                    entity.SaveChanges();
                }
            }

            return(true);
        }
Esempio n. 5
0
        public CliqueClaimRequestModel AddClaimRequest(CliqueClaimRequestModel model)
        {
            CliqueClaimRequest request = null;

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                if (model.Id == 0)
                {
                    request = new CliqueClaimRequest();
                    entity.CliqueClaimRequests.Add(request);
                    request.AddedAt = DateTime.Now;
                }
                else
                {
                    request = entity.CliqueClaimRequests.FirstOrDefault(res => res.Id == model.Id);
                }


                request.Accomodates            = model.Accomodates;
                request.Address1               = model.Address1;
                request.Address2               = model.Address2;
                request.Bedrooms               = model.Bedrooms;
                request.Beds                   = model.Beds;
                request.City                   = model.City;
                request.Country                = model.Country;
                request.Description            = model.Description;
                request.Locality               = model.City;
                request.Name                   = model.Name;
                request.NightPrice             = model.NightPrice;
                request.State                  = model.State;
                request.Type                   = model.Type;
                request.WeekPrice              = model.WeekPrice;
                request.Zip                    = model.Zip;
                request.SSN                    = model.SSN;
                request.IsACAvailable          = model.IsACAvailable;
                request.IsBuzzerAvailable      = model.IsBuzzerAvailable;
                request.IsLiftAvailable        = model.IsLiftAvailable;
                request.IsPetsAllowed          = model.IsPetsAllowed;
                request.IsPrivatePoolAvailable = model.IsPrivatePoolAvailable;
                request.IsWifiAvailable        = model.IsWifiAvailable;
                request.FromDate               = model.FromDate;
                request.ToDate                 = model.ToDate;
                request.Price                  = model.Price;
                request.Score                  = model.Score;
                request.Status                 = model.Status;
                request.Latitude               = model.Latitude;
                request.Longitude              = model.Longitude;

                entity.SaveChanges();
                model.Id = request.Id;
            }

            return(model);
        }
Esempio n. 6
0
        public void AddTweetAndLocation(List <TweetModel> modelList)
        {
            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                foreach (var item in modelList)
                {
                    var request = new CliqueTweet
                    {
                        PostedAt        = item.PostedAt,
                        PostedBy        = item.PostedBy,
                        Text            = item.Text,
                        ProfileImageURL = item.ProfileImageURL,
                        TweetIdStr      = item.TweetIdStr,
                        AddedAt         = DateTime.Now,
                        ModifiedAt      = DateTime.Now,
                        Score           = item.Score
                    };
                    var existingItem = entity.CliqueTweets.SingleOrDefault(res => res.TweetIdStr == request.TweetIdStr);
                    if (existingItem == null)
                    {
                        entity.CliqueTweets.Add(request);
                        entity.SaveChanges();
                        item.Id = request.Id;
                    }
                    else
                    {
                        item.Id = existingItem.Id;
                    }

                    var mappingRequest = new CliqueLocationTweet
                    {
                        TweetId    = item.Id,
                        RequestId  = item.RequestId,
                        CreatedAt  = DateTime.Now,
                        ModifiedAt = DateTime.Now
                    };
                    entity.CliqueLocationTweets.Add(mappingRequest);
                    entity.SaveChanges();
                }
            }
        }
Esempio n. 7
0
 public void UpdateTweetScore(List <TweetModel> modelList)
 {
     using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
     {
         foreach (var item in modelList)
         {
             var existingItem = entity.CliqueTweets.SingleOrDefault(res => res.TweetIdStr == item.TweetIdStr);
             if (existingItem != null)
             {
                 existingItem.Score = item.Score;
                 entity.SaveChanges();
             }
         }
     }
 }
Esempio n. 8
0
        public LocationModel AddLocation(LocationModel model)
        {
            var request = new CliqueLocation
            {
                Pincode = model.Pincode,
                City    = model.City
            };

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                entity.CliqueLocations.Add(request);
                entity.SaveChanges();
            }
            model.Id = request.Id;
            return(model);
        }
Esempio n. 9
0
        public UserModel AddUser(UserModel model)
        {
            var request = new CliqueUser
            {
                MobileNo        = model.MobileNo,
                EmailId         = model.EmailId,
                TwitterUserName = model.TwitterUserName,
                Name            = model.Name,
                CreatedAt       = DateTime.Now,
                ModifiedAt      = DateTime.Now
            };

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                entity.CliqueUsers.Add(request);
                entity.SaveChanges();
            }
            model.Id = request.Id;
            return(model);
        }
Esempio n. 10
0
        public RequestModel AddRequest(RequestModel model)
        {
            if (model.LocationId == 0)
            {
                var locationModel = AddLocation(new LocationModel {
                    Pincode = model.Pincode, City = model.City
                });
                model.LocationId = locationModel.Id;
            }
            if (model.UserId == 0)
            {
                var userModel = AddUser(new UserModel
                {
                    MobileNo        = model.MobileNo,
                    EmailId         = model.EmailId,
                    Name            = model.UserName,
                    TwitterUserName = model.TwitterUserName
                });

                model.UserId = userModel.Id;
            }
            var request = new CliqueRequest
            {
                Address      = model.Address,
                BuildingName = model.BuildingName,
                CreatedAt    = DateTime.Now,
                ModifiedAt   = DateTime.Now,
                FromDate     = model.FromDate,
                ToDate       = model.ToDate,
                LocationId   = model.LocationId,
                UserId       = model.UserId
            };

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                var response = entity.CliqueRequests.Add(request);
                entity.SaveChanges();
                model.Id = response.Id;
            }
            return(model);
        }
Esempio n. 11
0
        public bool AddProperty(HomeAwayPropertyModel model)
        {
            HomeAwayProperty request = null;

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                if (model.Id == 0)
                {
                    request = new HomeAwayProperty();
                    entity.HomeAwayProperties.Add(request);
                    request.AddedAt = DateTime.Now;
                }
                else
                {
                    request = entity.HomeAwayProperties.FirstOrDefault(res => res.Id == model.Id);
                }


                request.Accomodates = model.Accomodates;
                request.Address1    = model.Address1;
                request.Address2    = model.Address2;
                request.Bedrooms    = model.Bedrooms;
                request.Beds        = model.Beds;
                request.City        = model.City;
                request.Country     = model.Country;
                request.Description = model.Description;
                request.Locality    = model.City;
                request.Name        = model.Name;
                request.NightPrice  = model.NightPrice;
                request.State       = model.State;
                request.Type        = model.Type;
                request.WeekPrice   = model.WeekPrice;
                request.Zip         = model.Zip;

                entity.SaveChanges();
            }

            return(true);
        }
Esempio n. 12
0
        public void AddUserFeedback(UserFeedbackModel model)
        {
            SemantriaHelper.AddUserFeedbackScore(model);

            using (ipl_userprofilerEntities entity = new ipl_userprofilerEntities())
            {
                var homeAwayProperty = entity.HomeAwayProperties.First(res => res.Id == model.PropertyId);


                var request = new HomeAwayFeedback
                {
                    PropertyId = model.PropertyId,
                    UserEmail  = model.UserEmail,
                    UserName   = model.UserName,
                    Text       = model.Text,
                    AddedAt    = DateTime.Now
                };

                entity.HomeAwayFeedbacks.Add(request);


                //Map feedbackto to claim property

                var requestId     = entity.CliqueClaimRequests.First(res => res.Name == homeAwayProperty.Name && res.Zip == homeAwayProperty.Zip).Id;
                var claimFeedback = new CliqueClaimRequestFeedback
                {
                    RequestId = requestId,
                    UserEmail = model.UserEmail,
                    UserName  = model.UserName,
                    Text      = model.Text,
                    Score     = model.Score,
                    AddedAt   = DateTime.Now
                };

                entity.CliqueClaimRequestFeedbacks.Add(claimFeedback);
                entity.SaveChanges();
            }
        }