Ejemplo n.º 1
0
        public void AddGraveLocation(GraveLocation graveLocation)
        {
            if (graveLocation == null)
            {
                throw new ArgumentNullException("GraveSpread can not be null.");
            }

            this.GraveLocations.Add(graveLocation);
        }
Ejemplo n.º 2
0
        private static Cemetery ParseCemetery(DataTable dataTable)
        {

            DataRow firstRow = dataTable.Rows[0];
            int cemeteryID = (int)firstRow["BEG_ID"];
            string name = firstRow["BEG_NAAM"].ToString();
            string address = firstRow["BEG_ADRES"].ToString();
            string postalCode = firstRow["BEG_POSTCODE"].ToString();
            string residence = firstRow["BEG_PLAATS"].ToString();

            int mapID = (int)firstRow["PL_ID"];
            string mapFilePath = firstRow["PL_BESTANDSNAAM"].ToString();
            DateTime mapStartDate = DateTime.Parse(firstRow["PL_STARTDATUM"].ToString());
            DateTime mapEndDate = DateTime.Parse(firstRow["PL_EINDDATUM"].ToString());

            float locationLeftTopX = (float)firstRow["PL_LINKSBOVENX"];
            float locationLeftTopY = (float)firstRow["PL_LINKSBOVENY"];
            float locationRightBottomX = (float)firstRow["PL_RECHTSONDERX"];
            float locationRightBottomY = (float)firstRow["PL_RECHTSONDERY"];

            PointFloat locationLeftTop = new PointFloat(locationLeftTopX, locationLeftTopY);
            PointFloat locationRightBottom = new PointFloat(locationRightBottomX, locationRightBottomY);
            Map map = new Map(mapID, mapFilePath, mapStartDate, mapEndDate, locationLeftTop, locationRightBottom);

            Cemetery cemetery = new Cemetery(cemeteryID, name, address, postalCode, residence, map);

            foreach (DataRow row in dataTable.Rows)
            {
                int graveLocationID = (int)row["GL_ID"];

                GraveLocation graveLocation = cemetery.GraveLocations.Find(gl => gl.ID == graveLocationID);

                if (graveLocation == null)
                {
                    int graveLocationNumber = (int)row["GL_NUMMER"];
                    int graveLocationSectionNumber = (int)row["GL_VAK"];
                    int graveLocationRowNumber = (int)row["GL_RIJ"];

                    GraveLocationState graveLocationState = (GraveLocationState)Enum.Parse(typeof(GraveLocationState), row["GL_STATUS"].ToString());

                    float graveLocationLocationX = (float)row["GL_COORDINATENX"];
                    float graveLocationLocationY = (float)row["GL_COORDINATENY"];

                    PointFloat graveLocationLocation = new PointFloat(graveLocationLocationX, graveLocationLocationY);

                    graveLocation = new GraveLocation(graveLocationID, graveLocationNumber, graveLocationRowNumber, graveLocationSectionNumber, graveLocationState, graveLocationLocation);

                    cemetery.AddGraveLocation(graveLocation);
                }

                Object gravesSpreadIDUnparsed = row["gs_ID"];

                if (gravesSpreadIDUnparsed != null)
                {
                    int graveSpreadID = (int)row["GS_ID"];

                    GraveSpread graveSpread = cemetery.GraveSpreads.Find(gs => gs.ID == graveSpreadID);

                    if (graveSpread == null)
                    {
                        DateTime startTime = DateTime.Parse(row["GS_STARTDATUM"].ToString());
                        DateTime endTime = DateTime.Parse(row["GS_EINDDATUM"].ToString());
                        graveSpread = new GraveSpread(graveSpreadID, startTime, endTime);
                    }

                    graveSpread.AddGraveLocation(graveLocation);
                }
            }

            return cemetery;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Remove a <see cref="GraveLocation"/> objection from this cemetery.
 /// </summary>
 /// <param name="graveLocation">The <see cref="GraveLocation"/> object to be removed.</param>
 public void RemoveGraveLocation(GraveLocation graveLocation)
 {
     throw new NotImplementedException();
 }