Ejemplo n.º 1
0
        /// <summary>
        /// Set-up for changing to a new table
        /// </summary>
        private void Setup()
        {
            tableName      = cmbTable.SelectedItem.ToString();
            editingSidebar = null;

            columns = DBMethods.MetaRequests.GetColumnDataFromTable(tableName);

            // Allow the user to search through all columns or a specific column for the table
            List <string> colSearch = new List <string> {
                "All Columns"
            };

            colSearch.AddRange(columns.Select(c => c.Name));

            if (editingSidebar != null)
            {
                editingSidebar.Close();
            }

            editingSidebar     = new DataEditingSidebar(columns, tableName, this);
            lblSidebar.Content = editingSidebar.Content;

            if (!(filterableDataGrid is null))
            {
                filterableDataGrid.Close();
            }
            filterableDataGrid = new FilterableDataGrid(columns, this);
            filterableDataGrid.SetMaxHeight(700);
            lblSearchData.Content = filterableDataGrid.Content;
        }
Ejemplo n.º 2
0
        private void UpdateEditingSidebar(string[] newData)
        {
            if (mode == contactString)
            {
                if (contactEditing is null)
                {
                    contactEditing = new DataEditingSidebar(contactsColumns, "Contact", this);
                }
                if (contactAdding is null)
                {
                    contactAdding = new DataEditingSidebar(contactsColumns, "Contact", this);
                }
                contactEditing.ChangeSelectedData(newData);
                contactAdding.StartAddNew(GetClientID());
                dtgDogs.UpdateSelectedIndex(-1);
                dtgClients.UpdateSelectedIndex(-1);
            }
            else if (mode == dogString)
            {
                if (dogsEditing is null)
                {
                    dogsEditing = new DataEditingSidebar(dogsColumns, "Dog", this);
                }
                if (dogsAdding is null)
                {
                    dogsAdding = new DataEditingSidebar(dogsColumns, "Dog", this);
                }
                dogsEditing.ChangeSelectedData(newData);
                dogsAdding.StartAddNew(GetClientID());
                dtgContacts.UpdateSelectedIndex(-1);
                dtgClients.UpdateSelectedIndex(-1);
            }
            else if (mode == clientString)
            {
                if (clientsEditing is null)
                {
                    clientsEditing = new DataEditingSidebar(clientsColumns, "Client", this);
                }
                if (clientsAdding is null)
                {
                    clientsAdding = new DataEditingSidebar(clientsColumns, "Client", this);
                }
                clientsEditing.ChangeSelectedData(newData);
                clientsAdding.StartAddNew(GetClientID());
                dtgDogs.UpdateSelectedIndex(-1);
                dtgContacts.UpdateSelectedIndex(-1);
            }

            UpdateClientEditor();
        }