示例#1
0
 public FolderModel(ApplicationDbContext context, IMapper mapper, OgmaConfig config, ClubRepository clubRepo)
 {
     _context  = context;
     _mapper   = mapper;
     _config   = config;
     _clubRepo = clubRepo;
 }
        private async Task <(string userId, ClubResource addedClub1, ClubResource addedClub2)> SetUpPostFeed(
            ClubSystemDbContext dbContext)
        {
            var clubRepository = new ClubRepository(dbContext);

            var clubDto1 = new ClubDto {
                Name = "Name1", UniversityName = "University1"
            };
            var clubDto2 = new ClubDto {
                Name = "Name2", UniversityName = "University2"
            };
            var          addedClub1 = clubRepository.AddClub(clubDto1);
            var          addedClub2 = clubRepository.AddClub(clubDto2);
            const string userId     = "1234";

            var claimsPrincipal = GenerateClaimsPrincipalWithId(userId);

            var addUserToClubDto1 = new AddUserToClubDto {
                ClubId = addedClub1.Id
            };
            var addUserToClubDto2 = new AddUserToClubDto {
                ClubId = addedClub2.Id
            };
            await clubRepository.AddUserToClub(addUserToClubDto1, claimsPrincipal);

            await clubRepository.AddUserToClub(addUserToClubDto2, claimsPrincipal);

            return(userId, addedClub1, addedClub2);
        }
示例#3
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        Club club = ClubRepository.FindById(DataUtility.ParseInt(QsClubId));

        ClubRepository.Delete(club);
        Response.Redirect(Cancel.NavigateUrl);
    }
示例#4
0
 public FolderModel(ClubRepository clubRepo, FoldersRepository foldersRepo, OgmaConfig config, StoriesRepository storiesRepo)
 {
     _clubRepo    = clubRepo;
     _foldersRepo = foldersRepo;
     _config      = config;
     _storiesRepo = storiesRepo;
 }
示例#5
0
        public async Task ClubServiceAircrafFlightTest()
        {
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                cr       = new ClubRepository(_context);
                AircraftLogBookRepository acr = new AircraftLogBookRepository(_context);
                FlightRepository          fr  = new FlightRepository(_context);
                MemberRepository          mr  = new MemberRepository(_context);
                AircraftRepository        ar  = new AircraftRepository(_context);
                ClubService clubService       = new ClubService(cr, mr, fr, ar, acr, null);
                int         aircraftId        = 8;

                ICollection <Flight> flights = await clubService.GetClubAircraftFlight("BAZ", aircraftId);

                var group = flights.GroupBy(o => o.Pilot);
                foreach (var g in group)
                {
                    System.Diagnostics.Debug.WriteLine(g.FirstOrDefault()?.Pilot?.FirstName);
                    foreach (var gi in g)
                    {
                        System.Diagnostics.Debug.WriteLine(gi.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
示例#6
0
        public GameProcessService(BulkaContext context)
        {
            _gameProcessRepository = new GameProcessRepository(context);
            _playersRepository     = new PlayersRepository(context);
            _clubRepository        = new ClubRepository(context);

            PaymentService       = new PaymentService(new PaymentRepository(context));
            PlayerSessionService = new PlayerSessionService(context);

            DateTime = DateTime.Now;
        }
 public ViewResult AddClub(ClubResponse clubResponse)
 {
     if (ModelState.IsValid)
     {
         ClubRepository.AddResponse(clubResponse);
         return(View("Clubs", ClubRepository.ClubResponse));
     }
     else
     {
         return(View());
     }
 }
示例#8
0
 public ViewResult AddClub(Club club)
 {
     if (ModelState.IsValid)
     {
         ClubRepository.addClub(club);
         return(View("ListClubs", ClubRepository.Clubs));
     }
     else
     {
         return(View());
     }
 }
示例#9
0
        public IList <Club> FindInBounds(double swLatitude, double swLongitude, double neLatitude, double neLongitude)
        {
            bool hasSw = swLatitude != 0D || swLongitude != 0D;
            bool hasNe = neLatitude != 0D || neLongitude != 0D;

            if (hasSw && hasNe)
            {
                return(ClubRepository.FindInBounds(new GeoPoint(swLatitude, swLongitude),
                                                   new GeoPoint(neLatitude, neLongitude)));
            }

            throw Error.RcMapClubService_MustSpecifySeAndNePoint();
        }
        public async Task ClubContactsViewModelServiceTest()
        {
            autoMapper = AutoMapperConstructor.Instance.Mapper;
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                MemberRepository mr = new MemberRepository(_context);
                MemberService    ms = new MemberService(mr);
                FlightRepository fr = new FlightRepository(_context);

                ClubRepository cr = new ClubRepository(_context);

                ClubService clubService = new ClubService(cr, mr, fr, null, null, null);
                //ICollection<Pilot> clubBaz = await clubService.GetClubMembers("BAZ");

                autoMapper = AutoMapperConstructor.Instance.Mapper;

                ClubContactsViewModelService clubContactsViewModelService = new ClubContactsViewModelService(clubService, ms, autoMapper);
                //IEnumerable<ClubContactsViewModel> clubContacs = await  clubContactsViewModelService.GetOrCreateClubContact("Baz");
                //cl.Members = members;
                //var p = clubContacs.Where(i => i.IdNumber == "059828392").FirstOrDefault();
                ClubContactsModel clubContactUpdate = new ClubContactsModel();
                Contact           contact           = new Contact();
                contact.Addresses.Add(new Address()
                {
                    City = "Gilon", Country = "Israel", State = "IL", Zipcode = "2010300", Street = "Ofir 60", Type = ContactType.HOME
                });

                contact.EMAILs.Add(new EMAIL()
                {
                    EMail = "*****@*****.**", Type = ContactType.WORK
                });
                contact.Phones.Add(new Phone()
                {
                    PhoneNumber = "05490777553", Type = ContactType.HOME
                });
                clubContactUpdate.DateOfBirth = DateTime.Now;

                //var members = await clubService.GetClubMembers("BAZ");
                await clubContactsViewModelService.UpdateOrCreateClubContactMember("BAZ", clubContactUpdate);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            return;
        }
 public Importer(GetOldDbAsModel getOldDbAsModel, 
     CompanyRepository companyRepository,
     PersonRepository personRepository,
     PoliticianRepository politicianRepository,
     ClubRepository clubRepository,
     TruncateTable truncateTable)
 {
     _getOldDbAsModel = getOldDbAsModel;
     _companyRepository = companyRepository;
     _personRepository = personRepository;
     _politicianRepository = politicianRepository;
     _clubRepository = clubRepository;
     _truncateTable = truncateTable;
 }
示例#12
0
        public void DeleteClub(UpdateClubCommand deletedClubCommand, int id)
        {
            var repo = new ClubRepository();

            var deletedClub = new Club
            {
                Name        = deletedClubCommand.Name,
                Address     = deletedClubCommand.Address,
                Phone       = deletedClubCommand.Phone,
                Capacity    = deletedClubCommand.Capacity,
                Description = deletedClubCommand.Description
            };

            repo.DeleteClub(deletedClub, id);
        }
示例#13
0
        public void UpdateClub(UpdateClubCommand updatedClubCommand, int id)
        {
            var repo = new ClubRepository();

            var updatedClub = new Club
            {
                Name        = updatedClubCommand.Name,
                Address     = updatedClubCommand.Address,
                Phone       = updatedClubCommand.Phone,
                Capacity    = updatedClubCommand.Capacity,
                Description = updatedClubCommand.Description
            };

            repo.UpdateClub(updatedClub, id);
        }
示例#14
0
    protected void WriteClubs(HtmlTextWriter output)
    {
        Region       currentRegion = null;
        IList <Club> clubs         = ClubRepository.CreateQuery(
            "from Club c order by c.Address.Region.Name, c.Name"
            ).List <Club>();

        output.RenderBeginTag(HtmlTextWriterTag.Dl);
        foreach (Club club in clubs)
        {
            if (club.Address.Region != currentRegion)
            {
                if (currentRegion != null)
                {
                    // Render the end of the DD and UL tags.
                    output.RenderEndTag();
                    output.RenderEndTag();
                }
                currentRegion = club.Address.Region;
                output.RenderBeginTag(HtmlTextWriterTag.Dt);
                output.AddAttribute(HtmlTextWriterAttribute.Href,
                                    ResolveClientUrl("~" + UrlUtility.For(currentRegion)));
                output.AddAttribute(HtmlTextWriterAttribute.Title, string.Format(
                                        "View RC clubs in the {0} area on the map", currentRegion.Name));
                output.RenderBeginTag(HtmlTextWriterTag.A);
                output.WriteEncodedText(currentRegion.Name);
                output.RenderEndTag();
                output.RenderEndTag();
                output.RenderBeginTag(HtmlTextWriterTag.Dd);
                output.RenderBeginTag(HtmlTextWriterTag.Ul);
            }
            output.RenderBeginTag(HtmlTextWriterTag.Li);
            output.AddAttribute(HtmlTextWriterAttribute.Href, ResolveClientUrl("~" + UrlUtility.For(club)));
            output.AddAttribute(HtmlTextWriterAttribute.Title, string.Format(
                                    "Go to {0} on the map", club.Name));
            output.RenderBeginTag(HtmlTextWriterTag.A);
            output.WriteEncodedText(club.Name);
            output.RenderEndTag();
            output.RenderEndTag();
        }
        // Render the end of the DD and UL tags.
        output.RenderEndTag();
        output.RenderEndTag();
        // Render the end of the DL list.
        output.RenderEndTag();
    }
示例#15
0
        public async Task ClubServiceTest()
        {
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                cr       = new ClubRepository(_context);

                ClubService         clubService = new ClubService(cr);
                ICollection <Pilot> clubBaz     = await clubService.GetClubMembers("BAZ");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
示例#16
0
        public async Task RepositoryClubAircrafFlightTest()
        {
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                cr       = new ClubRepository(_context);
                AircraftLogBookRepository acr             = new AircraftLogBookRepository(_context);
                FlightRepository          fr              = new FlightRepository(_context);
                MemberRepository          mr              = new MemberRepository(_context);
                ClubRepository            _clubRepository = new ClubRepository(_context);
                AircraftRepository        ar              = new AircraftRepository(_context);
                ClubService clubService = new ClubService(cr, mr, fr, ar, acr, null);
                int         aircraftId  = 8;
                var         clubSpec    = new ClubWithSpecification("BAZ", false, true);

                var club = (await _clubRepository.ListAsync(clubSpec));
                FlighWithSpecification flightPagingSpec = new FlighWithSpecification(0, 10, 8, 14);
                FlighWithSpecification flightSpec       = new FlighWithSpecification(8, 14);

                var flight = await fr.ListAsync(flightPagingSpec);

                var flightCount = await fr.CountAsync(flightSpec);

                ICollection <Flight> flights = await clubService.GetClubAircraftFlight("BAZ", aircraftId);

                var group = flights.GroupBy(o => o.Pilot);
                foreach (var g in group)
                {
                    System.Diagnostics.Debug.WriteLine(g.FirstOrDefault()?.Pilot?.FirstName);
                    foreach (var gi in g)
                    {
                        System.Diagnostics.Debug.WriteLine(gi.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
示例#17
0
        public IList <Club> Search(double latitude, double longitude, int radius, int[] categories)
        {
            bool hasPoint = latitude != 0D || longitude != 0D;
            bool hasCat   = categories != null && categories.Length > 0;

            if (hasPoint && hasCat)
            {
                return(ClubRepository.FindNearbyInCategory(new GeoPoint(latitude, longitude), radius, categories));
            }
            if (hasPoint && !hasCat)
            {
                return(ClubRepository.FindNearby(new GeoPoint(latitude, longitude), radius));
            }
            if (!hasPoint && hasCat)
            {
                return(ClubRepository.FindInCategory(categories));
            }

            throw Error.RcMapClubService_MustSpecifyPointOrCategory();
        }
示例#18
0
        public async Task ClubServiceAircrafTest()
        {
            ImportDataTest import = new ImportDataTest();

            import.InitContext();
            try
            {
                _context = import._context;
                cr       = new ClubRepository(_context);
                ClubService            clubService = new ClubService(cr);
                ICollection <Aircraft> aircraft    = await clubService.GetClubAircraft("BAZ");

                foreach (var ar in aircraft)
                {
                    System.Diagnostics.Debug.WriteLine(ar.ToString());
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
示例#19
0
    protected void Submit_Click(object sender, EventArgs e)
    {
        if (!IsValid)
        {
            return;
        }

        Club club;

        if (Submit.CommandName == CMD_UPDATE)
        {
            club = ClubRepository.FindById(DataUtility.ParseInt(QsClubId));
            PopulateClubFromControls(club);
            ClubRepository.Update(club);
        }
        else if (Submit.CommandName == CMD_INSERT)
        {
            club = new Club();
            PopulateClubFromControls(club);
            ClubRepository.Save(club);
        }
        Response.Redirect(Cancel.NavigateUrl);
    }
示例#20
0
 public DetailsModel(ClubRepository clubRepo, ApplicationDbContext context)
 {
     _clubRepo = clubRepo;
     _context  = context;
 }
示例#21
0
 public DetailsModel(ClubRepository clubRepo, ThreadRepository threadRepo)
 {
     _clubRepo   = clubRepo;
     _threadRepo = threadRepo;
 }
示例#22
0
 public Members(ClubRepository clubRepo, ApplicationDbContext context, IMapper mapper)
 {
     _clubRepo = clubRepo;
     _context  = context;
     _mapper   = mapper;
 }
示例#23
0
 public ClubsController(ClubRepository repository)
 {
     this.clubRepository = repository;
 }
示例#24
0
 public ClubsController(ClubRepository clubRepo, ApplicationDbContext context)
 {
     _clubRepo = clubRepo;
     _context  = context;
 }
示例#25
0
 public CachedClubRepository()
 {
     _clubRepository = new ClubRepository();
     _clubs          = new Dictionary <DateTime, Club>();
 }
示例#26
0
 public IList <Club> FindByCountry(int countryId)
 {
     return(ClubRepository.FindByCountry(countryId));
 }
 public SearchClubController(ClubRepository clubRepository, 
     SessionSearch sessionSearch)
 {
     _clubRepository = clubRepository;
     _sessionSearch = sessionSearch;
 }
示例#28
0
 public IList <Club> FindByRegion(int regionId)
 {
     return(ClubRepository.FindByRegion(regionId));
 }
示例#29
0
 public ClubsController(ClubRepository clubRepo)
 {
     _clubRepo = clubRepo;
 }
示例#30
0
 private void LoadEditMode()
 {
     PopulateControlsFromClub(ClubRepository.FindById(DataUtility.ParseInt(QsClubId)));
     Submit.CommandName = CMD_UPDATE;
     Submit.Text        = "Save";
 }
示例#31
0
 public ClubController()
 {
     this.clubRepository = new ClubRepository();
 }
示例#32
0
 public IndexModel(ApplicationDbContext context, ClubRepository clubRepo)
 {
     _context  = context;
     _clubRepo = clubRepo;
 }