Пример #1
0
        static void Main(string[] args)
        {
            var connectionString = "mongodb://localhost";
            var client = new MongoClient(connectionString);
            var server = client.GetServer();
            var database = server.GetDatabase("ThatConference");
            var collection = database.GetCollection<Housing>("Housing");

            var entity = new Housing { Type = "Tent" };
            collection.Insert(entity);
            var id = entity.Id;

            var query = Query<Housing>.EQ(e => e.Id, id);

            var foundEntity = collection.FindOne(query);
            Console.WriteLine(entity.Type);

            foundEntity.Type = "Yurt";
            collection.Save(foundEntity);
            Console.WriteLine(foundEntity.Type);

            var update = Update<Housing>.Set(e => e.Type, "Cabin");
            collection.Update(query, update);

            collection.Remove(query);
            Console.WriteLine("Removed");
            Console.WriteLine("Press any Key to Exit");
            Console.ReadKey();
        }
Пример #2
0
        /// <summary>
        /// Handles the "Purchase List Page" header and responses.
        /// </summary>
        /// <param name="page">The page we're building.</param>
        private void PurchaseHouseLayoutListPageInit(DialogPage page)
        {
            var player           = GetPC();
            var playerId         = GetObjectUUID(player);
            var dbPlayer         = DB.Get <Player>(playerId);
            var seedRank         = dbPlayer.SeedProgress.Rank;
            var availableLayouts = Housing.GetActiveHouseTypes();
            var model            = GetDataModel <Model>();

            page.Header = "You can purchase any of the following layouts. Please note that this list is restricted based on your current SeeD rank. Complete missions to raise your SeeD rank and unlock new layouts.\n\n" +
                          ColorToken.Green("Your SeeD Rank: ") + seedRank;

            foreach (var layout in availableLayouts)
            {
                // Player's SeeD rank isn't high enough to purchase this layout.
                if (seedRank < layout.Value.RequiredSeedRank)
                {
                    continue;
                }

                page.AddResponse(layout.Value.Name, () =>
                {
                    model.SelectedHouseType = layout.Key;
                    ChangePage(PurchaseHouseLayoutDetailPageId);
                });
            }
        }
Пример #3
0
        public IActionResult Put(long id, [FromBody] JToken housing)
        {
            string username = AuthController.CurrentUserName(Request);

            if (String.IsNullOrEmpty(username))
            {
                return(Unauthorized());
            }

            Housing oldHousing = context.Housing.Find(id);

            if (oldHousing == null)
            {
                return(NotFound());
            }

            try
            {
                oldHousing.UpdateFromHousingViewModel(context, housing, username);
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Ok(housing));
        }
Пример #4
0
        public static void StartFurnitureConversation()
        {
            var player = OBJECT_SELF;
            var area   = GetArea(player);
            var item   = StringToObject(Events.GetEventData("ITEM_OBJECT_ID"));

            if (!Housing.CanPlaceFurniture(player, item))
            {
                return;
            }

            Events.SkipEvent();

            var furnitureTypeId = (int)Housing.GetFurnitureTypeFromItem(item);
            var targetLocation  = Location(area,
                                           Vector(
                                               (float)Convert.ToDouble(Events.GetEventData("TARGET_POSITION_X")),
                                               (float)Convert.ToDouble(Events.GetEventData("TARGET_POSITION_Y")),
                                               (float)Convert.ToDouble(Events.GetEventData("TARGET_POSITION_Z"))),
                                           0.0f);

            SetLocalInt(player, "TEMP_FURNITURE_TYPE_ID", furnitureTypeId);
            SetLocalObject(player, "TEMP_FURNITURE_OBJECT", item);
            SetLocalLocation(player, "TEMP_FURNITURE_LOCATION", targetLocation);
            Dialog.StartConversation(player, player, nameof(PlayerHouseFurnitureDialog));
        }
Пример #5
0
        public void Test_Pdf_160000643_Egid()
        {
            // Given
            var data = @"Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
Bahnhofstrasse 7a, 6210 Sursee
Bahnhofstrasse 7b, 6210 Sursee
Centralstrasse 8a, 6210 Sursee
Centralstrasse 8b, 6210 Sursee
Gemeinde Eidg. Gebäudeidentifikator 160 000 643
1103 Sursee
Parzellennummer
GB-Kreis ParzNr. Amtliche Gebäudenummer
423 370 224
Gebäudestatus bestehend Gebäudekategorie Gebäude mit teilweiser 
Wohnnutzung
Baujahr Renovation Abbruch
Gebäudefläche (in m²) Anz. Geschosse
2080 6
2002 2001-2005 - 
Utilisateur Invité
Druckdatum: 25.07.2018 13:58 1 2
/";

            // When
            AnalysePdfData apd         = new AnalysePdfData();
            List <string>  housingList = apd.ConvertTextToList(data);
            Housing        housing     = apd.AnalysePdf(housingList, data);

            // Then
            Assert.AreEqual("160000643".Replace(" ", string.Empty), housing.Egid);
            Assert.IsNull(housing.Abbruch);
            Assert.AreEqual("2080", housing.GebFlaeche);
            Assert.AreEqual("2002", housing.Baujahr1);
        }
Пример #6
0
        public Housing AnalysePdf(List <string> dataList, string orignialData)
        {
            Housing housing = new Housing
            {
                GuidEgid     = Guid.NewGuid().ToString(),
                HousingEdids = new List <HousingEdid>(),
                Blob         = orignialData
            };

            List <string> languageSettings = IdentifyLanguage(dataList);

            // Analyse Gemeinde
            AnalyseCommunityTag(dataList, housing, languageSettings);

            // Analyse Parzellennummer
            AnalyseParcelInformation(dataList, housing, languageSettings);

            // Analyse Gebäudestatus
            AnalydeBuildingStatus(dataList, housing, languageSettings);

            // Analyse Baujahr
            AnalyseConstructionYear(dataList, housing, languageSettings);

            // Analyse EDID/EWID
            AnalyseEdidEwid(dataList, housing);

            return(housing);
        }
Пример #7
0
        public void AnalyseConstructionYear_AllOnOne()
        {
            string data = @"Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
Stapfackerstrasse 3, 4658 Däniken SO
Gemeinde Eidg. Gebäudeidentifikator 190 009 706
2572 Däniken
Parzellennummer
GB-Kreis ParzNr. Amtliche Gebäudenummer
0 1922 
Gebäudestatus Gebäudekategorie
bestehend Mehrfamilienhaus, ohne
Nebennutzung
Baujahr Renovation Abbruch
Gebäudefläche (in m²) 260 Anz. Geschosse 1
2003 2001-2005 - 
Utilisateur Invité
Druckdatum: 12.07.2018 07:48 1 2
/";

            Housing housing = new Housing();

            // Act
            AnalysePdfData apd         = new AnalysePdfData();
            List <string>  housingList = apd.ConvertTextToList(data);

            housing = apd.AnalysePdf(housingList, data);

            // Assert
            Assert.AreEqual("190009706", housing.Egid);
            Assert.AreEqual("260", housing.GebFlaeche);
            Assert.AreEqual("1", housing.AnzGeschosse);
        }
Пример #8
0
        public void Test_Pdf_302034483_Egid()
        {
            // Given
            var data = @"Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
Turbinenstrasse 31, 8005 Zürich
Gemeinde Eidg. Gebäudeidentifikator 302 034 483
261 Zürich
Parzellennummer
GB-Kreis ParzNr. Amtliche Gebäudenummer
283 6939 75931
Gebäudestatus Gebäudekategorie
bestehend Wohngebäude mit Nebennutzung
Baujahr Renovation Abbruch Gebäudefläche (in m²) Anz. Geschosse
439 11
2012 2011-2015 - 
Utilisateur Invité
Druckdatum: 25.07.2018 13:57 1 3
/";

            // When
            AnalysePdfData apd         = new AnalysePdfData();
            List <string>  housingList = apd.ConvertTextToList(data);
            Housing        housing     = apd.AnalysePdf(housingList, data);

            // Then
            Assert.AreEqual("302034483".Replace(" ", string.Empty), housing.Egid);
            Assert.IsNull(housing.Abbruch);
            Assert.AreEqual("439", housing.GebFlaeche);
            Assert.AreEqual("2012", housing.Baujahr1);
        }
Пример #9
0
        public async Task CreateAsync(HousingDto housingDto)
        {
            housingDto            = housingDto ?? throw new ArgumentNullException(nameof(housingDto));
            housingDto.Place.Type = "Housing type";

            await _repositoryPlace.CreateAsync(housingDto.Place);

            var housing = new Housing
            {
                Place       = housingDto.Place,
                Name        = housingDto.Name,
                UserId      = housingDto.UserId,
                User        = housingDto.User,
                BookedFrom  = housingDto.BookedFrom,
                BookedTo    = housingDto.BookedTo,
                PricePerDay = housingDto.PricePerDay,
                Scenery     = housingDto.Scenery,
                Description = housingDto.Description,
                Address     = housingDto.Address
            };

            await _repositoryHousing.CreateAsync(housing);

            await _repositoryHousing.SaveChangesAsync();
        }
Пример #10
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtId.Text))
            {
                return;
            }

            Housing housing = new Housing
            {
                Id   = Convert.ToInt32(txtId.Text),
                Name = txtName.Text
            };

            var result = _housingManager.Update(housing);

            if (result.HasError())
            {
                string firstError = result.Errors.FirstOrDefault();

                MessageBox.Show(firstError, "Hata!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                ClearAllBase();
                FillDataGridView();

                MessageBox.Show("Güncelleme Başarıyla Yapıldı:)", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #11
0
        private static Housing CreateHousingRadnom(ApplicationDbContext DbContext)
        {
            var houseType = DbContext.TypesHousing.ToList()[Random.Next(0, DbContext.TypesHousing.Count())];
            var city      = DbContext.Cities.ToList()[Random.Next(0, DbContext.Cities.Count())];;
            var district  = DbContext.Districts.ToList()[Random.Next(0, DbContext.Districts.Count())];;
            var street    = DbContext.Streets.ToList()[Random.Next(0, DbContext.Streets.Count())];;

            var     sum  = Random.Next(5, 30) * 1000;
            Housing item = new Housing()
            {
                City         = city,
                Street       = street,
                District     = district,
                TypesHousing = houseType,
                Comment      = Descriptions[Random.Next(0, Descriptions.Length)],
                Sum          = sum,
                Phones       = new List <HousingPhone> {
                    new HousingPhone {
                        Number = "+123456789"
                    }
                }
            };

            return(item);
        }
Пример #12
0
 public static void UpdateHouseVector(Shape rect, TextBlock data, Housing house, HouseStatus status)
 {
     if (status == HouseStatus.Unknown)
     {
         data.Text   = "?";
         rect.Stroke = GrayStroke;
         rect.Fill   = GrayFill;
     }
     else if (status == HouseStatus.ProbablyProtected)
     {
         data.Text   = "";
         rect.Stroke = ProbablyStroke;
         rect.Fill   = ProbablyFill;
     }
     else if (status == HouseStatus.Demolishing)
     {
         data.Text   = TimeLeftString(house.taxPayedTime);
         rect.Stroke = RedStroke;
         rect.Fill   = RedFill;
     }
     else
     {
         //house is tax protected
         data.Text   = "";
         rect.Stroke = SmallHouse.GreenStroke;
         rect.Fill   = SmallHouse.GreenFill;
     }
 }
Пример #13
0
        /// <summary>
        /// Handles the "Sell House Page" header and responses.
        /// </summary>
        /// <param name="page">The page we're building.</param>
        private void SellHousePageInit(DialogPage page)
        {
            var player   = GetPC();
            var playerId = GetObjectUUID(player);
            var dbHouse  = DB.Get <PlayerHouse>(playerId);
            var model    = GetDataModel <Model>();

            var houseDetail = Housing.GetHouseTypeDetail(dbHouse.HouseType);
            var gil         = houseDetail.Price / 2;

            page.Header = ColorToken.Red("WARNING: ") + "You are about to sell your property. All items contained inside will be permanently lost!\n\n" +
                          "It is highly recommended you pick up all items and furniture inside before selling the property.\n\n" +
                          ColorToken.Green($"You will receive {gil} gil for the sale of this property. Are you sure you wish to sell it?");

            if (model.IsConfirmingSell)
            {
                page.AddResponse(ColorToken.Red($"CONFIRM SELL PROPERTY"), () =>
                {
                    DB.Delete <PlayerHouse>(playerId);

                    GiveGoldToCreature(player, gil);
                    FloatingTextStringOnCreature($"Property sold successfully for {gil} gil.", player, false);
                    EndConversation();

                    Log.Write(LogGroup.PlayerHousing, $"Player {GetName(player)} (ID = '{playerId}') sold their property for {gil} gil.");
                });
            }
            else
            {
                page.AddResponse(ColorToken.Red("Sell Property"), () =>
                {
                    model.IsConfirmingSell = true;
                });
            }
        }
Пример #14
0
        public async Task <IHttpActionResult> PostHousing(HousingPost housingPost)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Housing housing = new Housing()
            {
                PostBox           = housingPost.PostBox,
                ZipCode           = housingPost.ZipCode,
                BedType           = housingPost.BedType,
                StartDate         = housingPost.StartDate,
                EndDate           = housingPost.EndDate,
                AddDate           = DateTime.Now,
                EditDate          = DateTime.Now,
                Number            = housingPost.Number,
                Street            = housingPost.Street,
                City              = housingPost.City,
                SpaceLocalization = housingPost.SpaceLocalization,
                Description       = housingPost.Description,
                Pictures          = housingPost.Pictures,
                Wifi              = housingPost.Wifi,
                Kitchen           = housingPost.Kitchen,
                Office            = housingPost.Office,
                Toilet            = housingPost.Toilet,
                Shower            = housingPost.Shower
            };

            housing.Host = db.UserDB.First(u => u.ID == User.Identity.Name);
            db.HousingDB.Add(housing);
            await db.SaveChangesAsync();

            return(Created("api/Housings/", housing));
        }
Пример #15
0
        public IActionResult Post([FromBody] EmployeeViewModel employee)
        {
            Employee oldEmployee = context.Employees.Find(employee.employeeID);

            if (oldEmployee != null)
            {
                return(BadRequest("DuplicateEmployeeID"));
            }

            try
            {
                Employee newEmployee = new Employee();
                newEmployee.EmployeeID = employee.employeeID;
                newEmployee.UpdateFromEmployeeViewModel(context, employee);
                context.Employees.Add(newEmployee);

                Housing housing = new Housing();
                housing.HousingID = newEmployee.EmployeeID;
                housing.employee  = newEmployee;
                context.Housing.Add(housing);

                context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Ok(employee));
        }
Пример #16
0
        public ActionResult Edit(int id, Housing housingRequest)
        {
            try
            {
                housingRequest.LocationsList = GetAllLocations();
                if (ModelState.IsValid)
                {
                    Housing housing = db.Housings.SingleOrDefault(h => h.HousingId.Equals(id));

                    if (TryUpdateModel(housing))
                    {
                        housing.Link       = housingRequest.Link;
                        housing.Price      = housingRequest.Price;
                        housing.NoOfRooms  = housingRequest.NoOfRooms;
                        housing.LocationId = housingRequest.LocationId;
                        db.SaveChanges();
                    }
                    return(RedirectToAction("Index"));
                }
                return(View(housingRequest));
            }
            catch (Exception)
            {
                return(View(housingRequest));
            }
        }
Пример #17
0
    public GameObject CreateHouse(int x, int y, GameObject connectedRoad, int angle, float density, int worldSize = 100)
    {
        // Dropping ground
        GameObject groundPrefab = grounds[rnd.Next(0, grounds.Count)];
        Vector2Int ActualPos    = ComputePosition(new Vector2Int(x, y), worldSize, groundPrefab);
        GameObject g            = GameObject.Instantiate(groundPrefab, new Vector3(ActualPos.x, 0, ActualPos.y), Quaternion.identity);

        g.transform.Rotate(new Vector3(-90, 0, 0));
        g.transform.parent = buildParent.transform;
        // Computing Ground height
        Renderer groundRenderer = g.GetComponent <Renderer>();
        float    groundLevel    = groundRenderer.bounds.size.y;
        // Dropping First floor
        GameObject housePrefab = houses[rnd.Next(0, houses.Count)];

        ActualPos = ComputePosition(new Vector2Int(x, y), worldSize, housePrefab);
        GameObject rdc = GameObject.Instantiate(housePrefab, new Vector3(ActualPos.x, groundLevel, ActualPos.y), Quaternion.identity);

        rdc.transform.Rotate(new Vector3(-90, angle, 0));
        rdc.transform.parent = g.transform;

        AsignWaypoint(rdc, connectedRoad, angle);
        Housing housing = rdc.GetComponent <Housing>();

        housing.nbFloors = 1;
        housing.density  = density;

        return(rdc);
    }
Пример #18
0
        public async Task <ActionResult <Housing> > PostHousing(Housing housing)
        {
            _context.Housings.Add(housing);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetHousing", new { id = housing.Housing_Id }, housing));
        }
Пример #19
0
        public async Task <IActionResult> PutHousing(int id, Housing housing)
        {
            if (id != housing.Housing_Id)
            {
                return(BadRequest());
            }

            _context.Entry(housing).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HousingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #20
0
        public async Task <IHttpActionResult> PutHousing(int id, Housing housing)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != housing.Id)
            {
                return(BadRequest());
            }

            db.Entry(housing).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HousingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #21
0
        public void GetFarms()
        {
            _farms.Clear();
            List <Creature> creatureList = Host.getCreatures().Where(x => x.type == BotTypes.Housing).ToList();

            Parallel.ForEach(creatureList, new Action <Creature>(farm =>
            {
                Housing _farm = farm as Housing;
                Parallel.ForEach(Host.me.family.getMembers(), new Action <FamilyMember>(x =>
                {
                    if ((_farm.ownerName == x.name) && (_farm.access == HouseAccess.Guild || _farm.access == HouseAccess.Family))
                    {
                        if (!_farms.Contains(_farm))
                        {
                            _farms.Add(_farm);
                        }
                    }
                }));
                if (_farm.ownerName == Host.me.name)
                {
                    if (!_farms.Contains(_farm))
                    {
                        _farms.Add(_farm);
                    }
                }
            }));
        }
Пример #22
0
        /// <summary>
        /// Populate the housing table.
        /// </summary>
        /// <returns></returns>
        private async Task RebuildFurnitureCache()
        {
            using (var db = new SQLiteConnection(_connectionString))
            {
                var _housing = new Housing(_gameInfo.GameDirectory, _gameInfo.GameLanguage);
                var list     = await _housing.GetUncachedFurnitureList();

                db.Open();
                using (var transaction = db.BeginTransaction())
                {
                    foreach (var item in list)
                    {
                        var query = @"
                            insert into housing ( name,  category,  subcategory,  primary_id,  icon_id) 
                                          values($name, $category, $subcategory, $primary_id, $icon_id)";
                        using (var cmd = new SQLiteCommand(query, db))
                        {
                            cmd.Parameters.AddWithValue("name", item.Name);
                            cmd.Parameters.AddWithValue("category", item.SecondaryCategory);
                            cmd.Parameters.AddWithValue("subcategory", item.TertiaryCategory);
                            cmd.Parameters.AddWithValue("icon_id", item.IconNumber);
                            cmd.Parameters.AddWithValue("primary_id", item.ModelInfo.PrimaryID);
                            cmd.ExecuteScalar();
                        }
                    }
                    transaction.Commit();
                }
            }
        }
Пример #23
0
        private void AnalyseParcelInformation(List <string> dataList, Housing housing, List <string> languageSettings)
        {
            List <int> indicesCommunity = dataList.Select((s, y) => new { Str = s, Index = y })
                                          .Where(x => x.Str.Contains(languageSettings[2]))
                                          .Select(x => x.Index).ToList();

            if (indicesCommunity.Count == 1)
            {
                if (dataList[indicesCommunity[0] + 3].Contains(languageSettings[3]))
                {
                    List <string> parz = SplitLine(dataList[indicesCommunity[0] + 2], 3);
                    housing.GbKreis  = parz[0];
                    housing.ParzNr   = parz[1];
                    housing.AmtGebnr = parz[2];
                }
                else
                {
                    Logger.Error("Parzellennummer identifikation went wrong");
                }
            }
            else
            {
                Logger.Error("More than one Parzellennummer tag found");
            }
        }
Пример #24
0
        public async Task <IHttpActionResult> DeleteHousing(int id)
        {
            Housing housing = await db.HousingDB.FindAsync(id);

            if (housing == null)
            {
                return(NotFound());
            }

            /*
             * IEnumerable<Notation> notations = db.NotationDB.Where(note => note.Housing.ID == id);
             *
             * if (notations != null)
             * {
             *  foreach (var note in notations)
             *  {
             *      db.NotationDB.Remove(note);
             *  }
             * }
             *
             * IEnumerable<Message> messages = db.MessageDB.Where(mess => mess.Housing != null && mess.Housing.ID == id);
             *
             * if (messages != null)
             * {
             *  foreach (var mess in messages)
             *  {
             *      db.MessageDB.Remove(mess);
             *  }
             * }
             */
            db.HousingDB.Remove(housing);
            await db.SaveChangesAsync();

            return(Ok(housing));
        }
Пример #25
0
        public void Test_Pdf_191544631_Egid()
        {
            // Given
            var data = @"Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
Schulhausweg 7, 4571 Lüterkofen
Gemeinde Eidg. Gebäudeidentifikator 191 544 631
2455 Lüterkofen-Ichertswil
Parzellennummer
GB-Kreis ParzNr. Amtliche Gebäudenummer
0 1572 
Gebäudestatus Gebäudekategorie
bestehend Einfamilienhaus, ohne 
Nebennutzung
Baujahr Renovation Abbruch
Gebäudefläche (in m²) Anz. Geschosse
105 2
2017 Nach 2015 - 
Utilisateur Invité
Druckdatum: 25.07.2018 13:57 1 2
/";

            // When
            AnalysePdfData apd         = new AnalysePdfData();
            List <string>  housingList = apd.ConvertTextToList(data);
            Housing        housing     = apd.AnalysePdf(housingList, data);

            // Then
            Assert.AreEqual("191 544 631".Replace(" ", string.Empty), housing.Egid);
            Assert.IsNull(housing.Abbruch);
            Assert.AreEqual("105", housing.GebFlaeche);
            Assert.AreEqual("2017", housing.Baujahr1);
        }
Пример #26
0
        private void AnalyseEdidEwid(List <string> dataList, Housing housing)
        {
            List <int> indicesEdids = dataList.Select((s, y) => new { Str = s, Index = y })
                                      .Where(x => x.Str.Contains("EDID"))
                                      .Select(x => x.Index).ToList();

            for (int n = 0; n < indicesEdids.Count; n++)
            {
                string tempGuidEgid = Guid.NewGuid().ToString();
                string toAnalyse    = dataList[indicesEdids[n] + 1];
                //0 Schulhausweg 7 4571 Lüterkofen
                List <string>          edid = AnalyseEdidValue(toAnalyse);
                List <HousingEgidEwid> hee  = new List <HousingEgidEwid>();

                // Analyse EWID
                //for (int n = 0; n < indicesEdids.Count; n++)
                //{
                int start = indicesEdids[n];

                int end = dataList.Count - start;

                if (n + 1 <= indicesEdids.Count - 1)
                {
                    end = indicesEdids[n + 1] - start;
                }

                //
                var sublist = dataList.GetRange(start, end);

                List <int> allIndicesEgidEwid = sublist.Select((s, y) => new { Str = s, Index = y })
                                                .Where(x => x.Str.Contains("EGID/EWID"))
                                                .Select(x => x.Index).ToList();

                if (allIndicesEgidEwid.Count > 0)
                {
                    AnalyseEwidValues(tempGuidEgid, hee, sublist);
                }

                if (edid.Count == 5)
                {
                    housing.HousingEdids.Add(
                        new HousingEdid
                    {
                        GuidEdid          = tempGuidEgid,
                        GuidEgidReference = housing.GuidEgid,
                        Edid             = edid[0],
                        Strasse          = edid[1],
                        Eingangnummer    = edid[2],
                        Plz              = edid[3],
                        Ort              = edid[4],
                        HousingEgidEwids = hee
                    });
                }
                else
                {
                    Logger.Error("Edid missing");
                }
            }
        }
Пример #27
0
    public void OnLoadDependencies(object savedData)
    {
        var data       = (Dictionary <string, object>)savedData;
        var houseIndex = (int?)data["house"];

        House            = houseIndex.HasValue ? SaveManager.GetInstance().FindLoadedInstanceBySaveIndex(houseIndex.Value).GetComponent <Housing>() : null;
        assignedLocation = (int)data["assignedLocation"] == -1 ? null : SaveManager.GetInstance().FindLoadedInstanceBySaveIndex((int)data["assignedLocation"]).GetComponent <Assignable>();
    }
Пример #28
0
        public IActionResult DeleteConfirmed(int id)
        {
            Housing housing = _context.Housing.Single(m => m.Id == id);

            _context.Housing.Remove(housing);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #29
0
 public void SetHome(Housing house)
 {
     home.GetComponent <Housing>().RemoveResident(me);
     home           = house;
     walkTarget     = null;
     targetSchedule = Schedule.NONE;
     activeSchedule = Schedule.NONE;
 }
Пример #30
0
        public ActionResult DeleteConfirmed(int id)
        {
            Housing housing = db.Housings.Find(id);

            db.Housings.Remove(housing);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #31
0
        public void Test_Pdf_190009706_Egid_Edid_Egid()
        {
            // Given
            string data = @"Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
Stapfackerstrasse 3, 4658 Däniken SO
Gemeinde Eidg. Gebäudeidentifikator 190 009 706
2572 Däniken
Parzellennummer
GB-Kreis ParzNr. Amtliche Gebäudenummer
0 1922 
Gebäudestatus Gebäudekategorie
bestehend Mehrfamilienhaus, ohne
Nebennutzung
Baujahr Renovation Abbruch
Gebäudefläche (in m²) Anz.Geschosse
319 4
2003 2001-2005 - 
Utilisateur Invité
Druckdatum: 12.07.2018 07:48 1 2
/Eidgenössisches Departement des Innern EDI
Bundesamt für Statistik
EDID Strasse Eingangsnummer PLZ Ort
0 Stapfackerstrasse 3 4658 Däniken SO
EGID/EWID AdminNr PhysNr Stockwerk Lage Wohnungs status
190009706 002  Parterre Rechts bestehend
190009706
001  Parterre Links bestehend
190009706
010  Parterre, mehrgeschoss.Mitte bestehend
190009706 004  1. Stock Rechts bestehend
190009706
003  1. Stock Links bestehend
190009706
007  2. Stock Rechts bestehend
190009706 005  2. Stock Links bestehend
190009706
006  2. Stock, mehrgeschoss.Mitte bestehend
190009706
008  3. Stock, mehrgeschoss. 5 1/2 Zimmer 1.DG/2. DG bestehend
190009706
009  3. Stock, mehrgeschoss. 5 1/2 Zimmer 1. DG/2. DG bestehend
Utilisateur Invité
Druckdatum: 12.07.2018 07:48 2 2
/";

            // Then
            AnalysePdfData apd         = new AnalysePdfData();
            List <string>  housingList = apd.ConvertTextToList(data);
            Housing        housing     = apd.AnalysePdf(housingList, data);

            // Assert

            Assert.AreEqual("190009706", housing.HousingEdids.FirstOrDefault().HousingEgidEwids.LastOrDefault().EgidEwid);
            Assert.AreEqual("009", housing.HousingEdids.FirstOrDefault().HousingEgidEwids.LastOrDefault().Ewid);
            Assert.AreEqual("3. Stock, mehrgeschoss.", housing.HousingEdids.FirstOrDefault().HousingEgidEwids.LastOrDefault().Stockwerk);
            Assert.AreEqual("bestehend", housing.HousingEdids.FirstOrDefault().HousingEgidEwids.LastOrDefault().WohnungStatus);
        }