Ejemplo n.º 1
0
        public BudgetSegregation(XmlNode nodBS, DoDBase dod)
            : base(nodBS.SelectSingleNode("Name").InnerText)
        {
            DoD         = dod;
            Folder      = ProjectManager.Project.GetAbsoluteDir(nodBS.SelectSingleNode("Folder").InnerText);
            Mask        = ProjectManager.Project.Masks.First(x => x.Name == nodBS.SelectSingleNode("Mask").InnerText) as Masks.AttributeFieldMask;
            SummaryXML  = ProjectManager.Project.GetAbsolutePath(nodBS.SelectSingleNode("SummaryXML").InnerText);
            ClassLegend = ProjectManager.Project.GetAbsolutePath(nodBS.SelectSingleNode("ClassLegend").InnerText);

            Classes = new Dictionary <string, BudgetSegregationClass>();
            foreach (XmlNode nodClass in nodBS.SelectNodes("Classes/Class"))
            {
                BudgetSegregationClass bsClass = new BudgetSegregationClass(nodClass);
                Classes[bsClass.Name] = bsClass;
            }

            MorphologicalAnalyses = new List <Morphological.MorphologicalAnalysis>();
            foreach (XmlNode nodMA in nodBS.SelectNodes("MorphologicalAnalyses/MorphologicalAnalysis"))
            {
                Morphological.MorphologicalAnalysis ma = new Morphological.MorphologicalAnalysis(nodMA, this);
                MorphologicalAnalyses.Add(ma);
            }
        }
Ejemplo n.º 2
0
 public bool IsMorphologicalAnalysisNameUnique(string name, Morphological.MorphologicalAnalysis ignore)
 {
     return(!MorphologicalAnalyses.Any(x => x != ignore && string.Compare(name, x.Name, true) == 0));
 }
Ejemplo n.º 3
0
        public static bool ValidateName(TextBox txtName, GCDCore.Project.BudgetSegregation bs, GCDCore.Project.Morphological.MorphologicalAnalysis ma)
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("The morphological analysis name cannot be blank.", "Missing Name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Select();
                return(false);
            }

            if (!bs.IsMorphologicalAnalysisNameUnique(txtName.Text, ma))
            {
                MessageBox.Show(string.Format("The {0} budget segregation already possesses a morphological analysis called \"{1}\"." +
                                              " Please enter a unique name for the analysis.", bs.Name, txtName.Text), "Duplicate Name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtName.Select();
                return(false);
            }

            return(true);
        }