public PartialViewResult OfferMessage(long messageId = 0) { NotificationMessage message; if (messageId == 0) { message = new NotificationMessage { OfferMessage = new OfferMessage() }; ViewBag.ActionText = "Create"; } else { message = _notificationMessageService.GetNotification(messageId); message.OfferMessage = _notificationMessageService.FindOfferMessage((long)message.OfferId); ViewBag.ActionText = "Save"; } return(PartialView("_Offer", message)); }
public IHttpActionResult ByBeaconId(string beaconId, int rssi) { Enums.ProximityRange proximity = 0; rssi = Math.Abs(rssi); var beacon = _beaconService.GetByBeaconNum(beaconId); if (beacon.CompanyID == null) { //if beacon not assigned to company no messages can be scheduled return(Ok(new List <NotificationMessage>())); } var settings = _settingsService.ByCompany((long)beacon.CompanyID); if (rssi > settings.FarMinRSSI && rssi < settings.FarMaxRSSI) { proximity = Enums.ProximityRange.Far; } if (rssi > settings.NearMinRSSI && rssi < settings.NearMaxRSSI) { proximity = Enums.ProximityRange.Near; } if (rssi > settings.CloseMinRSSI && rssi < settings.CloseMaxRSSI) { proximity = Enums.ProximityRange.Close; } logging.Info("ByBeaconId: tring to get notifications for beacon ID - " + beaconId); var messages = _notificationMessageService.GetByBeaconNum(beaconId).ToList(); logging.Info(String.Format("ByBeaconId: {0} notifications found", messages.Count())); var filteredMessages = messages.ToList(); filteredMessages.RemoveAll(m => m.Disabled || (m.ProximityRange != 0 && m.ProximityRange != (int)proximity)); foreach (var message in filteredMessages) { if (message.OfferId != null) { message.OfferMessage = _notificationMessageService.FindOfferMessage((long)message.OfferId); } if (message.ProductRatingId != null) { message.RatingMessage = _notificationMessageService.FindRatingMessage((long)message.ProductRatingId); } if (message.ProductReviewId != null) { message.ReviewMessage = _notificationMessageService.FindReviewMessage((long)message.ProductReviewId); } if (message.VideoId != null) { message.VideoMessage = new VideoMessage { VideoMessageId = 1, MessageHeader = "Video message title", MessageDescription = "This is video message", MessageShortDescription = "This is video message", MessageImage = "http://livekart.altumsoft.com/Content/notificationimages/220420141023166565.jpg", VideoUrl = "https://www.youtube.com/watch?v=aiVByOBGBjA" }; } if (message.GameId != null) { message.GameMessage = new GameMessage { GameMessageId = 1, MessageHeader = "Game message title", MessageDescription = "This is game message", MessageShortDescription = "This is game message", MessageImage = "http://livekart.altumsoft.com/Content/notificationimages/220420141023166565.jpg", GameUrl = "http://google.com" }; } } return(Ok(filteredMessages)); }