Exemplo n.º 1
0
        private void LbtTables_DoubleClick(object sender, EventArgs e)
        {
            if (pTableAll.Controls.Count > 0)
            {
                if (MessageBox.Show("Do you want to continue? You will lose your progress if you don't save.", "Question", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }

            loadedTable = selectedTable;

            txtTableName.Text  = selectedTable?.metadata?.name ?? "table";
            txtCreateDate.Text = selectedTable.metadata.createDate.ToString("dd/MM/yyyy hh:mm:ss");
            pTableAll.Controls.Clear();

            DataGridView dgv;

            dgv        = DAL.OBJECTS.Table.DataTableToGrid();
            dgv.Parent = pTableAll;
            pTableAll.Controls.Add(dgv);
            dgv.Dock = DockStyle.Fill;

            dgv.DataSource = Table.TableToDatatable(selectedTable);
            InitizalizeTableGrid();
            dgv.CellValidated += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellValidated);

            FormatGrid(dgv);
        }
Exemplo n.º 2
0
        private void BtnCreateFromExtraction_Click(object sender, EventArgs e)
        {
            frmTable table = new frmTable(folderNameTableTab, extractions, selectedExtractionTable);

            table.ShowDialog();

            txtTableName.Text  = selectedExtractionTable.metadata.name;
            txtCreateDate.Text = "";
            if (table.DialogResult == DialogResult.OK)
            {
                loadedTable = null;
                pTableAll.Controls.Clear();

                DataGridView dgv;

                dgv        = DAL.OBJECTS.Table.DataTableToGrid(table.tableType);
                dgv.Parent = pTableAll;
                pTableAll.Controls.Add(dgv);
                dgv.Dock       = DockStyle.Fill;
                dgv.DataSource = table.result;
                FormatGrid(dgv);
                dgv.CellValidated += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellValidated);
                InitizalizeTableGrid();
            }
        }
Exemplo n.º 3
0
 private void LbtTables_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbtTables.SelectedIndex >= 0)
     {
         selectedTable = GetTable(lbtTables.SelectedIndex, selectedExtractionTable._id, tables);
     }
     InitizalizeTableGrid();
 }
Exemplo n.º 4
0
 private void BtnDeleteTable_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to continue?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         if (loadedTable == null)
         {
             pTableAll.Controls.Clear();
         }
         else
         {
             Table.DeleteTable(loadedTable);
             pTableAll.Controls.Clear();
             tables.Remove(loadedTable);
             loadTablesCombo(selectedExtractionTable._id, Parser.toInt(folderTableTab));
         }
         InitizalizeTableGrid();
     }
 }
Exemplo n.º 5
0
        private void BtnCreateFromTable_Click(object sender, EventArgs e)
        {
            txtTableName.Text  = selectedTable?.metadata?.name ?? "table";
            txtCreateDate.Text = "";
            pTableAll.Controls.Clear();

            DataGridView dgv;

            dgv        = DAL.OBJECTS.Table.DataTableToGrid();
            dgv.Parent = pTableAll;
            pTableAll.Controls.Add(dgv);
            dgv.Dock       = DockStyle.Fill;
            dgv.DataSource = Table.TableToDatatable(selectedTable);

            loadedTable = null;
            FormatGrid(dgv);
            dgv.CellValidated += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellValidated);

            InitizalizeTableGrid();
        }
Exemplo n.º 6
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            DataGridView grid = null;

            if (pTableAll.Controls.Count > 0 && !string.IsNullOrEmpty(txtTableName.Text) && selectedExtractionTable != null)
            {
                try
                {
                    grid = (DataGridView)pTableAll.Controls[0];
                }
                catch (Exception ex)
                {
                }

                Table table = Table.GridToTable(grid, txtTableName.Text, Parser.toInt(folderTableTab), selectedExtractionTable._id, Users.GetUserID(Environment.UserName), loadedTable);

                string objectIdNull = "000000000000000000000000";

                if (table._id.ToString() != objectIdNull)
                {
                    Table.UpdateTable(table);
                }
                else
                {
                    Table.InsertTable(table);
                }

                tables.Where(t => t.metadata.extraction == table.metadata.extraction).Select(t => t).ToList().ForEach(t => tables.Remove(t));

                List <Table> updatedTables = Table.getDocuments(table.metadata.extraction);
                tables.AddRange(updatedTables);

                loadedTable = updatedTables.OrderByDescending(t => t.metadata.modifiedDate).LastOrDefault();

                txtCreateDate.Text = loadedTable.metadata.createDate.ToString("dd/MM/yyyy hh:mm:ss");


                loadTablesCombo(selectedExtractionTable._id, Parser.toInt(folderTableTab));
            }
        }
Exemplo n.º 7
0
 private void loadTables()
 {
     tables = Table.getAllDocuments(Users.GetUserID(Environment.UserName));
 }