public ActionResult About()
        {
            ViewBag.CacheSize       = ContactMap.GetMap().Result.Count();
            ViewBag.LastRefreshtime = ContactMap.GetLastRefreshTime().Result.ToLocalTime();

            return(View());
        }
Example #2
0
 /// <summary>
 /// Constructor for the <c>FieldScanner</c> object. This is
 /// used to perform a scan on the specified class in order to find
 /// all fields that are labeled with an XML annotation.
 /// </summary>
 /// <param name="type">
 /// this is the schema class that is to be scanned
 /// </param>
 /// <param name="access">
 /// this is the access type for the class
 /// </param>
 public FieldScanner(Class type, DefaultType access) {
    this.factory = new AnnotationFactory();
    this.hierarchy = new Hierarchy(type);
    this.done = new ContactMap();
    this.access = access;
    this.Scan(type);
 }
Example #3
0
 /// <summary>
 /// Constructor for the <c>FieldScanner</c> object. This is
 /// used to perform a scan on the specified class in order to find
 /// all fields that are labeled with an XML annotation.
 /// </summary>
 /// <param name="type">
 /// this is the schema class that is to be scanned
 /// </param>
 /// <param name="access">
 /// this is the access type for the class
 /// </param>
 public FieldScanner(Class type, DefaultType access)
 {
     this.factory   = new AnnotationFactory();
     this.hierarchy = new Hierarchy(type);
     this.done      = new ContactMap();
     this.access    = access;
     this.Scan(type);
 }
        private OrganisationUserMap MakeTestOrganisationUserMap()
        {
            var addressMapper = new AddressMap();
            var contactMapper = new ContactMap();
            var userMapper    = new UserMap();
            var orgMapper     = new OrganisationMap(addressMapper, contactMapper);

            return(new OrganisationUserMap(orgMapper, userMapper));
        }
Example #5
0
        /// <summary>
        /// GET: Correspondence/Search
        /// </summary>
        /// <returns>The search screen</returns>
        public async Task <ActionResult> Search()
        {
            IEnumerable <string> samples = await ContactMap.GetSampleUsers();

            if (samples != null && samples.Count() > 0)
            {
                string sample = samples.ElementAt((int)(DateTimeOffset.Now.Ticks % samples.Count()));
                ViewBag.SearchSuggestions += string.Format("Try {0}", sample);
                ViewBag.SampleUser         = sample;
            }
            else
            {
                ViewBag.SearchSuggestions = "Data extraction pipeline is running... Please wait!";
                ViewBag.SampleUser        = null;
            }

            return(View());
        }
        public async Task GetContactPersonByOrganisationIdHandler_RequestContactPerson_ReturnsContactPerson()
        {
            var organisations = MakeOrganisation();

            var context = A.Fake<WeeeContext>();
            var contactMapper = new ContactMap();

            A.CallTo(() => context.Organisations).Returns(organisations);

            var authorization = AuthorizationBuilder.CreateUserAllowedToAccessOrganisation();

            var handler = new GetContactPersonByOrganisationIdHandler(authorization, context, contactMapper);

            var contactPerson =
                await handler.HandleAsync(new GetContactPersonByOrganisationId(organisations.FirstOrDefault().Id));

            Assert.NotNull(contactPerson);
            Assert.Equal(organisations.FirstOrDefault().Contact.FirstName, contactPerson.FirstName);
            Assert.Equal(organisations.FirstOrDefault().Contact.LastName, contactPerson.LastName);
            Assert.Equal(organisations.FirstOrDefault().Contact.Position, contactPerson.Position);
        }
Example #7
0
        /// <summary>
        /// Get the e-mail address and degree of interaction of all people who interact with a given e-mail address
        /// </summary>
        /// <param name="eMail">The e-mail you can to find who are interacting with</param>
        /// <returns>e-mail and degree of interaction for the people who interact with the given e-mail</returns>
        protected async Task <IEnumerable <Correspondence> > GetResults(string eMail)
        {
            Dictionary <string, List <UserScore> > map = await ContactMap.GetMap();

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

            List <UserScore> userScoreList = null;

            map.TryGetValue(eMail, out userScoreList);

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

            IEnumerable <Correspondence> result =
                (from e in userScoreList
                 select new Correspondence(e.User, e.Score)).OrderByDescending(o => o.Closeness).Take(5);

            return(result);
        }
 public ContactMapTests()
 {
     contactMap = new ContactMap();
 }
 private OrganisationUserMap MakeTestOrganisationUserMap()
 {
     var addressMapper = new AddressMap();
     var contactMapper = new ContactMap();
     var userMapper = new UserMap();
     var orgMapper = new OrganisationMap(addressMapper, contactMapper);
     return new OrganisationUserMap(orgMapper, userMapper);
 }
Example #10
0
 public ContactMapTests()
 {
     contactMap = new ContactMap();
 }
 public void Configuration(IAppBuilder app)
 {
     ConfigureAuth(app);
     ContactMap.Initialize();
 }