Ejemplo n.º 1
0
 public ICollection <EventDto> FindEventsByKeywordsAndCategory(String name, long categoryId, int startIndex, int count)
 {
     if (cachingProvider.GetItem(name, false) != null)
     {
         ICollection <Event> events = (ICollection <Event>)cachingProvider.GetItem(name, false);
         cachingProvider.AddItem(name, events);
         ICollection <EventDto> eventsDto = new HashSet <EventDto>();
         foreach (Event e in events)
         {
             eventsDto.Add(new EventDto(e));
         }
         return(eventsDto);
     }
     else
     {
         String[]            keywords = name.Split(' ');
         ICollection <Event> events   = EventDao.FindByKeywordsAndCategory(keywords, categoryId, startIndex, count);
         cachingProvider.AddItem(name, events);
         ICollection <EventDto> eventsDto = new HashSet <EventDto>();
         foreach (Event e in events)
         {
             eventsDto.Add(new EventDto(e));
         }
         return(eventsDto);
     }
 }
Ejemplo n.º 2
0
        public EventService(MessageService messageService, EventDao eventDao)
        {
            _messageService = messageService;
            _eventDao       = eventDao;

            Task.Run(async() => await InitAsync());
        }
        public bool SendMail()
        {
            if (mailWindow.Subject.Length == 0)
            {
                mailWindow.Status = "Subject is empty";
                return(false);
            }
            if (mailWindow.MailContent.Length == 0)
            {
                mailWindow.Status = "Content is empty";
                return(false);
            }
            List <CheckInDto> checkInDtos = (List <CheckInDto>)mailWindow.EmailData;

            foreach (CheckInDto checkInDto in checkInDtos)
            {
                try
                {
                    DataEncryption dataEncryption = new DataEncryption(checkInDto.EventAttendeesID.ToString(), null);
                    QRModuleLib.QRModule.CreateQRCode(dataEncryption.OutputCode, checkInDto.EventAttendeesID + ".png", mailWindow.EventId);
                    EmailLibrary.Email.SendEMail(Properties.Resources.email, Properties.Resources.password, checkInDto.Email, mailWindow.Subject, mailWindow.MailContent, mailWindow.EventId + "/" + checkInDto.EventAttendeesID + ".png");
                }
                catch
                {
                    mailWindow.Status = "Something email address is not exits";
                    return(false);
                }
            }
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            eventDao.UpdateStatus(int.Parse(mailWindow.EventId), "sended mail");
            return(true);
        }
Ejemplo n.º 4
0
        // GET: Admin/Event
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new EventDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
Ejemplo n.º 5
0
        public EventService()
        {
            _eventDao = new EventDao();
            _userDao  = new UserDao();

            _seanceDao = new SeanceDao();
            _movieDao  = new MovieDao();
        }
Ejemplo n.º 6
0
        public int CountFindEventsByCategory(long categoryId)
        {
            int    countProducts;
            String keywords = "";

            String[] name = keywords.Split(' ');
            countProducts = EventDao.CountFindEvents(name, categoryId);
            return((int)countProducts);
        }
        public void RemoveEvent()
        {
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            List <EventDto> events = (List <EventDto>)mainWindow.EventData;

            eventDao.DeleteById(events[mainWindow.SelectIndexEvent].Id);
        }
Ejemplo n.º 8
0
        public int CountFindEventsByKeywords(string name)
        {
            int countProducts;

            String[] keywords = name.Split(' ');
            countProducts = EventDao.CountFindEvents(keywords, -1);

            return((int)countProducts);
        }
Ejemplo n.º 9
0
 public void RegisterDaos()
 {
     UserDao      = new UserDao();
     TeamDao      = new TeamDao();
     ClubDao      = new ClubDao();
     NewsDao      = new NewsDao();
     TeamUserDao  = new TeamUserDao();
     EventDao     = new EventDao();
     AttendantDao = new AttendantDao();
 }
Ejemplo n.º 10
0
        public ICollection <EventDto> FindAllEvents()
        {
            ICollection <Event>    events    = EventDao.GetAllElements();
            ICollection <EventDto> eventsDto = new HashSet <EventDto>();

            foreach (Event evento in events)
            {
                eventsDto.Add(new EventDto(evento));
            }
            return(eventsDto);
        }
Ejemplo n.º 11
0
        public ICollection <EventDto> FindEventsByKeywords(String name, int startIndex, int count)
        {
            String[]               keywords  = name.Split(' ');
            ICollection <Event>    events    = EventDao.FindByKeywordsAndCategory(keywords, -1, startIndex, count);
            ICollection <EventDto> eventsDto = new HashSet <EventDto>();

            foreach (Event e in events)
            {
                eventsDto.Add(new EventDto(e));
            }
            return(eventsDto);
        }
Ejemplo n.º 12
0
        public int CountFindEventsByKeywordsAndCategory(string name, long categoryId)
        {
            if (name == null)
            {
                name = "";
            }
            int countProducts;

            String[] keywords = name.Split(' ');
            countProducts = EventDao.CountFindEvents(keywords, categoryId);
            return((int)countProducts);
        }
Ejemplo n.º 13
0
        public ICollection <CommentDto> FindAllComments(long eventId, int startIndex, int count)
        {
            Event myEvent = EventDao.Find(eventId);

            ICollection <Comment>    comments    = CommentDao.FindCommentsOrderByDate(eventId, startIndex, count);
            ICollection <CommentDto> commentsDto = new HashSet <CommentDto>();

            foreach (Comment comment in comments)
            {
                commentsDto.Add(new CommentDto(comment, eventId));
            }
            return(commentsDto);
        }
Ejemplo n.º 14
0
        public IEventCollection GetEventsByCustomerId(string custId)
        {
            IEventCollection result = new EventCollection();

            logger.Info("Getting all events for customer id {0}", custId);
            try
            {
                var result = EventDao.GetEventsForCustId(custId);
            }
            catch (Exception e)
            {
                logger.ErrorFormat("Error while fetching result for customer id {0}", custId);
            }
            return(result);
        }
        public void LoadEvent()
        {
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            mainWindow.EventData = eventDao.ReadData(((App)Application.Current).UserName, mainWindow.SearchEvent);
            List <dynamic> eventShowList = new List <dynamic>();
            int            count         = 1;

            foreach (EventDto eventDto in eventDao.ReadData(((App)Application.Current).UserName, mainWindow.SearchEvent))
            {
                eventShowList.Add(new { NO = count, Name = eventDto.Name, Description = eventDto.Description, Status = eventDto.Status });
                count++;
            }
            mainWindow.DataEvent = eventShowList;
        }
Ejemplo n.º 16
0
 public ActionResult Edit(Event Event)
 {
     if (ModelState.IsValid)
     {
         var dao    = new EventDao();
         var result = dao.Update(Event);
         if (result)
         {
             return(RedirectToAction("Index", "Event"));
         }
         else
         {
             ModelState.AddModelError("", "Modify Event successfully");
         }
     }
     return(View("Index"));
 }
Ejemplo n.º 17
0
 public ActionResult Create(Event Event)
 {
     if (ModelState.IsValid)
     {
         var dao = new EventDao();
         var id  = dao.Insert(Event);
         if (id > 0)
         {
             return(RedirectToAction("Index", "Event"));
         }
         else
         {
             ModelState.AddModelError("", "Add Event successfully");
         }
     }
     return(View("Index"));
 }
        public void SubmitCheckIn()
        {
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            eventDao.UpdateStatus(checkInWindow.EventID, "checked in");
            CheckInDao checkInDao = new CheckInDao();

            checkInDao.MakeConnection(Properties.Resources.strConnection);
            List <CheckInDto> checkInDtos = (List <CheckInDto>)checkInWindow.MemberInEventData;
            List <CheckBox>   checkBoxes  = (List <CheckBox>)checkInWindow.MemberInEventShow;

            foreach (CheckInDto checkInDto in checkInDtos)
            {
                checkInDao.UpdateStatus(checkInDto.EventAttendeesID, (bool)checkBoxes[checkInDtos.IndexOf(checkInDto)].IsChecked);
            }
        }
        public bool UpdateEvent()
        {
            if (detailWindow.DetailName.Length == 0)
            {
                detailWindow.Status = "Event name is empty";
                return(false);
            }
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            EventDto eventDto = new EventDto();

            eventDto.Name        = detailWindow.DetailName;
            eventDto.Description = detailWindow.Desciption;
            eventDto.Id          = detailWindow.Id;
            return(eventDao.Update(eventDto));
        }
Ejemplo n.º 20
0
        public Comment AddComment(string comment, long eventId, long userId)
        {
            Event       e = EventDao.Find(eventId);
            UserProfile u = UserProfileDao.Find(userId);

            Comment c = new Comment();

            c.content     = comment;
            c.Event       = e;
            c.UserProfile = u;
            c.commentDate = DateTime.Now;
            c.Labels      = new List <Label>();
            c.loginName   = u.loginName;
            CommentDao.Create(c);

            return(c);
        }
        public bool AddEvent()
        {
            if (addEventWindow.EventName.Length == 0)
            {
                addEventWindow.Status = "Event name is empty";
                return(false);
            }
            if (addEventWindow.EventName.Length > 50)
            {
                addEventWindow.Status = "Event name have length lower than 50";
                return(false);
            }
            EventDao eventDao = new EventDao();

            eventDao.MakeConnection(Properties.Resources.strConnection);
            if (eventDao.Create(new EventDto(addEventWindow.EventName, addEventWindow.Desciption, "", ((App)Application.Current).UserName)))
            {
                List <CheckBox> groupShowList = (List <CheckBox>)addEventWindow.Group;
                int             index         = 0;
                foreach (CheckBox checkBox in groupShowList)
                {
                    if ((bool)checkBox.IsChecked)
                    {
                        EventAttendeesDao eventAttendeesDao = new EventAttendeesDao();
                        List <GroupDto>   groupDtos         = (List <GroupDto>)addEventWindow.GroupData;
                        eventAttendeesDao.MakeConnection(Properties.Resources.strConnection);
                        List <EventAttendeesDto> eventAttendeesDtos = eventAttendeesDao.ReadData(groupDtos[index].Id, "");
                        foreach (EventAttendeesDto eventAttendeesDto in eventAttendeesDtos)
                        {
                            CheckInDao checkInDao = new CheckInDao();
                            checkInDao.MakeConnection(Properties.Resources.strConnection);
                            CheckInDto checkInDto = new CheckInDto();
                            checkInDto.EventID = eventDao.GetLastId();
                            checkInDto.Name    = eventAttendeesDto.Name;
                            checkInDto.Email   = eventAttendeesDto.Email;
                            checkInDto.Other   = eventAttendeesDto.Other;
                            checkInDao.Create(checkInDto);
                        }
                    }
                    index++;
                }
            }
            return(true);
        }
Ejemplo n.º 22
0
        private static void ResolveForSqlServerCe(IUnityContainer container, string microserviceName, string connectionString)
        {
            Func <bool, EventStoreCeDbContext> storeContextFactory = isReadOnly => new EventStoreCeDbContext(isReadOnly, connectionString);
            Func <bool, EventQueueCeDbContext> queueContextFactory = isReadOnly => new EventQueueCeDbContext(isReadOnly, connectionString);

            var serializer = container.Resolve <ITextSerializer>();
            var time       = container.Resolve <IUtcTimeProvider>();

            var subscriptionRepository = new SubscriptionRepository(storeContextFactory, microserviceName, serializer, time);

            container.RegisterInstance <ISubscriptionRepository>(subscriptionRepository);

            var eventDao = new EventDao(queueContextFactory, microserviceName);

            container.RegisterInstance <IEventDao>(eventDao);

            var eventStore = new EventStore <TStream>(microserviceName, serializer, storeContextFactory, time, container.Resolve <IGuidProvider>(), container.Resolve <ILogger>());

            container.RegisterInstance <IEventStore <TStream> >(eventStore);
        }
Ejemplo n.º 23
0
        public async Task SaveAsync(TAggregate aggregate)
        {
            var         events   = new List <EventDao>();
            SnapshotDao snapshot = null;

            foreach (var domainEvent in aggregate.DomainEvents)
            {
                var @event = new EventDao()
                {
                    AggregateId = aggregate.Id,
                    Aggregate   = typeof(TAggregate).FullName,
                    Version     = aggregate.Version,
                    Data        = domainEvent,
                    CreatedAt   = domainEvent.CreatedAt
                };
                if (aggregate.Version > 0 && aggregate.Version % _settings.SnapshotInterval == 0)
                {
                    snapshot = new SnapshotDao()
                    {
                        AggregateId = aggregate.Id,
                        Version     = aggregate.Version,
                        Data        = aggregate,
                        CreatedAt   = DateTime.UtcNow
                    };
                }
                events.Add(@event);
            }

            await _context.Events.InsertManyAsync(events);

            if (snapshot != null)
            {
                await _context.Snapshots.InsertOneAsync(snapshot);
            }

            foreach (var @event in events)
            {
                await _mediator.Publish(@event.Data);
            }
        }
Ejemplo n.º 24
0
 public void Update(IBaseObject baseObject)
 {
     EventDao.Update(baseObject);
 }
Ejemplo n.º 25
0
        public Event FindEventById(long eventId)
        {
            Event myEvent = EventDao.Find(eventId);

            return(myEvent);
        }
Ejemplo n.º 26
0
 public IBaseObject Read(string id)
 {
     return(EventDao.Read(id));
 }
Ejemplo n.º 27
0
 public void Insert(IBaseObject baseObject)
 {
     EventDao.Insert(baseObject);
 }
Ejemplo n.º 28
0
 public void Delete(string id)
 {
     EventDao.Delete(id);
 }
Ejemplo n.º 29
0
        public static IMicroservice CreateDenormalizer <TDbContext>(
            string uniqueName,
            IUnityContainer container,
            IEventStoreConfig eventStoreConfig,
            Func <IBus, ILogger, IEventStore <TStream>, THandler> processorFactory = null)
            where TDbContext : DbContext, IEventStoreDbContext
        {
            var streamFullName = EnsureStreamCategoryNameIsValid(uniqueName);

            System.Data.Entity.Database.SetInitializer <TDbContext>(null);

            var pollerConfig = PollerConfig.GetConfig();

            var connectionString = eventStoreConfig.ConnectionString;

            AuthorizationFactory.SetToken(eventStoreConfig);

            Func <bool, EventStoreDbContext> storeContextFactory = isReadOnly => new EventStoreDbContext(isReadOnly, connectionString);
            Func <bool, EventQueueDbContext> queueContextFactory = isReadOnly => new EventQueueDbContext(isReadOnly, connectionString);

            var log = container.Resolve <ILogger>();

            var serializer = container.Resolve <ITextSerializer>();
            var time       = container.Resolve <IUtcTimeProvider>();
            var guid       = container.Resolve <IGuidProvider>();

            // Do not know why an Event Dao will need a denormalizer... and a Publisher!
            // The only events that can (and sould) be queries is 'ReadModelUpdated'.
            var eventDao = new EventDao(queueContextFactory, streamFullName);

            var dbContextConstructor = typeof(TDbContext).GetConstructor(new[] { typeof(bool), typeof(string) });

            Ensure.CastIsValid(dbContextConstructor, "Type TDbContext must have a constructor with the following signature: ctor(bool, string)");
            Func <bool, IEventStoreDbContext> dbContextFactory = isReadOnly => (TDbContext)dbContextConstructor.Invoke(new object[] { isReadOnly, connectionString });
            var eventStore = new EventStore <TStream>(streamFullName, serializer, dbContextFactory, time, guid, log);

            container.RegisterInstance <IEventStore <TStream> >(eventStore);

            var bus = new Bus();

            container.RegisterInstance <IBus>(bus);

            var receiver = new LongPoller(bus, log, TimeSpan.FromMilliseconds(pollerConfig.Timeout), streamFullName, container.Resolve <IInMemoryEventPublisher>());

            var subscriptionRepository = new SubscriptionRepository(storeContextFactory, streamFullName, serializer, time);

            var poller = new Poller(bus, log, subscriptionRepository, receiver, serializer, pollerConfig.BufferQueueMaxCount, pollerConfig.EventsToFlushMaxCount);

            container.RegisterInstance <IMonitoredSubscriber>(poller);

            var publisher = new Publisher(streamFullName, bus, log, eventDao, eventStoreConfig.PushMaxCount, TimeSpan.FromMilliseconds(eventStoreConfig.LongPollingTimeout));

            container.RegisterInstance <IPollableEventSource>(publisher);

            var fsm = new MicroserviceHost(streamFullName, bus, log, true);

            container.RegisterInstance <IMicroservice>(fsm);

            if (processorFactory == null)
            {
                var processorConstructor = typeof(THandler).GetConstructor(new[] { typeof(IBus), typeof(ILogger), typeof(IEventStore <TStream>) });
                Ensure.CastIsValid(processorConstructor, "Type THandler must have a valid constructor with the following signature: .ctor(IBus, ILogger, IEventStore<T>)");
                var processor = (THandler)processorConstructor.Invoke(new object[] { bus, log, eventStore });
            }
            else
            {
                var processor = processorFactory.Invoke(bus, log, eventStore);
            }

            var heartbeatEmitter = new HeartbeatEmitter(fsm, log, poller);

            container.RegisterInstance <HeartbeatEmitter>(heartbeatEmitter);

            return(fsm);
        }
Ejemplo n.º 30
0
        public ActionResult Edit(int id)
        {
            var Event = new EventDao().ViewDetail(id);

            return(View(Event));
        }