private void btnAdd_Click(object sender, EventArgs e)
        {
            if (rbFormat.Checked)
            {
                Format = new FormatFileGenerator.Format()
                {
                    Id       = tbGUID.Text,
                    Name     = tbName.Text,
                    FileName = tbFileName.Text
                };

                DialogResult = DialogResult.OK;
            }
            else
            {
                Structure = new FormatFileGenerator.Structure()
                {
                    Id         = tbGUID.Text,
                    Name       = tbName.Text,
                    Type       = cbType.SelectedItem.ToString(),
                    GridFormat = new DataTable()
                    {
                        TableName = tbName.Text + "." + cbType.SelectedItem.ToString()
                    }
                };

                DialogResult = DialogResult.OK;
            }
        }
Beispiel #2
0
        //SELECTION OF THE CURRENT STRUCTURE OF THE FORMAT
        private void dgStructures_SelectionChanged(object sender, EventArgs e)
        {
            if (SelectedFormat != null)
            {
                if (dgStructures.SelectedRows.Count == 1)
                {
                    panelContainer.Visible = true;

                    //Inicio Modificación - FernandoAMartinez - 17/03/2020
                    //SelectedStructure = SelectedFormat.Structures[dgStructures.SelectedRows[0].Index];
                    SelectedStructure = (FormatFileGenerator.Structure)BindingStructures.Current;
                    //Fin Modificación - FernandoAMartinez - 17/03/2020

                    if (SelectedStructure.GridFormat == null)
                    {
                        SelectedStructure.GridFormat = new DataTable();
                    }

                    dgDataStructure.DataSource = SelectedStructure.GridFormat;

                    if (SelectedStructure.GridFormat.TableName == null)
                    {
                        SelectedStructure.GridFormat.TableName = string.Format("{0}-{1}", SelectedFormat.Name, SelectedStructure.Name);
                    }

                    lbRows.Text    = SelectedStructure.GridFormat.Rows.Count.ToString();
                    lbColumns.Text = SelectedStructure.GridFormat.Columns.Count.ToString();
                }
                else
                {
                    panelContainer.Visible = false;
                }
            }
            else
            {
                MessageBox.Show("Please select a Format from the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }