상속: MonoBehaviour
예제 #1
0
        public AdvertisementInfo GetAdvertisement(string id)
        {
            logger.Debug(Settings.MethodName());
            logger.Trace("Parameters: id: " + id);

            AdvertisementInfo advertisementInfo = new AdvertisementInfo();

            if (isCorrectUser(id))
            {
                try
                {
                    S_Advert advert = AdvertManager.GetRandomAdvert();
                    if (advert != null)
                    {
                        advertisementInfo.advertisement     = advert.advertisement;
                        advertisementInfo.advertisement_url = Conversion.UriToEscapedUri(advert.advertisement_url);
                        advertisementInfo.advertisement_www = Conversion.UriToEscapedUri(advert.advertisement_www);
                    }
                }
                catch
                {
                }
            }

            logger.Trace("Return: advertisement: " + advertisementInfo.advertisement);
            logger.Trace("Return: advertisement_url: " + advertisementInfo.advertisement_url);
            logger.Trace("Return: advertisement_www: " + advertisementInfo.advertisement_www);


            return(advertisementInfo);
        }
예제 #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
 /// <summary>
 /// Method runs when this game object is awoken.
 /// </summary>
 void Awake()
 {
     if (adManager != null)
     {
         Destroy(gameObject);
     }
     else
     {
         adManager = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
예제 #4
0
        public ActionResult EditAdvert(long id)
        {
            S_Advert    advert      = AdvertManager.GetAdvertById(id);
            AdvertModel advertModel = new AdvertModel();

            advertModel.Id               = advert.id;
            advertModel.Advertisement    = advert.advertisement;
            advertModel.AdvertisementUrl = advert.advertisement_url;
            advertModel.AdvertisementWWW = advert.advertisement_www;

            return(View(advertModel));
        }
예제 #5
0
        public AdvertManagerTest()
        {
            MapperConfiguration mapperConfiguration = new MapperConfiguration(config => {
                config.AddProfile(new AdvertProfile());
                config.AddProfile(new CommentProfile());
                config.AddProfile(new CategoryProfile());
                config.AddProfile(new PhotoProfile());
                config.AddProfile(new AddressProfile());
            });

            IMapper mapper = mapperConfiguration.CreateMapper();

            _advertRepository   = new Mock <IAdvertRepository>();
            _categoryRepository = new Mock <ICategoryRepository>();
            _photoRepository    = new Mock <IPhotoRepository>();
            _advertManager      = new AdvertManager(_advertRepository.Object, _photoRepository.Object, mapper);
            _categoryManager    = new CategoryManager(_categoryRepository.Object, mapper);
        }
예제 #6
0
        public ActionResult DeleteAdvert(long id)
        {
            S_Advert advert = null;

            try
            {
                advert = AdvertManager.GetAdvertById(id);

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

            return(RedirectToAction("adverts", "Bowlinghuis", new { id = advert.bowlingcenterId }));
        }
예제 #7
0
        public ActionResult EditAdvert(AdvertModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to save the opentime
                try
                {
                    S_Advert advert = AdvertManager.GetAdvertById(model.Id);

                    advert.advertisement     = model.Advertisement;
                    advert.advertisement_url = model.AdvertisementUrl;
                    advert.advertisement_www = model.AdvertisementWWW;

                    HttpPostedFileBase remoteFile = Request.Files["UploadedFile"];

                    if ((remoteFile != null) && (remoteFile.ContentLength > 0) && !string.IsNullOrEmpty(remoteFile.FileName))
                    {
                        string remoteFileName        = remoteFile.FileName;
                        string remoteFileContentType = remoteFile.ContentType;
                        byte[] remoteFileBytes       = new byte[remoteFile.ContentLength];
                        remoteFile.InputStream.Read(remoteFileBytes, 0, Convert.ToInt32(remoteFile.ContentLength));

                        var fileName = Path.GetFileName(remoteFile.FileName);
                        var path     = Path.Combine(Server.MapPath("~/Banners"), fileName);
                        remoteFile.SaveAs(path);

                        string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/";
                        advert.advertisement_url = baseUrl + "/Banners/" + fileName;
                    }

                    AdvertManager.Update(advert);
                    TempData["message"] = "De advertentie is aangepast.";

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

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
예제 #8
0
 // Use this for initialization
 void Awake()
 {
     if (control != null)
     {
         Destroy(gameObject);
     }
     else
     {
         load();                                                                     //load the players old information into datafields
         control     = this;                                                         //put this object into the static control field
         audioSource = this.GetComponent <AudioSource> ();                           //get the AudioSource component from the gameobject
         GameObject.DontDestroyOnLoad(gameObject);                                   //ensure this is the only instance of this game object
         adManager        = AdvertManager.adManager;                                 //store reference to singleton admanager
         audioSource.mute = isMuted;                                                 //set the audiosource to its correct muted state
         timesPlayedToday = 0;                                                       //initialize the number of plays this session to 0
         //Debug.Log (Application.persistentDataPath);
         QualitySettings.SetQualityLevel(lastUsedQualitySetting, true);              //set the quality setting using last quality setting
         //unlockAllSkins ();
         Application.targetFrameRate = 60;
     }
 }
예제 #9
0
        public ActionResult Adverts(long id)
        {
            ObservableCollection <AdvertGridModel> advertModelList = new ObservableCollection <AdvertGridModel>();

            List <S_Advert> advertList;

            advertList = AdvertManager.GetAdvertsByBowlingCenterid(id);

            foreach (S_Advert advert in advertList)
            {
                AdvertGridModel advertGridModel = new AdvertGridModel();
                advertGridModel.Id = advert.id;
                advertGridModel.BowlingcenterId  = advert.bowlingcenterId;
                advertGridModel.Advertisement    = advert.advertisement;
                advertGridModel.AdvertisementUrl = advert.advertisement_url;
                advertGridModel.AdvertisementWWW = advert.advertisement_www;

                advertModelList.Add(advertGridModel);
            }

            ViewBag.bowlingcenterid = id;

            return(View(advertModelList));
        }