Beispiel #1
0
        // Key is simple
        public bool IsThreeForm(int indexPrimaryKey)
        {
            bool flag = true;

            for (int i = 0; i < columnNum; i++)
            {
                if (i == indexPrimaryKey)
                    continue;

                for (int j = 0; j < columnNum; j++)
                {
                    if (j != i && j != indexPrimaryKey) // пропускаем сравнение с самим собой и id
                    {
                        if (IsFunctialDepended(i, j))
                        {
                            flag = false;
                            winReplace win = new winReplace(dTable.Columns[indexPrimaryKey].ColumnName,
                                dTable.Columns[i].ColumnName, dTable.Columns[j].ColumnName);
                            win.ShowDialog();
                        }
                    }
                }
            }
            if (flag)
                return true;
            else
                return false;
        }
Beispiel #2
0
        public bool IsBoiseForm(int key1, int key2, int keyTotal)
        {
            bool flag = true;
            if (IsFunctialDepended(key1, key2))
            {
                flag = false;
                winReplace win = new winReplace(dTable.Columns[keyTotal].ColumnName,
                    dTable.Columns[key1].ColumnName, dTable.Columns[key2].ColumnName, null);
                win.ShowDialog();
            }
            if (IsFunctialDepended(key2, key1))
            {
                flag = false;
                winReplace win = new winReplace(dTable.Columns[keyTotal].ColumnName,
                    dTable.Columns[key2].ColumnName, dTable.Columns[key1].ColumnName, null);
                win.ShowDialog();
            }

            return flag;
        }
Beispiel #3
0
        //Key is complex
        public bool IsThreeForm(List<int> keys)
        {
            bool flag = true;
            List<string> keysName = new List<string>();
            for (int j = 0; j < keys.Count; j++)
            {
                keysName.Add(dTable.Columns[keys[j]].ToString());
            }
            for (int i = 0; i < columnNum; i++)
            {
                if(keys.Contains(i))
                    continue;

                for (int j = 0; j < columnNum; j++)
                {
                    if (j != i && !keys.Contains(j)) // пропускаем сравнение с самим собой и частями составного ключа
                    {
                        if (IsFunctialDepended(i, j))
                        {
                            flag = false;
                            winReplace win = new winReplace(keysName,
                                dTable.Columns[i].ColumnName, dTable.Columns[j].ColumnName, null);
                            win.ShowDialog();
                        }
                    }
                }
            }
            if (flag)
                return true;
            else
                return false;
        }
Beispiel #4
0
        public bool IsTwoForm(List<int> keys)
        {
            bool flag = true;
            List<string> keysName = new List<string>();
            for (int j = 0; j < keys.Count; j++)
            {
                keysName.Add(dTable.Columns[keys[j]].ToString());
            }

            for (int i = 0; i < columnNum; i++)
            {

                Queue<int> result = ComparePrimaryWithColumn(keys, i);
                if (result != null)
                {
                    while (result.Count != 0)
                    {
                        int currentKey = result.Dequeue();
                        winReplace win = new winReplace(keysName, dTable.Columns[i].ColumnName, dTable.Columns[currentKey].ColumnName);
                        win.ShowDialog();
                        flag = false;
                    }
                }

            }
            if (flag)
                return true;
            else
                return false;
        }