Ejemplo n.º 1
0
        public void SendNotificationMessage(int Id, ActivityTypeContants ActivityType, DocNotificationContent DocNotificationContentSettings, string NotificationCreatedBy)
        {
            if (DocNotificationContentSettings != null)
            {
                if (DocNotificationContentSettings.ProcNotificationContent != null && DocNotificationContentSettings.ProcNotificationContent != "")
                {
                    SqlParameter SqlParameterId = new SqlParameter("@Id", Id);

                    IEnumerable <NotificationContentViewModel> NotificationContent = db.Database.SqlQuery <NotificationContentViewModel>("" + ConfigurationManager.AppSettings["DataBaseSchema"] + "." + DocNotificationContentSettings.ProcNotificationContent + " @Id", SqlParameterId);

                    foreach (NotificationContentViewModel item in NotificationContent)
                    {
                        Notification Note = new Notification();
                        Note.NotificationSubjectId = item.NotificationSubjectId;
                        Note.NotificationText      = item.NotificationText;
                        Note.NotificationUrl       = item.NotificationUrl;
                        Note.UrlKey       = item.UrlKey;
                        Note.ExpiryDate   = item.ExpiryDate;
                        Note.IsActive     = true;
                        Note.CreatedBy    = NotificationCreatedBy;
                        Note.ModifiedBy   = NotificationCreatedBy;
                        Note.CreatedDate  = DateTime.Now;
                        Note.ModifiedDate = DateTime.Now;
                        //new NotificationService(_unitOfWork).Create(Note);

                        string[] UserNameArr = item.UserNameList.Split(',');

                        foreach (string UserName in UserNameArr)
                        {
                            NotificationUser NoteUser = new NotificationUser();
                            NoteUser.NotificationId = Note.NotificationId;
                            NoteUser.UserName       = UserName;
                            new NotificationUserService(_unitOfWork).Create(NoteUser);
                        }
                    }
                }
            }
        }
 public DocNotificationContent Add(DocNotificationContent pt)
 {
     _unitOfWork.Repository <DocNotificationContent>().Insert(pt);
     return(pt);
 }
 public void Delete(DocNotificationContent pt)
 {
     _unitOfWork.Repository <DocNotificationContent>().Delete(pt);
 }
 public void Update(DocNotificationContent pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <DocNotificationContent>().Update(pt);
 }
 public DocNotificationContent Create(DocNotificationContent pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <DocNotificationContent>().Insert(pt);
     return(pt);
 }