Example #1
0
        public void InitData()
        {
            var cost            = new Cost();
            var paymentCurrency = new Currency();
            var project         = new Project();

            var agency  = new Agency();
            var country = new Country();
            var owner   = new CostOwner();
            var notificationSubscribers = new NotificationSubscriber();
            var userBusinessRoles       = new List <UserBusinessRole>();


            var costStages               = new List <CostStage>();
            var costStageRevisions       = new List <CostStageRevision>();
            var selectRevisionTravelCost = new TravelCost();
            var oeRevisionTravelCost     = new TravelCost();
            var region              = new Region();
            var payments            = new List <CostStageRevisionPaymentTotal>();
            var cli                 = new List <CostLineItem>();
            var stageDetails        = new CustomObjectData();
            var productionDetails   = new CustomObjectData();
            var supportingDocuments = new List <SupportingDocument>();
            var lstObjectData       = new List <CustomObjectData>();
            var costFormDetails     = new List <CostFormDetails>();
            var customFormData      = new CustomFormData();
            var approvals           = new List <Approval>();
            var approvalMembers     = new List <ApprovalMember>();
        }
Example #2
0
 public PublisherTests()
 {
     ProxyMarketContext.Instance.marketTearDown();
     this.publisher  = new Publisher("UserTests");
     this.user       = new User("UserTests");
     this.subscriber = new NotificationSubscriber(user.Username, true);
 }
Example #3
0
        public Notification NotifyCannedEmail(string notificationTypeAlias, Email fromEmail, string toEmail, string subjectText, string bodyText, long userId, long requestedBy, string source, string notes = null, int priority = 0, DateTime?notificationDate = null)
        {
            NotificationType notificationType = _notificationTypeRepository.GetByAlias(notificationTypeAlias);

            if (!notificationType.IsQueuingEnabled)
            {
                return(null);
            }

            if (fromEmail == null || string.IsNullOrEmpty(fromEmail.ToString()))
            {
                fromEmail = _settings.EmailNotificationIssuedFrom;
            }

            string fromName = _settings.NameNotificationissuedFrom;

            var formatMessage = new EmailMessage
            {
                Body      = bodyText,
                Subject   = subjectText,
                ToEmail   = toEmail,
                FromEmail = fromEmail.ToString(),
                FromName  = fromName
            };
            var notificationSubscriber = new NotificationSubscriber(userId)
            {
                Email = new Email(toEmail),
            };
            var notificationEmail = _notificationEmailFactory.CreateNotificationEmail(notificationType, notificationSubscriber, fromEmail,
                                                                                      fromName, formatMessage, source, notes, priority, requestedBy, userId);

            var notification = _notificationRepository.Save(notificationEmail);

            return(notification);
        }
Example #4
0
        public async Task TestRequestPurcahse()
        {
            NotificationSubscriber subscriber = PublisherManagement.Instance.FindSubscriber(owner.Username, EventType.RequestPurchaseEvent);

            subscriber.TestMode = true;
            int originMessages = subscriber.Messages.Count;

            Assert.AreEqual(originMessages, subscriber.Messages.Count);
            await marketBids.OwnerChangeBidPolicy(owner.Username, store.Id, true);

            await marketBids.CustomerCreateBid(customer.Username, store.Id, product.Id, BID_PRICE);

            Assert.AreEqual(originMessages + 1, subscriber.Messages.Count);
        }
Example #5
0
        private IEnumerable <NotificationSubscriber> GetEmailNotificationSubscribers(string[] emails, long userId)
        {
            var subscribers = new NotificationSubscriber[emails.Length];
            int index       = 0;

            foreach (var email in emails)
            {
                subscribers[index++] = new NotificationSubscriber(userId)
                {
                    Email = new Email(email)
                };
            }

            return(subscribers);
        }
        public async Task CheckLoggedInUserNotifyPurchase()
        {
            founderUser.IsLoggedIn = true;
            Product p = new Product(new Guid(), 100, 100, 100);

            store.UpdateProduct(p);
            marketStores.LoadedStores.TryAdd(store.Id, store);
            await marketUsers.AddProductToCart(user.Username, p.Id, 5);

            NotificationSubscriber subscriber = PublisherManagement.Instance.FindSubscriber(founder.Username, EventType.PurchaseEvent);
            var pub = PublisherManagement.Instance.FindPublisher(founder.Username);

            pub.LoggedIn = true;
            Assert.AreEqual(0, subscriber.Messages.Count);
            await marketUsers.PurchaseShoppingCart(user.Username, new CreditCard("1", "1", "1", "1", "1", "1"), "054444444", new Address("1", "1", "1", "1", "1"));

            Assert.AreEqual(1, subscriber.Messages.Count);
        }
Example #7
0
        public static void Main(string[] args)
        {
            var fbObservable     = new NotificationProvider("Facebook");
            var githubObservable = new NotificationProvider("GitHub");

            var observer = new NotificationSubscriber("Florin");

            observer.Subscribe(fbObservable);
            //observer.Unsubscribe();

            observer.Subscribe(githubObservable);
            //observer.Unsubscribe();

            var observer2 = new NotificationSubscriber("Piagio");

            observer2.Subscribe(fbObservable);

            fbObservable.EventNotification("Event notification 1 !");
            githubObservable.EventNotification("Event notification!");
        }
        public async Task CheckNotLoggedInUserStoreNotificationsPurchase()
        {
            var dataUser = new DataUser(founderUser.Username, "", new Address("1", "1", "1", "1", "1"), "054444444");

            dataUser.IsLoggedin = false;
            await ProxyMarketContext.Instance.GetDataUser(founder.Username);

            //UserManagement.Instance.DataUsers[founder.Username] = dataUser;
            Product p = new Product(new Guid(), 100, 100, 100);

            store.UpdateProduct(p);
            marketStores.LoadedStores.TryAdd(store.Id, store);
            await marketUsers.AddProductToCart(user.Username, p.Id, 5);

            NotificationSubscriber subscriber = PublisherManagement.Instance.FindSubscriber(founder.Username, EventType.PurchaseEvent);

            Assert.AreEqual(0, subscriber.Messages.Count);
            Assert.AreEqual(0, PublisherManagement.Instance.FindPublisher(founder.Username).Waiting.Count);
            await marketUsers.PurchaseShoppingCart(user.Username, new CreditCard("1", "1", "1", "1", "1", "1"), "054444444", new Address("1", "1", "1", "1", "1"));

            Assert.AreEqual(0, subscriber.Messages.Count);
            Assert.AreEqual(1, PublisherManagement.Instance.FindPublisher(founder.Username).Waiting.Count);
        }
Example #9
0
 public void Delete(NotificationSubscriber item)
 {
     new NotificationSubscriberRepository().Delete(item);
 }
Example #10
0
 public NotificationSubscriber Save(NotificationSubscriber item)
 {
     return(new NotificationSubscriberRepository().SaveOrUpdate(item));
 }
Example #11
0
        public NotificationPhone CreateSmsNotification(NotificationType notificationType, NotificationSubscriber notificationSubscriber, EmailMessage formatMessage, string source, long userId, long requestedBy)
        {
            var notificationMediumList = _notificationMediumRepository.GetAll();
            var smsNotificationMedium  = notificationMediumList.Single(s => s.Medium == NotificationMediumType.SmsNotification);

            return(new NotificationPhone
            {
                Message = formatMessage.Body,
                DateCreated = _calendar.Now,
                NotificationMedium = smsNotificationMedium,
                UserId = userId,
                Priority = 0,
                NotificationDate = _calendar.Now,
                NotificationType = notificationType,
                PhoneCell = notificationSubscriber.CellNumber,
                ServiceStatus = NotificationServiceStatus.Unserviced,
                RequestedBy = requestedBy,
                Source = source,
                Notes = source
            });
        }
Example #12
0
        public NotificationEmail CreateNotificationEmail(NotificationType notificationType, NotificationSubscriber notificationSubscriber, Email fromEmail, string fromName, EmailMessage formatMessage, string source, string notes, int priority, long requestedBy, long userId, DateTime notificatonDate) // Need to Use dateTimeCalendar
        {
            var notificationMediumList  = _notificationMediumRepository.GetAll();
            var emailNotificationMedium = notificationMediumList.Single(s => s.Medium == NotificationMediumType.EmailNotification);

            return(new NotificationEmail
            {
                Body = formatMessage.Body,
                Subject = formatMessage.Subject,
                ToEmail = notificationSubscriber.Email,
                FromEmail = fromEmail,
                FromName = fromName,
                Source = source,
                Notes = notes,
                DateCreated = _calendar.Now,
                Priority = priority,
                ServiceStatus = NotificationServiceStatus.Unserviced,
                NotificationType = notificationType,
                NotificationMedium = emailNotificationMedium,
                RequestedBy = requestedBy,
                NotificationDate = notificatonDate,
                UserId = userId
            });
        }