/// <summary>
 /// Initializes a new instance of the <see cref="GraveLocation"/> class.
 /// </summary>
 /// <param name="id">The ID of the grave location.</param>
 /// <param name="number">The number of the grave location.</param>
 /// <param name="sectionNumber">The section number of the grave location.</param>
 /// <param name="rowNumber">The row number of the grave location.</param>
 /// <param name="numberInRow">The number in row of the grave location.</param>
 /// <param name="state">The state of the grave location.</param>
 /// <param name="location">The location of the grave location.</param>
 public GraveLocation(int id, int number, int sectionNumber, int rowNumber, GraveLocationState state, PointFloat location)
 {
     this.ID = id;
     this.Number = number;
     this.SectionNumber = sectionNumber;
     this.RowNumber = rowNumber;
     this.State = state;
     this.Location = location;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Map"/> class.
 /// </summary>
 /// <param name="id">The ID of the map.</param>
 /// <param name="filePath">The file path of the image of the map.</param>
 /// <param name="startDate">The start date of the map.</param>
 /// <param name="endDate">The end date of the map.</param>
 /// <param name="location">The location of the map.</param>
 public Map(int id, string filePath, DateTime startDate, DateTime endDate, PointFloat locationLeftTop, PointFloat locationRightBottom)
 {
     this.ID = id;
     this.FilePath = filePath;
     this.StartDate = startDate;
     this.EndDate = endDate;
     this.LocationLeftTop = locationLeftTop;
     this.LocationRightBottom = locationRightBottom;
 }
Ejemplo n.º 3
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;
        }