Exemplo n.º 1
0
        public async Task <NotificationStatusEntity> SendNotification(NotificationEntity entity)
        {
            // Get user access tokens
            var subscriptionEntity = _repository.GetSubscription(entity.Username).ToSubscriptionEntity();

            // Send notification
            var headers = new Dictionary <string, string>();

            var content       = JsonConvert.SerializeObject(new { body = entity.NoteText, title = entity.NoteTitle, type = "note" });
            var stringContent = new StringContent(content, Encoding.UTF8, "application/json");

            stringContent.Headers.Add("Access-Token", subscriptionEntity.AccessToken);

            var response = await _httpClient.PostAsync(_pushUrl, null, stringContent);

            if (!response.IsSuccessStatusCode)
            {
                return(new NotificationStatusEntity {
                    IsSent = false, StatusText = "Unable to send notification"
                });
            }
            subscriptionEntity.TotalNotificationsPushed++;


            // Update subscription
            _repository.Update(subscriptionEntity.ToSubscriptionDataModel());

            return(new NotificationStatusEntity {
                IsSent = true, StatusText = "Success"
            });
        }
        public async Task SendNotification()
        {
            var gateway = new NotificationGateway(new ConfigurationComponent());
            List <NotificationEntity> notifications = new List <NotificationEntity>();

            var entity = new NotificationEntity();

            entity.AddWhom(new MemberEntity()
            {
                Email       = "*****@*****.**",
                Name        = "gregory valderrama",
                SlackMember = "UFR3ZBD6Y"
            });

            entity.AddServiceReason(new ServiceEntity()
            {
                Availability = 0.98m,
                SLO          = 0.99m,
                Name         = "service test",
                Budget       = -0.01m,
                Leaders      = "*****@*****.**"
            }, DateTime.Now, DateTime.Now);

            notifications.Add(entity);
            await gateway.SendNotifications(notifications);
        }
Exemplo n.º 3
0
        //IN CASE OF Approve
        //REQUIRD MENUID,TRANSACTION,STATUSID 1(approval) ,Approval CustomCOde
        //IS APPROVED 1, IS DELETE 0, IS UPDATE 0 , @APPROVALCUSTOMCODE = ''
        public Hashtable SetProcedureParamForDeclained(NotificationEntity ent, int ComapnyID, int IsApprove, string Comment, int IsUpdate, int IsDelete, int statusID, string approvalCustomCode, int IsDeclained = 0, String Message = "")
        {
            List <NotificationEntity> list = this.GetNotificationInfoByUser(ent.PrevWFUserID ?? 0);
            int?declinedTo = 0;

            using (ERP_Entities dbContext = new ERP_Entities())
            {
                declinedTo = (from tb in dbContext.CmnWorkFlowDetails
                              where tb.WorkFlowID == ent.WorkFlowID && tb.Sequence == ent.currentSequence - 2 &&
                              tb.IsDeleted == false
                              select tb.EmployeeID).FirstOrDefault();
            }

            Hashtable ht = new Hashtable();

            ht.Add("MenuID", ent.MenuID);
            ht.Add("UserID", declinedTo ?? 0);
            ht.Add("TargetUserID", ent.PrevWFUserID);
            ht.Add("CompanyID", ComapnyID);
            ht.Add("CreatePc", HostService.GetIP());
            ht.Add("TransactionID", ent.TransactionID);
            ht.Add("TransactionDate", DateTime.Now);
            ht.Add("IsApprove", IsApprove);
            ht.Add("Comment", Comment);
            ht.Add("IsUpdate", IsUpdate);
            ht.Add("IsDelete", IsDelete);
            ht.Add("STATUSID", statusID);
            ht.Add("APPROVALCUSTOMCODE", approvalCustomCode);
            ht.Add("IsDeclained", IsDeclained);
            ht.Add("MessageName", Message);
            return(ht);
        }
Exemplo n.º 4
0
        public vmNotificationMail GetNotificationMailObject(NotificationEntity model, string message)
        {
            vmNotificationMail obj = new vmNotificationMail();

            try
            {
                using (var db = new ABS.Models.ERP_Entities())
                {
                    // if (model.NextWFUserID==null)
                    obj.nextUser             = db.CmnUsers.Where(x => x.UserID == model.NextWFUserID).FirstOrDefault().UserFullName;
                    obj.companyName          = db.CmnCompanies.Where(x => x.CompanyID == model.LoggedCompanyID).FirstOrDefault().CompanyName;
                    obj.menuName             = db.CmnMenus.Where(x => x.MenuID == model.MenuID).FirstOrDefault().MenuName;
                    obj.customCode           = model.TransactionID.ToString();
                    obj.customCode           = db.CmnWorkFlowTransactions.Where(x => x.UserID == model.NextWFUserID && x.IsDeleted == false && x.StatusID == 1).FirstOrDefault().CustomCode;
                    obj.message              = message;
                    obj.currentUser          = db.CmnUsers.Where(x => x.UserID == model.CreatorID).FirstOrDefault().UserFullName;
                    obj.comments             = model.Comments;
                    obj.nextUserEmailAddress = db.CmnUserAuthentications.Where(x => x.UserID == model.NextWFUserID).FirstOrDefault().LoginEmail;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(obj);
        }
Exemplo n.º 5
0
        public List <vmNotificationMail> GetNotificationMailObjectListDeclined(NotificationEntity model, string message)
        {
            List <vmNotificationMail> objList = new List <vmNotificationMail>();

            try
            {
                using (var db = new ABS.Models.ERP_Entities())
                {
                    List <CmnWorkFlowTransactionTran> list = new List <CmnWorkFlowTransactionTran>();
                    list = db.CmnWorkFlowTransactionTrans.Where(x => x.TransactionID == model.TransactionID && x.IsActve == true &&
                                                                x.WFMID == model.WorkFlowID && x.IsDeleted == false).ToList();
                    foreach (CmnWorkFlowTransactionTran item in list)
                    {
                        vmNotificationMail obj = new vmNotificationMail();
                        obj.nextUser    = db.CmnUsers.Where(x => x.UserID == item.TUserID).FirstOrDefault().UserFullName;
                        obj.companyName = db.CmnCompanies.Where(x => x.CompanyID == item.CompanyID).FirstOrDefault().CompanyName;
                        obj.menuName    = db.CmnMenus.Where(x => x.MenuID == item.MenuID).FirstOrDefault().MenuName;
                        obj.customCode  = item.CustomCode.ToString();
                        obj.message     = db.CmnWorkFlowTransactionTrans.Where(x => x.TransactionID == item.TransactionID && x.WFMID == item.WFMID &&
                                                                               x.IsDeleted == false && x.Ccomment == "1").FirstOrDefault().Notification;

                        obj.currentUser          = db.CmnUsers.Where(x => x.UserID == item.UserID).FirstOrDefault().UserFullName;
                        obj.comments             = item.Notification;
                        obj.nextUserEmailAddress = db.CmnUserAuthentications.Where(x => x.UserID == item.TUserID).FirstOrDefault().LoginEmail;
                        obj.isApproved           = false;
                        objList.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(objList);
        }
        List <NotificationEntity> GetNoticationSeed()
        {
            testUserId = Guid.NewGuid();
            var n1 = new NotificationEntity()
            {
                UserId    = testUserId,
                DateAdded = DateTime.Now.AddDays(-2),
                EventType = EventType.AppointmentCancelled.ToString(),
                Message   = "1 Hi Firstname, your appointment with OrganisationName at AppointmentDateTime has been cancelled for the following reason: Reason.",
                Id        = Guid.NewGuid(),
            };

            var n2 = new NotificationEntity()
            {
                UserId    = testUserId,
                DateAdded = DateTime.Now.AddDays(-1),
                EventType = EventType.AppointmentCancelled.ToString(),
                Message   = "2 Hi Firstname, your appointment with OrganisationName at AppointmentDateTime has been cancelled for the following reason: Reason.",
                Id        = Guid.NewGuid(),
            };

            var n3 = new NotificationEntity()
            {
                UserId    = testUserId,
                DateAdded = DateTime.Now,
                EventType = EventType.AppointmentCancelled.ToString(),
                Message   = "3 Hi Firstname, your appointment with OrganisationName at AppointmentDateTime has been cancelled for the following reason: Reason.",
                Id        = Guid.NewGuid(),
            };

            return(new List <NotificationEntity>
            {
                n1, n2, n3
            });
        }
Exemplo n.º 7
0
        public async Task <NotificationModel> AddUserNotification(NotificationEventModel notication)
        {
            var template = dbContext.Templates.FirstOrDefault(x => x.EventType == notication.Type);

            if (template == null)
            {
                return(null);
            }

            var entity = new NotificationEntity
            {
                UserId    = notication.UserId,
                DateAdded = DateTime.Now,
                EventType = notication.Type
            };

            entity.Message = template.Body;

            entity.Message = entity.Message.Replace("{Firstname}", notication.Data.FirstName);
            entity.Message = entity.Message.Replace("{OrganisationName}", notication.Data.OrganisationName);
            entity.Message = entity.Message.Replace("{AppointmentDateTime}", notication.Data.AppointmentDateTime);
            entity.Message = entity.Message.Replace("{Reason}", notication.Data.Reason);

            await dbContext.Notifications.AddAsync(entity).ConfigureAwait(false);

            await dbContext.SaveChangesAsync().ConfigureAwait(false);

            return(new NotificationModel()
            {
                Id = entity.Id,
                Message = entity.Message,
                EventType = entity.EventType,
                UserId = entity.UserId
            });
        }
Exemplo n.º 8
0
        public static IList <NotificationEntity> CreateInAppNotifications(EditionEntity edition, NotificationType notificationType, string recipients, string actorUserEmail)
        {
            if (WebConfigHelper.RemoveActorUserFromNotificationRecipients)
            {
                recipients = NotificationControllerHelper.RemoveCurrentUserFromRecipients(recipients, actorUserEmail);
            }

            if (string.IsNullOrWhiteSpace(recipients))
            {
                return(null);
            }

            var recipientList = recipients.Split(Utility.Constants.EmailAddressSeparator).ToList();
            var notifications = new List <NotificationEntity>();

            foreach (var recipient in recipientList)
            {
                var notification = new NotificationEntity
                {
                    NotificationType = notificationType,
                    ReceiverEmail    = recipient,
                    EventId          = edition.EventId,
                    EditionId        = edition.EditionId,
                    CreatedOn        = DateTime.Now,
                    Displayed        = false,
                    SentByEmail      = false
                };

                notifications.Add(notification);
            }

            return(notifications);
        }
        protected EventCustomerNotificationEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _eventCustomers = (EventCustomersEntity)info.GetValue("_eventCustomers", typeof(EventCustomersEntity));
                if (_eventCustomers != null)
                {
                    _eventCustomers.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _notification = (NotificationEntity)info.GetValue("_notification", typeof(NotificationEntity));
                if (_notification != null)
                {
                    _notification.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                _notificationType = (NotificationTypeEntity)info.GetValue("_notificationType", typeof(NotificationTypeEntity));
                if (_notificationType != null)
                {
                    _notificationType.AfterSave += new EventHandler(OnEntityAfterSave);
                }

                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
        public void ShouldNot_Create_Invalid()
        {
            var invalidNotificationEntity = new NotificationEntity();
            var newCreatedAccountEntity   = _service.Create(invalidNotificationEntity);

            Assert.NotNull(newCreatedAccountEntity);
        }
Exemplo n.º 11
0
        public void Save(NotificationViewModel vm)
        {
            var entity = new NotificationEntity(0);

            vm.Bind(entity);
            NotificationService.Save(entity);
        }
Exemplo n.º 12
0
        public NotificationModel AddNotification(NotificationModel notificationModel)
        {
            //todo : add a better way of converting the dtos -> entities (autommaper)

            if (notificationModel.Type == Common.Models.Enums.EventType.AppointmentCancelled)
            {
                var canceledNotificationdata = (notificationModel.Data as JObject).ToObject <CanceledNotificationData>();
                var entity = new NotificationEntity()
                {
                    EventType           = notificationModel.Type,
                    FirstName           = canceledNotificationdata.FirstName,
                    AppointmentDateTime = canceledNotificationdata.AppointmentDateTime,
                    OrganisationName    = canceledNotificationdata.OrganisationName,
                    Reason       = canceledNotificationdata.Reason,
                    CreationTime = DateTime.Now
                };

                _dbContext.Notifications.Add(entity);
                _dbContext.SaveChanges();

                notificationModel.Id = entity.Id;
                return(notificationModel);
            }

            // we failed to find all suitable data inside the model , then throw an error
            // todo : add a better error handling with base class and domain errors ...
            throw new ArgumentException($"Invalid input provided", nameof(NotificationModel));
        }
Exemplo n.º 13
0
        public async Task <dynamic> ApproveNotification(NotificationEntity model)
        {
            int returnValue = 0;

            try
            {
                int WorkFlowStatus = 1;
                if (WorkFlowStatus == 1)
                {
                    returnValue = new WorkFLowMgt().ApproveProcess(model);
                    List <vmNotificationMail> nModel = new WorkFLowMgt().GetNotificationMailObjectList(model, "");
                    foreach (var item in nModel)
                    {
                        returnValue = await new EmailService().NotificationMail(item);
                    }
                    //NotificationHubsSales.BroadcastDataSales(new NotificationEntity());
                    NotificationHubs.BroadcastData(new NotificationEntity());
                    returnValue = 200;
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            return(returnValue);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Allows a client to broadcast a notification to the joined view user, IF:
        ///     1. they are an view administrator
        /// </summary>
        /// <param name="viewId"></param>
        /// <param name="userId"></param>
        /// <param name="incomingData"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task <ViewModels.Notification> PostToUser(Guid viewId, Guid userId, ViewModels.Notification incomingData, CancellationToken cancellationToken)
        {
            var wasSuccess  = true;
            var canPost     = true;
            var messageTime = DateTime.Now.ToUniversalTime();
            NotificationEntity notificationEntity;

            if ((await _authorizationService.AuthorizeAsync(_user, null, new ViewAdminRequirement(viewId))).Succeeded)
            {
                notificationEntity               = _mapper.Map <NotificationEntity>(incomingData);
                notificationEntity.ViewId        = viewId;
                notificationEntity.ToId          = userId;
                notificationEntity.ToType        = NotificationType.User;
                notificationEntity.BroadcastTime = messageTime;
                notificationEntity.FromId        = _user.GetId();
                notificationEntity.FromType      = NotificationType.User;
                notificationEntity.FromName      = _user.Claims.Single(x => x.Type == "name").Value;
                notificationEntity.ToName        = _context.Users.Single(x => x.Id == userId).Name;
                _context.Notifications.Add(notificationEntity);
                await _context.SaveChangesAsync(cancellationToken);
            }
            else
            {
                notificationEntity = new NotificationEntity {
                };
                wasSuccess         = false;
                canPost            = false;
            }
            var returnNotification = _mapper.Map <ViewModels.Notification>(notificationEntity);

            returnNotification.WasSuccess = wasSuccess;
            returnNotification.CanPost    = canPost;
            returnNotification.IconUrl    = GetIconUrl(notificationEntity.Priority, notificationEntity.FromName);
            return(returnNotification);
        }
Exemplo n.º 15
0
        public async Task <ActionResult <GetFollowRequestsAndFollowsDto> > FollowBackAsync(
            [FromRoute][Required] int id,
            CancellationToken cancellationToken)
        {
            var currentUserId = _userManager.GetUserIdAsInt(HttpContext.User);

            await _user.DoFollowBackAsync(currentUserId, id, cancellationToken)
            .ConfigureAwait(false);

            var notification = new NotificationEntity {
                Type           = NotificationType.FollowBack,
                SentByUserId   = currentUserId,
                ReceivedUserId = id,
                TriggeredOn    = DateTimeOffset.Now
            };

            await _notification.DoAddAsync(notification, cancellationToken)
            .ConfigureAwait(false);

            await _notification.DoBroadcastNotifications(id)
            .ConfigureAwait(false);

            var newlyFetchedCurrentUser = await _userManager
                                          .FindByIdWithAdditionalDataAsync(currentUserId, includesRoles : false, cancellationToken :  cancellationToken)
                                          .ConfigureAwait(false);

            var dto = CreateFollowRequestsAndFollowsDto(newlyFetchedCurrentUser !);

            return(Ok(dto));
        }
        public async Task <dynamic> DeclainedNotification(NotificationEntity model)
        {
            int returnValue = 0;

            try
            {
                #region Old
                //Required CompnayID,IsApproved=0,Comments,Isupdate false,isDelete false ,StatusID=1
                //String MessageName = System.Enum.GetName(typeof(workFlowTranEnum_MessageName), (int)workFlowTranEnum_MessageName.Declined);
                //int WorkFlowStatus = new WorkFLowMgt().ExecuteWorkFlowTransactionProcess(new WorkFLowMgt().SetProcedureParamForDeclained(model, (int)model.LoggedCompanyID, (int)workFlowTranEnum_IsApproved.False, model.Comments, (int)workFlowTranEnum_IsUpdate.False, (int)workFlowTranEnum_IsDelete.False, (int)workFlowTranEnum_Status.Active, model.CustomCode, (int)workFlowTranEnum_IsDeclained.True, MessageName));
                //if (WorkFlowStatus == 0)
                //{
                //    NotificationHubs.BroadcastData(new NotificationEntity());
                //    returnValue = 201;
                //}
                #endregion old
                #region New
                returnValue = new WorkFLowMgt().DeclinedProcess(model);
                List <vmNotificationMail> nModel = new WorkFLowMgt().GetNotificationMailObjectListDeclined(model, "");
                foreach (var item in nModel)
                {
                    returnValue = await new EmailService().NotificationMail(item);
                }
                NotificationHubs.BroadcastData(new NotificationEntity());
                returnValue = 201;
                #endregion New
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            return(returnValue);
        }
Exemplo n.º 17
0
        public async Task <NotificationEntity> AddNumberForEvent(EventTextDto dto)
        {
            var entity = await _refRepository.GetEventByName(dto.Message);

            if (entity != null)
            {
                EventInformation eventInformation = new EventInformation
                {
                    Message   = dto.Message,
                    From      = dto.From,
                    ProgramId = entity.ProgramId,
                    City      = dto.City,
                    Zip       = dto.Zip,
                    SportId   = entity.SportId
                };
                await _trainingRepository.AddEvent(eventInformation);
            }
            else
            {
                entity = new NotificationEntity {
                    Message = "You text " + dto.Message
                };
            }
            return(entity);
        }
Exemplo n.º 18
0
        public static async Task <int> Count(ApplicationDbContext context, NotificationEntity entity)
        {
            if (!entity.iscache ||
                Configs.GeneralSettings.cache_duration == 0 ||
                entity.pagenumber > Configs.GeneralSettings.max_cache_pages)
            {
                return(await CountRecords(context, entity));
            }
            else
            {
                string key     = GenerateKey("cnt_message", entity);
                int    records = 0;
                if (!SiteConfig.Cache.TryGetValue(key, out records))
                {
                    records = await CountRecords(context, entity);

                    var cacheEntryOptions = new MemoryCacheEntryOptions()
                                            // Keep in cache for this time, reset time if accessed.
                                            .SetSlidingExpiration(TimeSpan.FromSeconds(3600));

                    // Save data in cache.
                    SiteConfig.Cache.Set(key, records, cacheEntryOptions);
                }
                else
                {
                    records = (int)SiteConfig.Cache.Get(key);
                }
                return(records);
            }
        }
        private Task <NotificationEntity> listen()
        {
            return(Task.Run <NotificationEntity>(() =>
            {
                // Accept new connections
                try
                {
                    BluetoothClient conn = lsnr.AcceptBluetoothClient();
                    Stream stream = conn.GetStream();
                    StreamReader sr = new StreamReader(stream);
                    String title = sr.ReadLine();
                    String tmp;
                    String _body = "";
                    while (!(tmp = sr.ReadLine()).Equals("com.devcando.stop"))
                    {
                        _body += tmp + "\n";
                    }
                    String body = _body;
                    //Send a message for synchronization with the peer.
                    stream.WriteByte(1);
                    //Read the bitmap
                    byte[] icon_b = Utils.ReadToEnd(stream);
                    sr.Close();

                    NotificationEntity notificationEntity = new NotificationEntity(title, body, icon_b);
                    return notificationEntity;
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Error: " + e.Message);
                    return new NotificationEntity("Error", e.Message, null);
                }
            }));
        }
Exemplo n.º 20
0
        private Core.Notifications.Notification GetNotificationCoreModel(NotificationEntity entity)
        {
            var retVal = GetNewNotification(entity.Type);

            retVal.InjectFrom(entity);

            return(retVal);
        }
Exemplo n.º 21
0
        public async Task <bool> CreateNotificationAsync(NotificationEntity notification, CancellationToken ct)
        {
            _context.Notifications.Add(notification);

            var created = await _context.SaveChangesAsync(ct);

            return(created > 0 ? true : false);
        }
Exemplo n.º 22
0
 internal static void Map(NotificationEntity entity, Notification notify)
 {
     entity.NotificationID          = notify.ID;
     entity.Type                    = notify.Type;
     entity.NotificationDefaultTime = notify.NotificationDefaultTime;
     entity.NotificateBeforeDay     = notify.NotificateBeforeDay;
     entity.EventID                 = notify.EventID;
 }
Exemplo n.º 23
0
 public override void Patch(NotificationEntity notification)
 {
     if (notification is TwitterNotificationEntity entity)
     {
         entity.Post = Post;
     }
     base.Patch(notification);
 }
Exemplo n.º 24
0
        public Notification Save(Notification domainObject)
        {
            using (var adapter = _persistenceLayer.GetDataAccessAdapter())
            {
                if (domainObject.UserId > 0)
                {
                    try
                    {
                        var customer = _customerRepository.GetCustomerByUserId(domainObject.UserId);
                        if (customer != null && ((customer.DoNotContactTypeId.HasValue && (customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotContact || customer.DoNotContactTypeId.Value == (long)DoNotContactType.DoNotMail)) || !customer.EnableEmail))
                        //(customer.DoNotContactReasonId.HasValue && customer.DoNotContactReasonId.Value > 0))
                        {
                            return(null);
                        }
                    }
                    catch (ObjectNotFoundInPersistenceException <Customer> )
                    {
                        //Do Nothing
                    }
                }

                NotificationEntity notificationEntity = _notificationMapper.Map(domainObject);
                if (!adapter.SaveEntity(notificationEntity, true, false))
                {
                    throw new PersistenceFailureException("Could not save Notification.");
                }

                if (domainObject as NotificationEmail != null)
                {
                    NotificationEmailEntity notificationEmailEntity = _notificationEmailMapper.Map(domainObject as NotificationEmail);
                    notificationEmailEntity.IsNew = domainObject.Id == 0;
                    notificationEmailEntity.NotificationEmailId = notificationEntity.NotificationId;
                    if (!adapter.SaveEntity(notificationEmailEntity, true))
                    {
                        throw new PersistenceFailureException("Could not save NotificationEmail.");
                    }

                    notificationEntity.NotificationEmail = notificationEmailEntity;
                }

                if (domainObject as NotificationPhone == null)
                {
                    return(_notificationMapper.Map(notificationEntity));
                }

                var notificationPhone = _notificationPhoneMapper.Map(domainObject as NotificationPhone);
                notificationPhone.IsNew = domainObject.Id == 0;
                notificationPhone.NotificationPhoneId = notificationEntity.NotificationId;
                if (!adapter.SaveEntity(notificationPhone, true))
                {
                    throw new PersistenceFailureException("Could not save NotificationEmail.");
                }

                notificationEntity.NotificationPhone = notificationPhone;

                return(_notificationMapper.Map(notificationEntity));
            }
        }
Exemplo n.º 25
0
        private Notification GetNotificationCoreModel(NotificationEntity entity)
        {
            var retVal = GetNewNotification(entity.Type);

            // Type may have been unregistered by now.
            retVal?.InjectFrom(entity);

            return(retVal);
        }
Exemplo n.º 26
0
 public NotificationResponse(NotificationEntity entity, long userId)
 {
     Id        = entity.Id;
     SenderId  = entity.SenderId;
     Type      = entity.Body.GetType().ToString();
     Body      = entity.Body;
     Seen      = entity.Receivers.First(r => r.UserId == userId).Read;
     CreatedAt = entity.CreatedAt;
 }
Exemplo n.º 27
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _notification = null;
            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
Exemplo n.º 28
0
 /// <summary> setups the sync logic for member _notification</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncNotification(IEntity2 relatedEntity)
 {
     if (_notification != relatedEntity)
     {
         DesetupSyncNotification(true, true);
         _notification = (NotificationEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_notification, new PropertyChangedEventHandler(OnNotificationPropertyChanged), "Notification", NotificationEmailEntity.Relations.NotificationEntityUsingNotificationEmailId, true, new string[] {  });
     }
 }
        public static NotificationEntity ToDataModel(this Core.Notification.Notification notification)
        {
            NotificationEntity retVal = new NotificationEntity();

            retVal.InjectFrom(notification);

            retVal.SendingGateway = notification.NotificationSendingGateway.GetType().Name;

            return(retVal);
        }
Exemplo n.º 30
0
        public bool UpdateDownloadedNotification(int?id)
        {
            var noti = new NotificationEntity()
            {
                IsSuccess = false,
                Id        = id
            };

            return(Update(noti));
        }
 /// <summary>
 /// There are no comments for NotificationEntitySet in the schema.
 /// </summary>
 public void AddToNotificationEntitySet(NotificationEntity notificationEntity)
 {
     base.AddObject("NotificationEntitySet", notificationEntity);
 }
 /// <summary>
 /// Create a new NotificationEntity object.
 /// </summary>
 /// <param name="id">Initial value of Id.</param>
 /// <param name="creationTime">Initial value of CreationTime.</param>
 /// <param name="uuid">Initial value of Uuid.</param>
 /// <param name="notes">Initial value of Notes.</param>
 /// <param name="state">Initial value of State.</param>
 public static NotificationEntity CreateNotificationEntity(int id, global::System.DateTime creationTime, global::System.Guid uuid, string notes, string state)
 {
     NotificationEntity notificationEntity = new NotificationEntity();
     notificationEntity.Id = id;
     notificationEntity.CreationTime = creationTime;
     notificationEntity.Uuid = uuid;
     notificationEntity.Notes = notes;
     notificationEntity.State = state;
     return notificationEntity;
 }