Example #1
0
        public Lane GetBowlingCenterLane(string id, string bowlingid, string laneid)
        {
            logger.Debug(Settings.MethodName());

            if (isCorrectUser(id))
            {
                S_BowlingCenter bowlingCenter = BowlingCenterManager.GetBowlingCenterById(long.Parse(bowlingid));

                if (bowlingCenter != null && laneid != null)
                {
                    try
                    {
                        int laneID = int.Parse(laneid);

                        if (laneID <= bowlingCenter.numberOfLanes)
                        {
                            Lane lane = new Lane();
                            lane.lanenr = laneID;

                            return(lane);
                        }
                    }
                    catch
                    {
                    }
                }
            }

            return(null);
        }
Example #2
0
        private void buildCompetitions(S_User user)
        {
            List <S_Competition> competitions = CompetitionManager.GetCompetitionsByPlayer(user.id);


            _competitions  = "<div class='col-lg-8 col-lg-offset-2'>";
            _competitions += "  <h2>Jouw Competities</h2>";
            if (competitions.Count() > 0)
            {
                foreach (S_Competition competition in competitions)
                {
                    S_Challenge challenge = ChallengeManager.GetChallenge(competition.challengeid);
                    List <S_CompetitonBowlingcenter> competitonBowlingcenters = CompetitionManager.GetBowlingcentersByCompetition(competition.id);

                    _competitions += "  <h3>" + challenge.name + "</h3>";
                    _competitions += " <p> Van " + competition.startdate.ToString("dd-MM-yyyy") + " tot " + competition.enddate.ToString("dd-MM-yyyy") + " bij de volgende bowlingcentra: ";

                    foreach (S_CompetitonBowlingcenter competitonBowlingcenter in competitonBowlingcenters)
                    {
                        S_BowlingCenter bowlingCenter = BowlingCenterManager.GetBowlingCenterById(competitonBowlingcenter.bowlingcenterid);
                        _competitions += "<br/><br/>" + bowlingCenter.name;
                    }

                    _competitions += "</p>";
                }
            }
            else
            {
                _competitions += "  <p>Je doet nog niet mee aan een competitie</p>";
            }
            _competitions += "</div>";
        }
Example #3
0
        public Lane[] GetBowlingCenterLanes(string id, string bowlingid)
        {
            logger.Debug(Settings.MethodName());

            if (isCorrectUser(id))
            {
                long bowlingCenterID = 0;
                long.TryParse(bowlingid, out bowlingCenterID);

                S_BowlingCenter bowlingCenter = BowlingCenterManager.GetBowlingCenterById(bowlingCenterID);

                if (bowlingCenter != null && bowlingCenter.numberOfLanes != null)
                {
                    Lane[] lanes = new Lane[(int)bowlingCenter.numberOfLanes];

                    for (int laneIndex = 1; laneIndex <= bowlingCenter.numberOfLanes; laneIndex++)
                    {
                        lanes[laneIndex - 1]        = new Lane();
                        lanes[laneIndex - 1].lanenr = laneIndex;
                    }
                    return(lanes);
                }
            }

            return(null);
        }
        public ActionResult Edit(long id)
        {
            S_BowlingCenter  bowlingcenter    = BowlingCenterManager.GetBowlingCenterById(id);
            BowlinghuisModel bowlinghuisModel = new BowlinghuisModel();

            bowlinghuisModel.Id            = bowlingcenter.id;
            bowlinghuisModel.Name          = bowlingcenter.name;
            bowlinghuisModel.Address       = bowlingcenter.address;
            bowlinghuisModel.ApiVersion    = bowlingcenter.APIversion;
            bowlinghuisModel.Appname       = bowlingcenter.appname;
            bowlinghuisModel.Secretkey     = bowlingcenter.secretkey;
            bowlinghuisModel.City          = bowlingcenter.city;
            bowlinghuisModel.Email         = bowlingcenter.email;
            bowlinghuisModel.LastSyncDate  = bowlingcenter.lastSyncDate.Value;
            bowlinghuisModel.NumberOfLanes = bowlingcenter.numberOfLanes.Value;
            bowlinghuisModel.Phonenumber   = bowlingcenter.phonenumber;
            bowlinghuisModel.Port          = bowlingcenter.centerId.Value;
            bowlinghuisModel.Uri           = bowlingcenter.uri;
            bowlinghuisModel.UrlLogo       = bowlingcenter.logo;
            bowlinghuisModel.Website       = bowlingcenter.website;
            bowlinghuisModel.ZipCode       = bowlingcenter.zipcode;

            SelectListItem selectListItem = new SelectListItem();

            selectListItem.Value = "1.00.00";
            selectListItem.Text  = "1.00.00";

            bowlinghuisModel.ApiVersions = new Collection <SelectListItem>()
            {
                selectListItem
            };
            return(View(bowlinghuisModel));
        }
Example #5
0
        public Center GetBowlingCenter(string id, string bowlingid)
        {
            logger.Debug(Settings.MethodName());

            if (isCorrectUser(id))
            {
                S_BowlingCenter bowlingCenter = BowlingCenterManager.GetBowlingCenterById(long.Parse(bowlingid));

                if (bowlingCenter != null)
                {
                    Center center = new Center();

                    center.address           = bowlingCenter.address;
                    center.bowlingcenterId   = long.Parse(bowlingid);
                    center.bowlingcenterName = bowlingCenter.name;
                    center.city        = bowlingCenter.city;
                    center.email       = bowlingCenter.email;
                    center.logo        = bowlingCenter.logo;
                    center.phonenumber = bowlingCenter.phonenumber;

                    List <S_Advert> advertList = AdvertManager.GetAdvertsByBowlingCenterid(center.bowlingcenterId);
                    if (advertList != null)
                    {
                        center.adverts = new AdvertisementInfo[advertList.Count()];
                        int i = 0;

                        foreach (S_Advert advert in advertList)
                        {
                            center.adverts[i] = new AdvertisementInfo();
                            center.adverts[i].advertisement       = advert.advertisement;
                            center.adverts[i].advertisement_www   = advert.advertisement_www;
                            center.adverts[i++].advertisement_url = advert.advertisement_url;
                        }
                    }

                    List <S_Opentime> opentimeList = OpentimeManager.GetOpentimesByBowlingcenterId(center.bowlingcenterId);
                    if (opentimeList != null)
                    {
                        center.times = new Opentime[opentimeList.Count()];
                        int i = 0;
                        foreach (S_Opentime openTime in opentimeList)
                        {
                            center.times[i]          = new Opentime();
                            center.times[i].Day      = openTime.day.ToString();
                            center.times[i].Start    = openTime.openTime;
                            center.times[i++].Finish = openTime.closeTime;
                        }
                    }

                    return(center);
                }
            }

            return(null);
        }
Example #6
0
        public PlayedGames GetPlayedGames(string id, string centerid, string gamedate, string otheruserid)
        {
            logger.Debug(Settings.MethodName());

            PlayedGames playedGames = new PlayedGames();

            if (isCorrectUser(id))
            {
                // voor het opvragen van games van een andere gebruiker, gebruiken we het andere id
                if (!String.IsNullOrEmpty(otheruserid))
                {
                    id = otheruserid;
                }

                long userid;
                long bowlingcenterid;

                int year;
                int month;
                int day;

                try
                {
                    long.TryParse(centerid, out bowlingcenterid);
                    long.TryParse(id, out userid);
                    int.TryParse(gamedate.Substring(0, 4), out year);
                    int.TryParse(gamedate.Substring(4, 2), out month);
                    int.TryParse(gamedate.Substring(6, 2), out day);
                    DateTime gameDate = new DateTime(year, month, day);

                    S_User          user          = UserManager.GetUserById(userid);
                    S_BowlingCenter bowlingcenter = BowlingCenterManager.GetBowlingCenterById(bowlingcenterid);

                    if (user != null && bowlingcenter != null)
                    {
                        playedGames = GameManager.GetPlayedGamesByUserAndBowlingcenterAndDate(user, bowlingcenter, gameDate);
                    }
                }
                catch
                {
                }
            }

            return(playedGames);
        }
        public ActionResult Edit(BowlinghuisModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to save the bowlinghuis
                try
                {
                    S_BowlingCenter bowlingcenter = BowlingCenterManager.GetBowlingCenterById(model.Id);

                    bowlingcenter.name          = model.Name;
                    bowlingcenter.uri           = model.Uri;
                    bowlingcenter.centerId      = model.Port;
                    bowlingcenter.address       = model.Address;
                    bowlingcenter.APIversion    = model.ApiVersion;
                    bowlingcenter.appname       = model.Appname;
                    bowlingcenter.secretkey     = model.Secretkey;
                    bowlingcenter.city          = model.City;
                    bowlingcenter.email         = model.Email;
                    bowlingcenter.lastSyncDate  = model.LastSyncDate;
                    bowlingcenter.logo          = model.UrlLogo;
                    bowlingcenter.numberOfLanes = model.NumberOfLanes;
                    bowlingcenter.phonenumber   = model.Phonenumber;
                    bowlingcenter.website       = model.Website;
                    bowlingcenter.zipcode       = model.ZipCode;

                    BowlingCenterManager.Update(bowlingcenter);
                    TempData["message"] = "Het bowlinghuis " + bowlingcenter.name + " is aangepast.";

                    return(RedirectToAction("index", "Bowlinghuis", new { name = "" }));
                }
                catch (Exception e)
                {
                    TempData["error"] = "Er is een fout opgetreden";
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Example #8
0
        public ActionResult Edit(long id)
        {
            S_Competition    competition      = CompetitionManager.GetCompetition(id);
            CompetitionModel competitionModel = new CompetitionModel();

            competitionModel.Id          = competition.id;
            competitionModel.challengeId = competition.challengeid;
            competitionModel.challenge   = ChallengeManager.GetChallenge(competition.challengeid).name;
            competitionModel.description = competition.description;
            competitionModel.StartDate   = competition.startdate;
            competitionModel.EndDate     = competition.enddate;
            competitionModel.price       = competition.price;

            List <S_BowlingCenter>           bcl  = BowlingCenterManager.GetBowlingCenters();
            List <S_CompetitonBowlingcenter> cbcl = CompetitionManager.GetBowlingcentersByCompetition(competition.id);

            competitionModel.AllBowlingCentersChecked = bcl.Count == cbcl.Count;

            //var selectedBowlingCenters = CheckboxManager.GetAll()
            //   .Where(x => cbcl.Any(s => x.Id.ToString().Equals(s.bowlingcenterid)))
            //   .ToList();

            List <C_Checkbox> selectedBowlingCenters = new List <C_Checkbox>();

            foreach (S_CompetitonBowlingcenter cbc in cbcl)
            {
                S_BowlingCenter bc = BowlingCenterManager.GetBowlingCenterById(cbc.bowlingcenterid);
                selectedBowlingCenters.Add(new C_Checkbox {
                    Id = cbc.bowlingcenterid, Name = bc.name
                });
            }
            //setup a view model
            competitionModel.AvailableBowlingCenters = CheckboxManager.GetAll().ToList();
            competitionModel.SelectedBowlingCenters  = selectedBowlingCenters;

            return(View(competitionModel));
        }