private void btnDelete_Click(object sender, EventArgs e)
        {
            TableMemberInfos deletings = new TableMemberInfos(rewriteParent: false);

            foreach (TreeListNode node in treeExist.Selection)
            {
                TableMemberInfo info = treeExist.GetDataRecordByNode(node) as TableMemberInfo;
                if (info != null &&
                    info.Item != null)
                {
                    DBInterface.DestroyInstance(info.Item);

                    UnuseInitTable(info);
                    EraseExistDate(info);

                    deletings.Add(info);
                }
            }

            // Удаление записей
            foreach (TableMemberInfo infoInter in deletings)
            {
                MemberExists.RemoveEx(infoInter);
            }
        }
        public DBInterfaceDesignerForm(DBInterface dbInterface)
        {
            InitializeComponent();
            DBInterface            = dbInterface;
            TypeCurrent            = typeof(string);
            drbtnAddColletion.Text = string.Format("Добавить (String)");

            MemberInits    = new TableMemberInfos();
            MemberExists   = new TableMemberInfos();
            LevelMax       = 6;
            RecordCountMax = 100000;

            treeExist.StateImageList = DBInterface.Icons;

            TypeTables = new XPTables();
            TypeTables.FillTable(DBInterface.TypeDiscoveryService, typeof(XPBaseObject));

            UpdateExistData();

            CreateInitData();

            treeInit.DataSource       = MemberInits;
            treeExist.DataSource      = MemberExists;
            dbInterface.ItemsChanged += dbInterface_ItemsChanged;

            gluInits.Properties.DataSource = TypeTables;

            gluInits.EditValue = TypeTables.Find(DBInterface.TableType);
        }
 /// <summary>
 /// Рекурсивный метод обновления записей уже созданных записей.
 /// </summary>
 private void CreateExistData(DBInterfaceItemXPComplex itemComplex, TableMemberInfos infos, int level)
 {
     foreach (DBInterfaceItemBase item in itemComplex.Items)
     {
         TableMemberInfo tmInfo = DBInterface.PrintExistData(treeExist, item, infos);
         if (item is DBInterfaceItemXPComplex)
         {
             CreateExistData((DBInterfaceItemXPComplex)item, tmInfo.Items, level + 1);
         }
     }
 }
Esempio n. 4
0
 public TableMemberInfo()
 {
     _Items         = new TableMemberInfos(this);
     IsXPBaseObject = false;
     IsXPCollection = false;
     Item           = null;
     Owner          = null;
     Parent         = null;
     IsUsed         = false;
     ImageIndex     = -1;
     _HashCode      = GetHashCode();
 }
        /// <summary>
        /// Рекурсивный метод обновления надписей и иконок..
        /// </summary>
        private void UpdateExistCaptionAndIcon(TableMemberInfos infos, int level)
        {
            foreach (TableMemberInfo info in infos)
            {
                TableMemberInfo infoExist = MemberExists.FindInfo(info);
                if (infoExist != null)
                {
                    infoExist.Caption = info.Caption;
                    DBInterface.CreateIcon(infoExist.Item, info);

                    if (info.Items.Count > 0)
                    {
                        UpdateExistCaptionAndIcon(info.Items, level + 1);
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Поиск схожей записи по свойству FieldName в коллекции.
        /// </summary>
        public TableMemberInfo FindInfo(TableMemberInfo info)
        {
            TableMemberInfo infoTemp = null;

            if (info != null)
            {
                TableMemberInfo infoParent = null;
                int             level      = info.GetLevel();

                TableMemberInfos infosTemp = this;

                for (int i = 0; i < level; i++)
                {
                    infoTemp   = null;
                    infoParent = info.GetParent(level - i);

                    foreach (TableMemberInfo infoIter in infosTemp)
                    {
                        if (infoIter.FieldName == infoParent.FieldName)
                        {
                            infoTemp = infoIter;
                            break;
                        }
                    }
                    if (infoTemp != null)
                    {
                        infosTemp = infoTemp.Items;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(infoTemp);
        }