예제 #1
0
        // GET: Mice/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var mouse = await _context.Mouse
                        .Include(m => m.Line)
                        .Include(m => m.PK1)
                        .Include(m => m.PK2).Include(m => m.MouseCages)
                        .SingleOrDefaultAsync(m => m.MouseID == id);

            if (mouse == null)
            {
                return(NotFound());
            }
            Cage cage = _context.Cage.SingleOrDefault(c => c.CageID == _context.MouseCage.SingleOrDefault(mc => mc.EndDate == null && mc.MouseID == mouse.MouseID).CageID);

            MouseDetailsViewModel model = new MouseDetailsViewModel
            {
                Mouse = mouse,
                Cage  = cage
            };

            return(View(model));
        }
예제 #2
0
        /// <summary>
        /// Launches the cage window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void showCageButton_Click(object sender, RoutedEventArgs e)
        {
            // Gets the animal from the animal list box.
            Animal animal = (Animal)animalListBox.SelectedItem;

            // Find the cage based on the animal's type.
            Cage cage = zoo.FindCage(animal.GetType());

            // If an animal was selected, create a new cage window and put the animal in the cage.
            if (animal != null)
            {
                CageWindow cageWindow = new CageWindow(cage);


                cageWindow.Show();
                //if (cageWindow.ShowDialog() == true)
                //{
                //}
            }
            // Ask user to select an animal.
            else
            {
                MessageBox.Show("Please select an aniaml to put in the cage.");
            }
        }
예제 #3
0
        public async Task UpisiKavez([FromForm] Cage kavez)
        {
            Context.Cages.Add(kavez);
            await Context.SaveChangesAsync();

            Response.Redirect("http://127.0.0.1:5500/");
        }
예제 #4
0
        public IActionResult NewLitter(int cageID, int numOfPups)
        {
            Cage         cage    = _context.Cage.Single(c => c.CageID == cageID);
            List <Mouse> parents = (
                from m in _context.Mouse
                from mc in _context.MouseCage
                where m.MouseID == mc.MouseID &&
                mc.EndDate == null &&
                mc.CageID == cage.CageID
                select m).Include(m => m.PK1).Include(m => m.PK2).Include(m => m.Line).ToList();

            //Test to make sure there are both males and females before moving to view
            if (parents.Where(m => m.Sex == "F").Count() == 0 || parents.Where(m => m.Sex == "M").Count() == 0)
            {
                return(RedirectToAction("Details", "Cages", new { id = cage.CageID }));
            }
            List <Mouse> pups = new List <Mouse>();

            for (int n = 0; n < numOfPups; n++)
            {
                pups.Add(new Mouse());
            }

            NewLitterViewModel model = new NewLitterViewModel();

            model.Cage      = cage;
            model.Parents   = parents;
            model.NumOfPups = numOfPups;
            model.Pups      = pups;

            return(View(model));
        }
예제 #5
0
        /// <summary>
        /// Casts the <see cref="Slot"/> to a <see cref="GH_Point"/> (from
        /// <see cref="AbsoluteCenter"/>, to a <see cref="Box"/> (from
        /// <see cref="Cage"/>) or to a <see cref="Brep"/> (from
        /// <see cref="Cage"/>). Required by Grasshopper for automatic type
        /// casting.
        /// </summary>
        /// <param name="target">The target Grasshopper geometry.</param>
        /// <returns>True when successful.</returns>
        public bool CastTo <T>(out T target)
        {
            if (typeof(T) == typeof(GH_Point))
            {
                var absoluteCenter = new GH_Point(AbsoluteCenter);
                target = (T)absoluteCenter.Duplicate();
                return(true);
            }

            if (typeof(T) == typeof(GH_Vector))
            {
                var diagonal = new GH_Vector(Diagonal);
                target = (T)diagonal.Duplicate();
                return(true);
            }

            if (typeof(T) == typeof(GH_Box))
            {
                var box = new GH_Box(Cage);
                target = (T)box.Duplicate();
                return(true);
            }

            if (typeof(T) == typeof(GH_Brep))
            {
                var boxBrep = new GH_Brep(Cage.ToBrep());
                target = (T)boxBrep.Duplicate();
                return(true);
            }

            target = default;
            return(false);
        }
예제 #6
0
        public void TestEvictAnimal()
        {
            var aviary = new Cage(CageType.WithTrees, 10, 2);

            // Успешная попытка выселить существующее животное
            var animal1 = new Mammal(MammalDetachment.Artiodactyla, "семейство1", "род1", "вид1");

            aviary.SettleAnimal(animal1);
            aviary.EvictAnimal(animal1);
            Assert.AreEqual(0, aviary.GetListOfInhabitants().Count);

            //Неуспешная попытка выселить несуществующее животное
            try
            {
                aviary.EvictAnimal(null);
                Assert.Fail();
            }
            catch (ArgumentException) { }

            //Неуспешная попытка выселить отсутствующее в вольере животное
            try
            {
                aviary.EvictAnimal(animal1);
                Assert.Fail();
            }
            catch (ArgumentException) { }
        }
예제 #7
0
    public void CageExplode()
    {
        if (cage == null)
        {
            return;
        }

        GameObject explosion = null;

//        if (item != null)
//        {
//            switch (item.GetCookie(item.type))
//            {
//                case ITEM_TYPE.COOKIE_1:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.BlueCookieExplosion()) as GameObject);
//                    break;
//                case ITEM_TYPE.COOKIE_2:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.GreenCookieExplosion()) as GameObject);
//                    break;
//                case ITEM_TYPE.COOKIE_3:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.OrangeCookieExplosion()) as GameObject);
//                    break;
//                case ITEM_TYPE.COOKIE_4:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.PurpleCookieExplosion()) as GameObject);
//                    break;
//                case ITEM_TYPE.COOKIE_5:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.RedCookieExplosion()) as GameObject);
//                    break;
//                case ITEM_TYPE.COOKIE_6:
//                    explosion = CFX_SpawnSystem.GetNextObject(Resources.Load(Configure.YellowCookieExplosion()) as GameObject);
//                    break;
//            }
//        }

        board.CollectCage(cage);

        if (explosion != null)
        {
            explosion.transform.position = item.transform.position;
        }

        AudioManager.instance.CageExplodeAudio();

        if (cage.type == CAGE_TYPE.CAGE_1)
        {
            Destroy(cage.gameObject);

            cage = null;
        }
        else if (cage.type == CAGE_TYPE.CAGE_2)
        {
            var prefab = Resources.Load(Configure.Cage1()) as GameObject;

            cage.gameObject.GetComponent <SpriteRenderer>().sprite = prefab.GetComponent <SpriteRenderer>().sprite;

            cage.type = CAGE_TYPE.CAGE_1;
        }

        StartCoroutine(item.ResetDestroying());
    }
예제 #8
0
    private float CalculateHappinessForCage(Cage cage)
    {
        var   stats     = cage.animals[0].stats;
        float happiness = 1f;

        foreach (var food in stats.foods)
        {
            if (cage.GetProperFeeder(food) == null)
            {
                happiness -= 0.5f / stats.foods.Length;
                foreach (var animal in cage.animals)
                {
                    animal.data.foods[(int)food] = 0;
                }
            }
        }
        foreach (var spec in stats.specials)
        {
            if (cage.GetProperSpecial(spec) == null)
            {
                happiness -= 0.4f / stats.specials.Length;
                foreach (var animal in cage.animals)
                {
                    animal.data.specials[(int)spec] = 0;
                }
            }
        }
        return(happiness);
    }
예제 #9
0
        static void Main(string[] args)
        {
            PetShopDBContext context = new PetShopDBContext();

            try
            {
                Cage cage = new Cage
                {
                    IsEmpty = false,
                    Name    = "Pesho"
                };

                context.Cages.Add(cage);
                context.SaveChanges();
            }
            //In this case the exception happend on the DB and we have to cultivate this exceprion to find its massage
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult dbEntityValidatonResult in ex.EntityValidationErrors)
                {
                    foreach (DbValidationError dbValidationError in dbEntityValidatonResult.ValidationErrors)
                    {
                        Console.WriteLine(dbValidationError.ErrorMessage);
                    }
                }
            }
        }
예제 #10
0
        public D1(Game game, Camera camera)
            : base(game, camera)
        {
            position  = new Vector3(-391, 140, 345);
            yrotation = -MathHelper.PiOver2;
            type      = TrialType.DRAGDROP;

            GEntity cage = new Cage(game, new Vector3(-476, 116, 326.5f), camera);

            cage.yrotation = MathHelper.Pi;
            cage.scale     = 8;
            draggableList.Add(cage);

            for (int i = 0; i < fireflyLimit; i++)
            {
                GEntity firefly = new Firefly(game, new Vector3(-476, Game1.random.Next(ymin, ymax), Game1.random.Next(zmin, zmax)), camera);
                firefly.scale         = 4;
                firefly.standardColor = i == 0 ? Color.Orange : Color.Yellow;
                firefly.selectedColor = Color.Red;
                selectableList.Add(firefly);
            }

            trialState          = TrialState.INT;
            inTrialInstructions = "Select the orange firefly, and drag it into the cage.";
            Game1.wandCursor.DisplayingWithoutGesture = false;
            renderRequested = true;
        }
예제 #11
0
        public void TestEvictAnimal()
        {
            var zoo     = new Zoo("name", "address");
            var aviary1 = new Cage(CageType.WithRocks);
            var animal1 = new Mammal(MammalDetachment.Artiodactyla, "family1", "genus1", "species1");

            zoo.AddAviary(aviary1);
            zoo.SettleAnimal(animal1, aviary1);

            //Результат успешного выселения животного
            zoo.EvictAnimal(animal1);
            Assert.AreEqual(0, zoo.GetListOfAnimals().Count);

            //Попытка выселить несуществующее (пустое) животное
            try
            {
                zoo.EvictAnimal(null);
                Assert.Fail();
            }
            catch (ArgumentException) { }

            //Попытка выселить отсутствующее в зоопарке животное
            try
            {
                zoo.EvictAnimal(animal1);
                Assert.Fail();
            }
            catch (ArgumentException) { }
        }
예제 #12
0
    public void cageIsEmpty()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //GameObject b = GameObject.Find ("Player_" + playerNo);
            //parc = b.GetComponent<ParcManager> ();

            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                cacage = hit.collider.gameObject.GetComponent <Cage>();
                //foreach (Tile p in cacage.Tiles)
                //Debug.Log ("("+p.Position.ToString()+"), ");
                if (cacage != null)
                {
                    if (!cacage.IsFull && cacage.Type == Cage.CageType.CageEmpty)
                    {
                        this.GetComponent <GameInterface>().DinoPanel();
                    }
                    else if (!cacage.IsFull)
                    {
                        //afficher le type de la cage et sa capacité.
                        type = (int)cacage.Type;
                        setImageDino();
                        Text countDino = capacityText.GetComponent <Text>();
                        countDino.text = cacage.Dinosaurs.Count + "/" + cacage.Dinosaurs.Capacity;
                        this.GetComponent <GameInterface>().DinoOneChoice();
                    }
                    checkingCage = false;
                }
            }
        }
    }
예제 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("CageID,CageNumber,Cubicle,Breeding")] Cage cage)
        {
            if (id != cage.CageID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CageExists(cage.CageID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cage));
        }
예제 #14
0
        private void cagesDeletebutton_Click(object sender, EventArgs e)
        {
            try
            {
                Cage cage = (Cage)cagesDataGridView.CurrentRow.DataBoundItem;
                var  b    = (from a in ctx.Animal where (a.Animal_CageId == cage.Cage_Id) select a).Any();
                if (b)
                {
                    MessageBox.Show("Неможливо видалити клітку, у якій є тварини");
                }

                else
                {
                    Cage cage1 = (Cage)cagesDataGridView.CurrentRow.DataBoundItem;
                    cageBindingSource.DataSource = ctx.Cage.Local.ToBindingList();
                    cageBindingSource.Remove(cage1);
                    ctx.SaveChanges();
                    LoadData();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Помилка видалення");
            }
        }
예제 #15
0
        private void newCageButton_Click(object sender, EventArgs e)
        {
            int num    = 0;
            int square = 0;

            try
            {
                num    = int.Parse(numberTextBox.Text);
                square = int.Parse(squareTextBox.Text);
            }
            catch (Exception)
            { MessageBox.Show("Введено некоректні дані.Додавання неможливе");
              numberTextBox.Text = "";
              squareTextBox.Text = "";
              return; }
            if (num <= 0 || square <= 0)
            {
                MessageBox.Show("Недодатний номер або площа.Додавання неможливе");
                numberTextBox.Text = "";
                squareTextBox.Text = "";
                return;
            }
            Cage cage = new Cage();

            cage.Cage_Number             = num;
            cage.Cage_ShopId             = shop_Id;
            cage.Cage_Square             = square;
            cageBindingSource.DataSource = ctx.Cage.Local.ToBindingList();
            cageBindingSource.Add(cage);
            ctx.SaveChanges();
            LoadData();
        }
예제 #16
0
        public void TestDeleteAviary()
        {
            var zoo = new Zoo("name", "address");
            //Корректное удаление существующего пустого закрытого вольера
            var aviary = new Cage(CageType.WithRocks);

            zoo.AddAviary(aviary);
            zoo.CloseAviary(aviary.Number);
            Assert.AreEqual(true, zoo.DeleteAviary(aviary.Number));
            Assert.AreEqual(null, zoo.FindAviary(aviary.Number));

            //Попытка удалить незакрытый вольер
            System.Threading.Thread.Sleep(10);
            var aviary2 = new Cage(CageType.WithTrees);

            zoo.AddAviary(aviary2);
            Assert.AreEqual(false, zoo.DeleteAviary(aviary2.Number));

            //Попытка удалить не существующий вольер
            try
            {
                zoo.DeleteAviary("any number");
                Assert.Fail();
            }
            catch (ArgumentException) { }

            //Попытка удалить уже удаленный вольер
            try
            {
                zoo.DeleteAviary(aviary.Number);
                Assert.Fail();
            }
            catch (ArgumentException) { }
        }
예제 #17
0
        public void SaySomethingTestNoAnimals()
        {
            var cage = new Cage();
            var str  = cage.SaySomething();

            Assert.AreEqual("", str);
        }
예제 #18
0
        /// <summary>
        /// Allows the guest to adopt an animal.
        /// </summary>
        /// <param name="sender">System data.</param>
        /// <param name="e">Associated event data.</param>
        private void adoptAnimalButton_Click(object sender, RoutedEventArgs e)
        {
            // Get the selected guest in the list box.
            Guest guest = this.guestListBox.SelectedItem as Guest;

            // Get the selected animal in the list box.
            Animal animal = this.animalListBox.SelectedItem as Animal;

            if (guest != null && animal != null)
            {
                // Set the animal to the guest's adopted animal.
                guest.AdoptedAnimal = animal;

                // Find the animal's cage and add the guest to it.
                Cage cage = comoZoo.FindCage(animal.GetType());
                cage.Add(guest);

                PopulateAnimalListBox();
                PopulateGuestListBox();
            }
            else
            {
                MessageBox.Show("Please choose both a guest and an animal.");
            }

            // Keep both selections active.
            guest  = guestListBox.SelectedItem as Guest;
            animal = animalListBox.SelectedItem as Animal;
        }
예제 #19
0
        /// <summary>
        /// Removes a guest from the guest list in the WPF.
        /// </summary>
        /// <param name="sender">System data.</param>
        /// <param name="e">Associated event data.</param>
        private void removeGuestButton_Click(object sender, RoutedEventArgs e)
        {
            // Find the guest in the list box.
            Guest guest = this.guestListBox.SelectedItem as Guest;

            try
            {
                if (MessageBox.Show(string.Format("Are you sure you want to remove guest: {0}?", guest.Name), "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    comoZoo.RemoveGuest(guest);

                    PopulateGuestListBox();
                }

                if (guest.AdoptedAnimal != null)
                {
                    Cage cage = comoZoo.FindCage(guest.AdoptedAnimal.GetType());
                    cage.Remove(guest);
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Please select a guest to remove from the list.");
            }
        }
예제 #20
0
 // Use this for initialization
 void Start()
 {
     cage   = GetComponentInParent <Cage>();
     nav    = GetComponent <NavMeshAgent>();
     GBM    = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameBooleanManager>();
     player = GameObject.FindGameObjectWithTag("Player");
 }
예제 #21
0
 private void Start()
 {
     path = new List <PathNode>();
     cage = GetComponent <Animal>().cage;
     anim = GetComponent <AnimalAnimationController>();
     self = transform;
 }
        /// <summary>
        /// Has the specified guest adopt the specified animal.
        /// </summary>
        /// <param name="sender">The object that initiated the event.</param>
        /// <param name="e">The arguments of the event.</param>
        private void adoptAnimalButton_Click(object sender, RoutedEventArgs e)
        {
            Animal animal = this.animalListBox.SelectedItem as Animal;

            Guest guest = this.comoZoo.FindGuest(g => g.AdoptedAnimal == null);

            if (guest.AdoptedAnimal == null)
            {
                if (animal != null && guest != null)
                {
                    guest.AdoptedAnimal = animal;

                    Cage cage = this.comoZoo.FindCage(animal.GetType());

                    cage.Add(guest);
                }
                else
                {
                    MessageBox.Show("Select a guest and an animal for that guest to adopt.");
                }
            }
            else
            {
                MessageBox.Show("A guest is only allowed to adopt one animal, you can unadopt and re-adopt a different animal.");
            }
        }
예제 #23
0
        public IActionResult ExecuteCageAssign(CageAssignViewModel model)
        {
            Mouse mouse = _context.Mouse.Single(m => m.MouseID == model.MouseID);

            mouse.MouseCages = _context.MouseCage.Where(mc => mc.MouseID == mouse.MouseID).ToList();

            if (mouse.MouseCages != null)
            {
                if (mouse.MouseCages.Any(mc => mc.EndDate == null))
                {
                    Cage currentCage = _context.Cage.SingleOrDefault(c => c.CageID == _context.MouseCage.Single(mc => mc.EndDate == null && mc.MouseID == mouse.MouseID).CageID);
                    if (currentCage != null)
                    {
                        MouseCage oldMouseCage = _context.MouseCage.Single(mc => mc.MouseID == model.MouseID && mc.CageID == currentCage.CageID && mc.EndDate == null);
                        oldMouseCage.EndDate = model.Date;
                        _context.MouseCage.Update(oldMouseCage);
                        _context.SaveChanges();
                    }
                }
            }
            _context.MouseCage.Add(
                new MouseCage
            {
                CageID    = model.NewCageID,
                MouseID   = model.MouseID,
                StartDate = model.Date
            }
                );
            _context.SaveChanges();

            return(RedirectToAction("Details", "Lines", new { id = mouse.LineID }));
        }
예제 #24
0
        public void LeastPopulatedCageSelectorTest()
        {
            var rootCage = new Cage();

            var animal  = new Wolf("test", 1);
            var animal1 = new Wolf("1", 1);
            var animal2 = new Wolf("2", 1);

            var cage1 = new Cage();
            var cage2 = new Cage();
            var cage3 = new Cage();

            cage1.Children.Add(animal1);
            cage3.Children.Add(animal2);

            rootCage.Children.Add(cage1);
            rootCage.Children.Add(cage2);
            rootCage.Children.Add(cage3);

            var mockSelector = GetCageSelectorMock();

            var cageSelector = new LeastPopulatedCageSelector();

            cageSelector.Successor = mockSelector.Object;

            var result = cageSelector.SelectCage(rootCage, animal);

            mockSelector.Verify(c => c.SelectCage(cage2, animal));
        }
예제 #25
0
        public void GetAnimalsTestNoAnimals()
        {
            var cage    = new Cage();
            var animals = cage.GetAnimals();

            Assert.AreEqual(0, cage.GetAnimals().Count);
        }
예제 #26
0
        public async Task <IActionResult> Create(string cagedesignationstring, int locationinput, string speciesstring)
        {
            //_logger.Info("Attempted to add a cage - CageController")

            ViewData["CageDesignation"] = cagedesignationstring;
            ViewData["Location"]        = locationinput;
            ViewData["Species"]         = speciesstring;
            Cage cage = new Cage();

            if (ModelState.IsValid)
            {
                var temp = _context.Locations.First(m => m.LocationID == locationinput);

                cage.CageDesignation    = cagedesignationstring;
                cage.LocationID         = locationinput;
                cage.Species            = speciesstring;
                cage.NormalizedLocation = temp.NormalizedStr;
                _context.Add(cage);
                sp_Logging("2-Change", "Create", "User created an cage where name=" + cagedesignationstring, "Success");
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["LocationName"] = new SelectList(_context.Locations.Distinct(), "LocationID", "NormalizedStr", cage.LocationID);
            return(View(cage));
        }
예제 #27
0
 public async Task <IActionResult> Edit(int id, [Bind("ID,ShopID,Number,Square")] Cage cage)
 {
     cage.ShopID = shopId;
     cage.Shop   = _context.Shops.Where(s => s.ID == shopId).First();
     if (id != cage.ID)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(cage);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!CageExists(cage.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(Redirect("https://localhost:44324/Cages/Details/" + shopId));
     }
     return(View(cage));
 }
예제 #28
0
    // Use this for initialization
    void Start()
    {
        GameObject cageGameObject = GameObject.FindWithTag("Cage");

        this._cage = cageGameObject.GetComponent <Cage>();
        if (this._cage == null)
        {
            Debug.LogError("Couldn't find the cage!");
        }
        GameObject playerGameObject = GameObject.FindWithTag("Player");

        this._player = playerGameObject.GetComponent <PacmanController>();
        if (this._player == null)
        {
            Debug.LogError("Didn't find player!");
        }
        GameObject mapGameObject = GameObject.FindWithTag("Map");

        this._map = mapGameObject.GetComponent <GameField>();
        if (this._map == null)
        {
            Debug.LogError("Couldn't find the Map!");
        }
        this.Reset();
    }
예제 #29
0
        public ActionResult Get()
        {
            var all     = _houseManager.GetAll();
            var cookies = HttpContext.Request.Cookies["name"]?.Value;

            var cage = new Cage {
                Capacity = 3, Id = 1, Name = "IGOR"
            };

            var cageModel = _mapper.Map <CageModel>(cage);

            if (string.IsNullOrWhiteSpace(cookies))
            {
                var cookie = new System.Web.HttpCookie("name", "value");
                cookie.HttpOnly = true;
                cookie.Expires  = DateTime.Now.AddDays(2);
                HttpContext.Response.Cookies.Add(cookie);
            }

            var user = HttpContext.User.Identity as ClaimsIdentity;

            if (user != null)
            {
                var claiim = user.Claims.FirstOrDefault(x => x.Type == "claiim");
            }

            var result = JsonConvert.SerializeObject(new { Name = "IGOR", LastName = "Serdiuk" });

            return(View());
        }
예제 #30
0
        static void Main(string[] args)
        {
            Time t = new Time();

            t.TimePasses();

            Park      ZoologiskHave = new Park();
            ZooWorker Bob           = new ZooWorker();
            ZooWorker Lars          = new ZooWorker();

            Cage ElephantCage = new Cage(6);

            for (int i = 0; i < 6; i++)
            {
                ElephantCage.AddAnimalToPen(new Elephant());
            }
            ZoologiskHave.AnimalCages.Add(ElephantCage);

            //Bleeds alot of Memory, reason unknown
            Task task = new Task(ZoologiskHave.RunPark);

            task.Start();
            Console.ReadKey();
            ZoologiskHave.ClosePark();
            Console.WriteLine(ZoologiskHave.CalculateAverageReview());
            Console.ReadKey();
        }
예제 #31
0
        public bool EditCage(Cage cage)
        {
            using (var db = new ZooMasterDBEntities())
            {
                var originalCage = db.Cages.First(c => c.CageID == cage.CageID);

                originalCage.AreaID = cage.AreaID;
                originalCage.Size = cage.Size;
                originalCage.Description = cage.Description;

                return db.SaveChanges() == 1;
            }
        }
 // Use this for initialization
 new void Start()
 {
     base.Start();
     // Find the GameController.
     GameObject obj = GameObject.FindWithTag("Cage");
     if (obj != null)
     {
         this._cage = obj.GetComponent<Cage>();
     }
     if (this._cage == null)
     {
         Debug.LogError("Can't find Cage!");
     }
 }
예제 #33
0
        public bool AddCleaning(Cage cage, DateTime time, int regularEmployeeID)
        {
            var newCleaning = new Cleaning()
            {
                CageID = cage.CageID,
                Time = time,
                EmployeeID = regularEmployeeID
            };

            using (var db = new ZooMasterDBEntities())
            {
                db.Cleanings.Add(newCleaning);
                return db.SaveChanges() == 1;
            }
        }
예제 #34
0
        public bool AddCage(decimal cageSize, string cageDescription, Area cageArea)
        {
            var newCage = new Cage()
            {
                AreaID = cageArea.AreaID,
                Size = cageSize,
                Description = cageDescription
            };

            using (var db = new ZooMasterDBEntities())
            {
                db.Cages.Add(newCage);
                return db.SaveChanges() == 1;
            }
        }
예제 #35
0
        public bool AddAnimal(string name, DateTime birthDate, Species species, Cage cage, decimal weight, Gender gender,
            Employee guard, Employee vet, DateTime arivalDate)
        {
            var newAnimal = new Animal()
            {
                Name = name,
                BirthDate = birthDate,
                SpeciesID = species.SpeciesID,
                CageID = cage.CageID,
                Weight = (decimal)weight,
                Gender = (int)gender,
                GuardID = guard.EmployeeID,
                VetID = vet.EmployeeID,
                ArrivalDate = arivalDate
            };

            using (var db = new ZooMasterDBEntities())
            {
                db.Animals.Add(newAnimal);
                return db.SaveChanges() == 1;
            }
        }
예제 #36
0
 // Use this for initialization
 void Start()
 {
     GameObject cageGameObject = GameObject.FindWithTag("Cage");
     this._cage = cageGameObject.GetComponent<Cage>();
     if (this._cage == null)
     {
         Debug.LogError("Couldn't find the cage!");
     }
     GameObject playerGameObject = GameObject.FindWithTag("Player");
     this._player = playerGameObject.GetComponent<PacmanController>();
     if (this._player == null)
     {
         Debug.LogError("Didn't find player!");
     }
     GameObject mapGameObject = GameObject.FindWithTag("Map");
     this._map = mapGameObject.GetComponent<GameField>();
     if (this._map == null)
     {
         Debug.LogError("Couldn't find the Map!");
     }
     this.Reset();
 }
예제 #37
0
 public BirdVeterinary()
 {
     this.cage = new Cage( /*cage information*/);
 }
예제 #38
0
        private bool IsSameCage(Cage cageFromCallback)
        {
            // Can do any sort of valiation here
            if (this.recordedCage == null)
            {
                this.recordedCage = cageFromCallback;
                return true;
            }

            return this.recordedCage == cageFromCallback;
        }
예제 #39
0
 protected void Start()
 {
     GameObject pacmanGameObject = GameObject.FindWithTag("Player");
     if (pacmanGameObject == null)
     {
         Debug.LogError("Couldn't find the Player!");
     }
     this._pacman = pacmanGameObject.GetComponent<PacmanController>();
     if (this._pacman == null)
     {
         Debug.LogError("Couldn't find Script on pacman!");
     }
     GameObject mapGameObject = GameObject.FindWithTag("Map");
     this._map = mapGameObject.GetComponent<GameField>();
     if (this._map == null)
     {
         Debug.Log("Couldn't find the Map!");
     }
     GameObject cageObject = GameObject.FindWithTag("Cage");
     if (cageObject != null)
     {
         this._cage = cageObject.GetComponent<Cage>();
     }
     if (this._cage == null)
     {
         Debug.LogError("Can't find the Cage!");
     }
     if (this.FrightenedMaterial == null)
     {
         Debug.LogError("No material for Frightened mode was added!");
     }
     this._originalMaterial = renderer.material;
 }
예제 #40
0
 public BirdVeterinary()
 {
     cage = new Cage();
 }