示例#1
0
        private void ShowEnums(Int32 level, String nodeText, String parentNodeText)
        {
            listView1.Items.Clear();
            listView1.Columns.Clear();

            if (level == 0 || level == 1)
            {
                listView1.Columns.Add("Name", -1, HorizontalAlignment.Left);
                listView1.Columns.Add("Description", -1, HorizontalAlignment.Left);
                listView1.Columns.Add("IntegerBased", -1, HorizontalAlignment.Left);
                listView1.Columns.Add("Template", -1, HorizontalAlignment.Left);

                IList list;
                if (level == 0)
                {
                    list = enums;
                }
                else
                {
                    list = new ArrayList();
                    list.Add(EnumElement.FindByName((ArrayList)enums, nodeText));
                }
                foreach (EnumElement e in list)
                {
                    ListViewItem lvi = new ListViewItem(e.Name);
                    lvi.SubItems.Add(e.Description);
                    lvi.SubItems.Add(e.IntegerBased.ToString());
                    lvi.SubItems.Add(e.Template);
                    listView1.Items.Add(lvi);
                }
            }

            if (level == 2 && nodeText.Equals("values"))
            {
                listView1.Columns.Add("Name", -1, HorizontalAlignment.Left);
                listView1.Columns.Add("Code", -1, HorizontalAlignment.Left);
                listView1.Columns.Add("Description", -1, HorizontalAlignment.Left);

                EnumElement e = EnumElement.FindByName((ArrayList)enums, parentNodeText);
                foreach (EnumValueElement v in e.Values)
                {
                    ListViewItem lvi = new ListViewItem(v.Name);
                    lvi.SubItems.Add(v.Code);
                    lvi.SubItems.Add(v.Description);
                    listView1.Items.Add(lvi);
                }
            }
        }
示例#2
0
 private void CreateSqlElementAssociations(ParserValidationDelegate vd)
 {
     // find and assign the foreign entity and EnumElement now that they are parsed
     foreach (DatabaseElement database in databases)
     {
         foreach (SqlEntityElement sqlEntity in database.SqlEntities)
         {
             foreach (ConstraintElement constraint in sqlEntity.Constraints)
             {
                 if (constraint.ForeignEntity.Name.Length > 0)
                 {
                     SqlEntityElement entity = SqlEntityElement.FindByName(DatabaseElement.GetAllSqlEntities(databases), constraint.ForeignEntity.Name);
                     if (entity != null)
                     {
                         constraint.ForeignEntity = (SqlEntityElement)entity.Clone();
                     }
                     else
                     {
                         vd(ParserValidationArgs.NewError("ForeignEntity (" + constraint.ForeignEntity.Name + ") specified in constraint " + constraint.Name + " could not be found as an defined entity"));
                     }
                 }
                 if (constraint.CheckEnum.Name.Length > 0)
                 {
                     EnumElement entity = EnumElement.FindByName(enumtypes as ArrayList, constraint.CheckEnum.Name);
                     if (entity != null)
                     {
                         constraint.CheckEnum = (EnumElement)entity.Clone();
                     }
                     else
                     {
                         vd(ParserValidationArgs.NewError("CheckEnum (" + constraint.CheckEnum.Name + ") specified in constraint " + constraint.Name + " could not be found as an defined entity"));
                     }
                 }
             }
         }
     }
 }