Пример #1
0
        public ActionResult EditOpentime(OpentimeModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to save the opentime
                try
                {
                    S_Opentime opentime = OpentimeManager.GetOpentimeById(model.Id);

                    opentime.day       = (Day)Enum.Parse(typeof(Day), model.Day);
                    opentime.openTime  = model.Opentime;
                    opentime.closeTime = model.Closetime;

                    OpentimeManager.Update(opentime);
                    TempData["message"] = "De openingstijd is aangepast.";

                    return(RedirectToAction("opentimes", "Bowlinghuis", new { id = opentime.bowlingCenterId }));
                }
                catch (Exception e)
                {
                    TempData["error"] = "Er is een fout opgetreden";
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #2
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);
        }
Пример #3
0
        public ActionResult EditOpentime(long id)
        {
            S_Opentime    opentime      = OpentimeManager.GetOpentimeById(id);
            OpentimeModel opentimeModel = new OpentimeModel();

            opentimeModel.Id        = opentime.id;
            opentimeModel.Day       = opentime.day.ToString();
            opentimeModel.Opentime  = opentime.openTime;
            opentimeModel.Closetime = opentime.closeTime;

            SelectListItem monday = new SelectListItem();

            monday.Value = "Monday";
            monday.Text  = "Maandag";

            SelectListItem tuesday = new SelectListItem();

            tuesday.Value = "Tuesday";
            tuesday.Text  = "Dinsdag";

            SelectListItem wednesday = new SelectListItem();

            wednesday.Value = "Wednesday";
            wednesday.Text  = "Woensdag";

            SelectListItem thursday = new SelectListItem();

            thursday.Value = "Thursday";
            thursday.Text  = "Donderdag";

            SelectListItem friday = new SelectListItem();

            friday.Value = "Friday";
            friday.Text  = "Vrijdag";

            SelectListItem saterday = new SelectListItem();

            saterday.Value = "Saterday";
            saterday.Text  = "Zaterdag";

            SelectListItem sunday = new SelectListItem();

            sunday.Value = "Sunday";
            sunday.Text  = "Zondag";

            opentimeModel.Days = new Collection <SelectListItem>()
            {
                monday, tuesday, wednesday, thursday, friday, saterday, sunday
            };
            return(View(opentimeModel));
        }
Пример #4
0
        public ActionResult DeleteOpentime(long id)
        {
            S_Opentime opentime = null;

            try
            {
                opentime = OpentimeManager.GetOpentimeById(id);

                OpentimeManager.Delete(id);
                TempData["message"] = "De openingstijd is verwijderd.";
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }

            return(RedirectToAction("opentimes", "Bowlinghuis", new { id = opentime.bowlingCenterId }));
        }
Пример #5
0
        public ActionResult Opentimes(long id)
        {
            ObservableCollection <OpentimeGridModel> opentimeModelList = new ObservableCollection <OpentimeGridModel>();

            List <S_Opentime> opentimeList;

            opentimeList = OpentimeManager.GetOpentimesByBowlingcenterId(id);

            foreach (S_Opentime opentime in opentimeList)
            {
                OpentimeGridModel opentimeGridModel = new OpentimeGridModel();
                opentimeGridModel.Id = opentime.id;
                opentimeGridModel.BowlingcenterId = opentime.bowlingCenterId;
                opentimeGridModel.Day             = ConvertDay(opentime.day);
                opentimeGridModel.Opentime        = opentime.openTime;
                opentimeGridModel.Closetime       = opentime.closeTime;

                opentimeModelList.Add(opentimeGridModel);
            }

            ViewBag.bowlingcenterid = id;

            return(View(opentimeModelList));
        }