public Shelter Insert_Shelter_select(int ID)
 {
     Shelter = Shelter.Select(ID);
     Insert_Address_ID_txt.Text = Convert.ToString(Shelter.Address_ID);
     Insert_Shelter_Type_txt.Text = Convert.ToString(Shelter.Shelter_Type);
     Insert_Max_Capacity_txt.Text = Convert.ToString(Shelter.Max_Capacity);
     Insert_AllowsPets_txt.Text = Convert.ToString(Shelter.AllowsPets);
     return Shelter;
 }
 public Shelter Shelter_insert()
 {
     Shelter.Address_ID = Convert.ToInt32(Insert_Address_ID_txt.Text);
     Shelter.Shelter_Type = Insert_Shelter_Type_txt.Text;
     Shelter.Max_Capacity = Convert.ToInt32(Insert_Max_Capacity_txt.Text);
     Shelter.AllowsPets = Insert_AllowsPets_txt.Text;
     Shelter = Shelter.Insert(Shelter);
     Insert_Shelter_GridView.DataBind();
     Update_Shelter_GridView.DataBind();
     Delete_Shelter_GridView.DataBind();
     return Shelter;
 }
Ejemplo n.º 3
0
    public override string ToString()
    {
        return("Wealth=" + Wealth.ToString() + "\n" +
               "Wealth=" + Police.ToString() + "\n" +
               "Wealth=" + Heterogenity.ToString() + "\n" +
               "Wealth=" + Pollution.ToString() + "\n" +
               "Wealth=" + Corruption.ToString() + "\n\n" +

               "Wealth=" + Infrastructure.ToString() + "\n" +
               "Wealth=" + HealthServices.ToString() + "\n" +
               "Wealth=" + Crime.ToString() + "\n" +
               "Wealth=" + Religion.ToString() + "\n" +
               "Wealth=" + Food.ToString() + "\n" +
               "Wealth=" + Cleanness.ToString() + "\n" +
               "Wealth=" + Employment.ToString() + "\n" +
               "Wealth=" + Information.ToString() + "\n\n" +

               "Wealth=" + Nourishment.ToString() + "\n" +
               "Wealth=" + Health.ToString() + "\n" +
               "Wealth=" + Shelter.ToString() + "\n" +
               "Wealth=" + Trust.ToString() + "\n" +
               "Wealth=" + Safety.ToString());
    }
Ejemplo n.º 4
0
        private void btnUpdateShelter_Click(object sender, EventArgs e)
        {
            Shelter shelter = new Shelter();

            try
            {
                int id = Convert.ToInt32(dgwAdminShelter.CurrentRow.Cells[0].Value);
                shelter            = _wrt.Shelters.FirstOrDefault(s => s.Id == id);
                shelter.CityId     = Convert.ToInt32(cbxCity.SelectedValue);
                shelter.DistrictId = Convert.ToInt32(cbxDistrict.SelectedValue);
                shelter.Name       = tbxName.Text;
                shelter.Address    = tbxAddress.Text;
                shelter.Phone      = tbxPhone.Text;
                _wrt.SubmitChanges();
                GetShelters();
                Clear();
                MessageBox.Show("Entity deleted successfully");
            }
            catch
            {
                MessageBox.Show("We got a problem on the system.Try it another time.");
            }
        }
Ejemplo n.º 5
0
    void PopulateShelter()
    {
        int i = 0;

        while (i < shelterAmount)
        {
            bool    cantSpawnHere = false;
            Vector2 spawnPos      = new Vector2(
                Random.Range(-boxSize.x / 2, boxSize.x / 2),
                Random.Range(-boxSize.y / 2, boxSize.y / 2)
                );

            if (Vector2.Distance(spawnPos, Vector2.zero) < prohibitionRadius)
            {
                continue;
            }

            Collider2D[] colliders = Physics2D.OverlapCircleAll(spawnPos, 20);

            foreach (Collider2D collider in colliders)
            {
                if (Vector2.Distance(spawnPos, collider.transform.position) < 20)
                {
                    cantSpawnHere = true;
                    break;
                }
            }

            if (!cantSpawnHere)
            {
                GameObject shelterObj    = Instantiate(shelter, spawnPos, Quaternion.identity);
                Shelter    shelterScript = shelterObj.GetComponent <Shelter>();
                shelterScript.tpPos = tpPos[i];
                i++;
            }
        }
    }
Ejemplo n.º 6
0
    private Dictionary <string, survCond> _conditions;                          // whether character is still alive

    // ============================================== initialize
    // Use this for initialization
    void Start()
    {
        // get reference
        _shelter = this.GetComponent <Shelter> ();
        _visitor = this.GetComponent <Visitor> ();

        // initiate data base
        _conditions = new Dictionary <string, survCond> ();

        // ==================== PLEASE CREATE BOOLEAN HERE!!!! =====================
        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

        // add conditions index	value	  condition detail
        _conditions.Add("Brian", new survCond());
        _conditions.Add("Marina", new survCond());
        _conditions.Add("Eric", new survCond());
        _conditions.Add("Danny", new survCond());
        _conditions.Add("Bree", new survCond());
        _conditions.Add("Shane", new survCond());
        _conditions.Add("David", new survCond());

        // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        // ==========================================================================
    }
 public Shelter Update(Shelter shelter)
 {
     return(_repository.Update(shelter).Result);
 }
Ejemplo n.º 8
0
        //public IEnumerable<Shelter> GetAnimalsForShelter(int id)
        //{
        //    throw new NotImplementedException();
        //}

        public void Remove(Shelter shelter)
        {
            _animalContext.Shelters.Remove(shelter);
            _animalContext.SaveChanges();
        }
Ejemplo n.º 9
0
 public AssignAnimalToOwner(Shelter s)
 {
     InitializeComponent();
     animalShelter = s;
 }
Ejemplo n.º 10
0
    // ========================================================== initialization
    // Use this for initialization
    void Start()
    {
        _startNewConversation = this.GetComponent <StartNewConversation>();
        if (_shelter == null)
        {
            _shelter = g.GetComponent <Shelter> ();
        }
        if (_visitors == null)
        {
            _visitors = g.GetComponent <Visitor> ();
        }
        if (_gametime == null)
        {
            _gametime = g.GetComponent <GameTime> ();
        }
        if (_reports == null)
        {
            _reports = g.GetComponent <ReportHandler> ();
        }
        _gameWorld  = g.GetComponent <GameWorld> ();
        _Cond       = g.GetComponent <Conditions>();
        _newdayanim = g.GetComponent <NewDayAnim> ();

        foreach (Transform child in g.transform)
        {
            if (child.name == "BlackBox")
            {
                blackbox = child;
            }
            if (child.name == "Title")
            {
                title = child;
            }
        }

        charButtons = sideButtons = showButtons = showJournal = showHelp = false;

        showAllButtons = false;
        tutorial       = true;
        warning        = 0;

        index       = -1;
        animateSide = 500;
        fade        = 0;
        fading      = 0;
        credits     = false;


        boxStyle = new GUIStyle("box");

        buttonStyle = new GUIStyle("button");
        labelStyle  = new GUIStyle("Label");


        regular = (Font)Resources.Load("Arial", typeof(Font));
        bold    = (Font)Resources.Load("Arial Bold", typeof(Font));

        box     = (Texture2D)Resources.Load("boxBack", typeof(Texture2D));
        button1 = (Texture2D)Resources.Load("buttonBack", typeof(Texture2D));
        button2 = (Texture2D)Resources.Load("buttonBack2", typeof(Texture2D));
        button3 = (Texture2D)Resources.Load("buttonBack3", typeof(Texture2D));
        black   = (Texture2D)Resources.Load("black", typeof(Texture2D));
    }
 public ShelterListTests()
 {
     sut = new Shelter();
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     Shelter = Shelter_update(Convert.ToInt32(Update_Shelter_GridView.SelectedValue));
 }
Ejemplo n.º 13
0
 public async Task AddShelterAsync(Shelter shelter)
 {
     _appDbContext.Shelters.Add(shelter);
     await _appDbContext.SaveChangesAsync();
 }
Ejemplo n.º 14
0
 [HttpPost]//done
 public ActionResult AddShelter(Shelter shelter)
 {
     db.AddShelter(shelter);
     return(RedirectToAction("PetAppAdmin", "Home"));
 }
        public Task Save(Shelter shelter)
        {
            var context = PersistenceContextFactory.CreateFor <Shelter>();

            return(Asyncer.Async(() => context.Save(shelter)));
        }
Ejemplo n.º 16
0
    public void StartShelterDay()
    {
        Shelter[] shelt = new Shelter[shelters.Count];
        int hold = 0;
        // for running through the new day things on the shelters 
        foreach (Shelter s in shelters)
        {
            // check if the shelter new day returns true and if it does it needs to be removed
            if (s.NewShelterDay())
            {
                shelt[hold] = s;
                hold++;
            }
        }

        if (!designateShelters)
        {
            for (int i = 0; i < shelt.Length; i++)
            {
                //any shelters that need to be removed have to have people in them killed and then remove the shetler 
                if (shelt[i] != null)
                {
                    KillShelterID(shelt[i].shelterID); // current just kill all humans but later by rehome dependind on cerumstance
                    Shelter holdShel = shelt[i];
                    shelters.Remove(holdShel); // remove and destroy the shelter
                    Destroy(holdShel.gameObject);
                }
            }
        }




    }
Ejemplo n.º 17
0
    void SetShelterRequirements(Shelter shelt)
    {
        foreach (Resource r in allResources)
        {
            if (r.user == ResourceUser.Shelter)
            {
                shelt.requirements.Add(r.requirementType);
            }
        }

    }
Ejemplo n.º 18
0
 public Shelter EditShelter(int id, Shelter shelter)
 {
     _context.Entry(shelter).State = EntityState.Modified;
     _context.SaveChanges();
     return(shelter);
 }
Ejemplo n.º 19
0
 public Shelter AddShelter(Shelter shelter)
 {
     _context.Shelter.Add(shelter);
     _context.SaveChanges();
     return(shelter);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// There are no comments for Shelters in the schema.
 /// </summary>
 public void AddToShelters(Shelter shelter)
 {
     base.AddObject("Shelters", shelter);
 }
 public Shelter Shelter_update(int ID)
 {
     Shelter = Shelter.Select(ID);
     Shelter.Shelter_ID = Convert.ToInt32(Update_Shelter_ID_txt.Text);
     Shelter.Address_ID = Convert.ToInt32(Update_Address_ID_txt.Text);
     Shelter.Shelter_Type = Update_Shelter_Type_txt.Text;
     Shelter.Max_Capacity = Convert.ToInt32(Update_Max_Capacity_txt.Text);
     Shelter.AllowsPets = Update_AllowsPets_txt.Text;
     Shelter.Update(Shelter);
     Insert_Shelter_GridView.DataBind();
     Update_Shelter_GridView.DataBind();
     Delete_Shelter_GridView.DataBind();
     return Shelter;
 }
Ejemplo n.º 22
0
 public async Task DeleteShelterAsync(Shelter shelter)
 {
     _appDbContext.Shelters.Remove(shelter);
     await _appDbContext.SaveChangesAsync();
 }
Ejemplo n.º 23
0
Archivo: Main.cs Proyecto: bilal614/OOD
        //public Shelter AnimalShelter { get { return animalShelter; } }

        public Main()
        {
            InitializeComponent();
            animalShelter = new Shelter("Eindhoven Animal Shelter", 999000999, "Fontys, Eindhoven", "*****@*****.**");
        }
 protected void INSERT(object sender, EventArgs e)
 {
     Shelter = Shelter_insert();
 }
 public void Post([FromBody] Shelter shelter)
 {
     _db.Shelters.Add(shelter);
     _db.SaveChanges();
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     Shelter = Update_Shelter_select(Convert.ToInt32(Update_Shelter_GridView.SelectedValue));
 }
Ejemplo n.º 27
0
        public ActionResult Shelter(int Id)
        {
            Shelter shelter = db.GetShelter(Id);

            return(View(shelter));
        }
Ejemplo n.º 28
0
 public ActionResult UpdateShelter(Shelter shelter)
 {
     return(View());
 }
Ejemplo n.º 29
0
 public void EditShelter(Shelter shelter)
 {
     _appDbContext.Shelters.Update(shelter);
     _appDbContext.SaveChanges();
 }
Ejemplo n.º 30
0
        private async Task Seed(IApplicationBuilder app)
        {
            using (var scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope())
            {
                var context = scope.ServiceProvider.GetRequiredService <ApplicationDbContext>();

                if (!context.Meals.Any())
                {
                    var path = $"{Path.Combine(Directory.GetCurrentDirectory(), "Data", "Files", "mealplan.csv")}";
                    using (Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
                    {
                        using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                        {
                            CsvReader csvReader = new CsvReader(reader);
                            csvReader.Configuration.Delimiter    = ";";
                            csvReader.Configuration.BadDataFound = x => { Console.WriteLine($"{x.RawRecord}"); };

                            while (csvReader.Read())
                            {
                                try
                                {
                                    var meal         = csvReader.GetRecord <MealCsvModel>();
                                    var foodName     = csvReader.GetField <string>("food_name");
                                    var carbohydrate = csvReader.GetField <string>("carbohydrate");
                                    var protein      = csvReader.GetField <string>("protein");
                                    var lipids       = csvReader.GetField <string>("lipids");
                                    var fibre        = csvReader.GetField <string>("fibre");
                                    var category     = csvReader.GetField <string>("category");
                                    var energy       = csvReader.GetField <string>("energy");
                                    var price        = csvReader.GetField <string>("price");

                                    var mealModel = new Meal
                                    {
                                        FoodName     = meal.food_name,
                                        Carbohydrate = meal.carbohydrate,
                                        Protein      = meal.protein,
                                        Liqids       = meal.lipids,
                                        Fibre        = meal.fibre,
                                        Energy       = meal.energy,
                                        Category     = meal.category,
                                        Price        = decimal.Parse(meal.price)
                                    };

                                    context.Add(mealModel);
                                }
                                catch (Exception e)
                                {
                                }
                            }

                            await context.SaveChangesAsync();
                        }
                    }
                }

                if (!context.Shelters.Any())
                {
                    var path = $"{Path.Combine(Directory.GetCurrentDirectory(), "Data", "Files", "Shelter.csv")}";
                    using (Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
                    {
                        using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
                        {
                            CsvReader csvReader = new CsvReader(reader);
                            csvReader.Configuration.Delimiter    = ";";
                            csvReader.Configuration.BadDataFound = x => { Console.WriteLine($"{x.RawRecord}"); };
                            while (csvReader.Read())
                            {
                                try
                                {
                                    var shelter = csvReader.GetRecord <ShelterCsvModel>();
                                    Console.WriteLine(shelter.name);
                                    var name           = csvReader.GetField <string>("name");
                                    var classification = csvReader.GetField <string>("classification");
                                    var province       = csvReader.GetField <string>("province");
                                    var longitude      = csvReader.GetField <string>("longitude");
                                    var latitude       = csvReader.GetField <string>("latitude");
                                    var area_type      = csvReader.GetField <string>("area_type");
                                    var ownership      = csvReader.GetField <string>("ownership");
                                    var district       = csvReader.GetField <string>("district");
                                    var sub_district   = csvReader.GetField <string>("sub_district");
                                    var postal_area    = csvReader.GetField <string>("postal_area");
                                    var postal_address = csvReader.GetField <string>("postal_address");
                                    var street_address = csvReader.GetField <string>("street_address");

                                    var shelterModel = new Shelter
                                    {
                                        Name           = shelter.name,
                                        Classification = shelter.classification,
                                        Province       = shelter.province,
                                        Longitude      = decimal.Parse(shelter.longitude),
                                        Latitude       = decimal.Parse(shelter.latitude),
                                        AreaType       = shelter.area_type,
                                        Ownership      = shelter.ownership,
                                        District       = shelter.district,
                                        SubDistrict    = shelter.sub_district,
                                        PostalAddress  = shelter.postal_address,
                                        PostalArea     = shelter.postal_area,
                                        PostalStreet   = shelter.street_address
                                    };


                                    context.Add(shelterModel);
                                }
                                catch (Exception e)
                                {
                                }
                            }
                            await context.SaveChangesAsync();
                        }
                    }
                }
            }
        }
Ejemplo n.º 31
0
 public bool CreateShelter(Shelter shelter)
 {
     database.Shelters.Add(shelter);
     return(Save());
 }
Ejemplo n.º 32
0
 public VirtualPetsTests()
 {
     pet     = new Pet();
     shelter = new Shelter();
 }
Ejemplo n.º 33
0
 public bool DeleteShelter(Shelter shelter)
 {
     database.Shelters.Remove(shelter);
     return(Save());
 }
 public void Put(int id, [FromBody] Shelter shelter)
 {
     shelter.ShelterId        = id;
     _db.Entry(shelter).State = EntityState.Modified;
     _db.SaveChanges();
 }
Ejemplo n.º 35
0
 public bool UpdateShelter(Shelter shelter)
 {
     database.Shelters.Update(shelter);
     return(Save());
 }
        public void Seed()
        {
            var account = new AddAccountDto()
            {
                Name        = "bob",
                Email       = "*****@*****.**",
                PhoneNumber = "222333444",
                Password    = "******",
                AccountRole = AccountRoles.Regular
            };

            if (!AccountService.AddAccount(account).Result.Successful)
            {
                throw new ApplicationException("Could not seed the database with a user");
            }

            var saveDogDog = new LostDog()
            {
                Breed       = "dogdog",
                Age         = 5,
                Size        = "Large, very large",
                Color       = "Orange but a bit yellow and green dots",
                SpecialMark = "tattoo of you on the neck",
                Name        = "Cat",
                Picture     = new PictureDog()
                {
                    FileName = "photo",
                    FileType = "png",
                    Data     = new byte[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
                },
                HairLength = "Long",
                EarsType   = "Short",
                TailLength = "None",
                Behaviors  = new List <DogBehavior>()
                {
                    new DogBehavior()
                    {
                        Behavior = "Angry"
                    }
                },
                Location = new LocationDog()
                {
                    City = "Biała", District = "Lol ther's none"
                },
                DateLost = new DateTime(2021, 3, 20),
                OwnerId  = 1,
                Comments = new List <LostDogComment>()
            };

            if (LostDogRepository.AddLostDog(saveDogDog).Result == null)
            {
                throw new ApplicationException("Could not seed the database with a dog assigned to user");
            }

            var shelter = new Shelter()
            {
                IsApproved  = true,
                Name        = $"VeryNiceShelter-1",
                PhoneNumber = $"2111111111",
                Email       = $"*****@*****.**",
                Address     = new Address
                {
                    City           = "Gdańsk",
                    PostCode       = "12-345",
                    Street         = "Bursztynowa",
                    BuildingNumber = "123"
                }
            };

            if (ShelterRepository.AddShelter(shelter).Result == null)
            {
                throw new ApplicationException("Could not seed the database with a shelter");
            }
        }
Ejemplo n.º 37
0
 public ShelterTest()
 {
     myShelter = new Shelter();
 }
Ejemplo n.º 38
0
 public Shelter Add(Shelter shelter)
 {
     _animalContext.Shelters.Add(shelter);
     _animalContext.SaveChanges();
     return(shelter);
 }
        private void Button_Click(object sender, RoutedEventArgs e)//find nearest shelter and draw path to it
        {
            //find nearest
            shelters.Sort((Shelter s1, Shelter s2) =>
            {
                return Math.Sqrt(Math.Pow(s1.Coordinate.Latitude - userCoordinate.Latitude, 2) + Math.Pow(s1.Coordinate.Longitude - userCoordinate.Longitude, 2)).CompareTo(
                        Math.Sqrt(Math.Pow(s2.Coordinate.Latitude - userCoordinate.Latitude, 2) + Math.Pow(s2.Coordinate.Longitude - userCoordinate.Longitude, 2)));
            });
            nearest = shelters[0];
            alternative = shelters[1];
            Mygeocodequery = new GeocodeQuery();
            Mygeocodequery.SearchTerm = nearest.Adress;
            Mygeocodequery.GeoCoordinate = nearest.Coordinate;
            Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            Mygeocodequery.QueryAsync();

            Mygeocodequery1 = new GeocodeQuery();
            Mygeocodequery1.SearchTerm = alternative.Adress;
            Mygeocodequery1.GeoCoordinate = alternative.Coordinate;
            Mygeocodequery1.QueryCompleted += Mygeocodequery_QueryCompleted1;
            Mygeocodequery1.QueryAsync();
        }
Ejemplo n.º 40
0
 private void Start()
 {
     shelter = GetComponent <Shelter>();
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Create a new Shelter object.
 /// </summary>
 /// <param name="id">Initial value of Id.</param>
 public static Shelter CreateShelter(int id)
 {
     Shelter shelter = new Shelter();
     shelter.Id = id;
     return shelter;
 }