Esempio n. 1
0
        private void copyFiled_Click(object sender, EventArgs e)
        {
            if (listBoxFields.SelectedItem != null)
            {
                string fieldName = listBoxFields.SelectedItem.ToString();

                string fieldCopyName = "";
                for (int i = 1; i < 100; i++)
                {
                    fieldCopyName = fieldName + "_Копія_" + i.ToString();
                    if (!ConfDirectory.Fields.ContainsKey(fieldCopyName))
                    {
                        break;
                    }
                }

                ConfigurationObjectField ConfFieldOriginal = ConfDirectory.Fields[fieldName];

                ConfigurationObjectField ConfFieldCopy = new ConfigurationObjectField(fieldCopyName,
                                                                                      Configuration.GetNewUnigueColumnName(Program.Kernel, ConfDirectory.Table, ConfDirectory.Fields),
                                                                                      ConfFieldOriginal.Type, ConfFieldOriginal.Pointer, ConfFieldOriginal.Desc);

                ConfDirectory.AppendField(ConfFieldCopy);

                LoadFieldList();
            }
            else
            {
                if (listBoxFields.Items.Count > 0)
                {
                    MessageBox.Show("Виберіть елемент", "Повідомлення", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Esempio n. 2
0
        private void treeViewFields_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag != null)
            {
                Tuple <ConfigurationObjectField, string> tuple = (Tuple <ConfigurationObjectField, string>)e.Node.Tag;
                ConfigurationObjectField field = tuple.Item1;
                string flagTag = tuple.Item2;

                FieldForm fieldForm = new FieldForm();
                fieldForm.Tag = flagTag;
                fieldForm.ConfigurationObjectField = field;
                fieldForm.CallBack = CallBack_Update_Field;
                fieldForm.CallBack_IsExistFieldName = CallBack_IsExistFieldName;
                fieldForm.NewNameInTable            = Configuration.GetNewUnigueColumnName(Program.Kernel, ConfRegistersInformation.Table, GetAllField());
                fieldForm.Show();
            }
        }
Esempio n. 3
0
        private void copyTablePart_Click(object sender, EventArgs e)
        {
            if (listBoxTabularParts.SelectedItem != null)
            {
                string tablePartName = listBoxTabularParts.SelectedItem.ToString();

                string tablePartCopyName = "";
                for (int i = 1; i < 100; i++)
                {
                    tablePartCopyName = tablePartName + "_Копія_" + i.ToString();
                    if (!ConfDirectory.TabularParts.ContainsKey(tablePartCopyName))
                    {
                        break;
                    }
                }

                ConfigurationObjectTablePart ConfTablePartOriginal = ConfDirectory.TabularParts[tablePartName];

                ConfigurationObjectTablePart ConfTablePartCopy = new ConfigurationObjectTablePart(tablePartCopyName,
                                                                                                  Configuration.GetNewUnigueTableName(Program.Kernel), ConfTablePartOriginal.Desc);

                ConfDirectory.AppendTablePart(ConfTablePartCopy);

                foreach (ConfigurationObjectField ConfFieldOriginal in ConfTablePartOriginal.Fields.Values)
                {
                    ConfigurationObjectField ConfFieldCopy = new ConfigurationObjectField(ConfFieldOriginal.Name,
                                                                                          ConfFieldOriginal.NameInTable, ConfFieldOriginal.Type, ConfFieldOriginal.Pointer, ConfFieldOriginal.Desc);

                    ConfTablePartCopy.AppendField(ConfFieldCopy);
                }

                LoadTabularPartsList();
            }
            else
            {
                if (listBoxTabularParts.Items.Count > 0)
                {
                    MessageBox.Show("Виберіть елемент", "Повідомлення", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Esempio n. 4
0
        void CallBack_Update_Field(string originalName, ConfigurationObjectField configurationObjectField, bool isNew, object Tag = null)
        {
            if (isNew)
            {
                ConfDirectoryTablePart.AppendField(configurationObjectField);
            }
            else
            {
                if (originalName != configurationObjectField.Name)
                {
                    ConfDirectoryTablePart.Fields.Remove(originalName);
                    ConfDirectoryTablePart.AppendField(configurationObjectField);
                }
                else
                {
                    ConfDirectoryTablePart.Fields[originalName] = configurationObjectField;
                }
            }

            LoadFieldList();
        }
Esempio n. 5
0
        private void treeViewFields_KeyDown(object sender, KeyEventArgs e)
        {
            if (treeViewFields.SelectedNode != null && treeViewFields.SelectedNode.Tag != null)
            {
                Tuple <ConfigurationObjectField, string> tuple = (Tuple <ConfigurationObjectField, string>)treeViewFields.SelectedNode.Tag;
                ConfigurationObjectField field = tuple.Item1;
                string flagTag = tuple.Item2;

                string question = "Видалити поле";

                if (MessageBox.Show(question + " " + field.Name + "?", question + "?", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    switch (flagTag)
                    {
                    case "Dimension":
                    {
                        ConfRegistersInformation.DimensionFields.Remove(field.Name);
                        break;
                    }

                    case "Resources":
                    {
                        ConfRegistersInformation.ResourcesFields.Remove(field.Name);
                        break;
                    }

                    case "Property":
                    {
                        ConfRegistersInformation.PropertyFields.Remove(field.Name);
                        break;
                    }
                    }

                    LoadTreeViewFields();
                }
            }
        }
Esempio n. 6
0
        void CallBack_Update_Field(string originalName, ConfigurationObjectField configurationObjectField, bool isNew, object Tag)
        {
            string flagTag = Tag.ToString();

            if (!(flagTag == "Dimension" || flagTag == "Resources" || flagTag == "Property"))
            {
                throw new Exception("Error flag value");
            }

            if (isNew)
            {
                if (flagTag == "Dimension")
                {
                    ConfRegistersInformation.AppendDimensionField(configurationObjectField);
                }
                else if (flagTag == "Resources")
                {
                    ConfRegistersInformation.AppendResourcesField(configurationObjectField);
                }
                else if (flagTag == "Property")
                {
                    ConfRegistersInformation.AppendPropertyField(configurationObjectField);
                }
            }
            else
            {
                if (originalName != configurationObjectField.Name)
                {
                    if (flagTag == "Dimension")
                    {
                        ConfRegistersInformation.DimensionFields.Remove(originalName);
                        ConfRegistersInformation.AppendDimensionField(configurationObjectField);
                    }
                    else if (flagTag == "Resources")
                    {
                        ConfRegistersInformation.ResourcesFields.Remove(originalName);
                        ConfRegistersInformation.AppendResourcesField(configurationObjectField);
                    }
                    else if (flagTag == "Property")
                    {
                        ConfRegistersInformation.PropertyFields.Remove(originalName);
                        ConfRegistersInformation.AppendPropertyField(configurationObjectField);
                    }
                }
                else
                {
                    if (flagTag == "Dimension")
                    {
                        ConfRegistersInformation.DimensionFields[originalName] = configurationObjectField;
                    }
                    else if (flagTag == "Resources")
                    {
                        ConfRegistersInformation.ResourcesFields[originalName] = configurationObjectField;
                    }
                    else if (flagTag == "Property")
                    {
                        ConfRegistersInformation.PropertyFields[originalName] = configurationObjectField;
                    }
                }
            }

            if (flagTag == "Dimension")
            {
                LoadTreeViewDimension(treeViewFields.Nodes["root"].Nodes["Dimension"]);
            }
            else if (flagTag == "Resources")
            {
                LoadTreeViewResources(treeViewFields.Nodes["root"].Nodes["Resources"]);
            }
            else if (flagTag == "Property")
            {
                LoadTreeViewProperty(treeViewFields.Nodes["root"].Nodes["Property"]);
            }
        }
Esempio n. 7
0
        private void FieldForm_Load(object sender, EventArgs e)
        {
            //Типи даних
            foreach (FieldType fieldType in FieldType.DefaultList())
            {
                comboBoxFieldType.Items.Add(fieldType);
            }

            comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[0];
            comboBoxPointer.Enabled        = false;
            comboBoxEnums.Enabled          = false;

            //Список довідників
            foreach (string directoryName in Program.Kernel.Conf.Directories.Keys)
            {
                comboBoxPointer.Items.Add("Довідники." + directoryName);
            }

            //Список документів
            foreach (string documentName in Program.Kernel.Conf.Documents.Keys)
            {
                comboBoxPointer.Items.Add("Документи." + documentName);
            }

            //Список перелічення
            foreach (string enumName in Program.Kernel.Conf.Enums.Keys)
            {
                comboBoxEnums.Items.Add("Перелічення." + enumName);
            }

            if (ConfigurationObjectField == null)
            {
                ConfigurationObjectField = new ConfigurationObjectField();
                textBoxNameInTable.Text  = NewNameInTable;

                IsNew = true;
            }
            else
            {
                OriginalName = ConfigurationObjectField.Name;

                textBoxName.Text        = ConfigurationObjectField.Name;
                textBoxNameInTable.Text = ConfigurationObjectField.NameInTable;
                textBoxDesc.Text        = ConfigurationObjectField.Desc;

                for (int i = 0; i < comboBoxFieldType.Items.Count; i++)
                {
                    FieldType fieldType = (FieldType)comboBoxFieldType.Items[i];
                    if (fieldType.ConfTypeName == ConfigurationObjectField.Type)
                    {
                        comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[i];
                        break;
                    }
                }

                string confTypeName = ((FieldType)comboBoxFieldType.SelectedItem).ConfTypeName;

                if (confTypeName == "pointer")
                {
                    for (int i = 0; i < comboBoxPointer.Items.Count; i++)
                    {
                        if (ConfigurationObjectField.Pointer == comboBoxPointer.Items[i].ToString())
                        {
                            comboBoxPointer.SelectedItem = comboBoxPointer.Items[i];
                            break;
                        }
                    }
                }
                else if (confTypeName == "enum")
                {
                    for (int i = 0; i < comboBoxEnums.Items.Count; i++)
                    {
                        if (ConfigurationObjectField.Pointer == comboBoxEnums.Items[i].ToString())
                        {
                            comboBoxEnums.SelectedItem = comboBoxEnums.Items[i];
                            break;
                        }
                    }
                }

                checkBoxIsPresentation.Checked = ConfigurationObjectField.IsPresentation;
                checkBoxIsIndex.Checked        = ConfigurationObjectField.IsIndex;

                IsNew = false;
            }
        }