Exemple #1
0
        private List <SectionFacility> GenerateSectionRoads(DataSet sectionNetworkDefinition)
        {
            List <SectionFacility> sectionRoads    = new List <SectionFacility>();
            SectionFacility        currentFacility = null;

            foreach (DataRow sectionRow in sectionNetworkDefinition.Tables[0].Rows)
            {
                if (currentFacility != null)
                {
                    if (sectionRow["FACILITY"].ToString() != currentFacility.Name)
                    {
                        sectionRoads.Add(currentFacility);
                        currentFacility = new SectionFacility(sectionRow["FACILITY"].ToString());
                    }
                    currentFacility.Sections.Add(new Section(sectionRow["SECTION"].ToString()));
                }
                else
                {
                    currentFacility = new SectionFacility(sectionRow["FACILITY"].ToString());
                    currentFacility.Sections.Add(new Section(sectionRow["SECTION"].ToString()));
                }
            }
            if (currentFacility != null)
            {
                sectionRoads.Add(currentFacility);
            }

            return(sectionRoads);
        }
Exemple #2
0
        /// <summary>
        /// Checks to see whether or not a given segment exists in the NETWORK_DEFINITION table.
        /// </summary>
        /// <param name="segToValidate">network definition information to check against the NETWORK_DEFINITION table.</param>
        private void ValidateSection(Segment segToValidate)
        {
            SectionFacility networkFacility = sectionRoads.Find(delegate(SectionFacility f) { return(f.Name == segToValidate.Facility); });

            if (networkFacility != null)
            {
                Section networkSection = networkFacility.Sections.Find(delegate(Section s) { return(segToValidate.Section == s.Name); });
                if (networkSection == null)
                {
                    segToValidate.AddError(segToValidate.Facility + " " + segToValidate.Section + " does not exist in the network defintion.");
                    segToValidate.Exclude = true;
                }
            }
            else
            {
                segToValidate.AddError(segToValidate.Facility + " " + segToValidate.Section + " does not exist in the network defintion.");
                segToValidate.Exclude = true;
            }
        }