예제 #1
0
        public static def_Sections GetSectionForSubscaleCatagory(def_Forms frm, SubscaleCatagory cat)
        {
            if (cat == null)
            {
                throw new Exception("Could not find a section for NULL SubscaleCatagory");
            }

            //def_Forms frm = formsRepo.GetFormByIdentifier("SIS-A");
            try
            {
                foreach (def_FormParts fp in frm.def_FormParts)
                {
                    foreach (def_PartSections ps in fp.def_Parts.def_PartSections)
                    {
                        string s = ps.def_Sections.title.Replace(" ", "").ToLower();
                        foreach (string numonic in cat.getNumonics())
                        {
                            if (s.Contains(numonic.ToString().ToLower()))
                            {
                                return(ps.def_Sections);
                            }
                        }
                    }
                }
            }
            catch (Exception xcptn)
            {
                Debug.WriteLine("GetSectionForSubscaleCatagory: " + xcptn.Message);
            }

            throw new Exception("Could not find a section for SubscaleCatagory \"" + cat.getNumonics()[0] + "\"");
        }
예제 #2
0
            public static SubscaleCatagory[] getCatagoriesFromNumonics(string[] subscaleNumonics)
            {
                int n = subscaleNumonics.Length;

                SubscaleCatagory[] result = new SubscaleCatagory[n];
                for (int i = 0; i < n; i++)
                {
                    result[i] = new SubscaleCatagory(subscaleNumonics[i], i);
                }
                return(result);
            }