Example #1
0
        private void addClientButton_Click(object sender, EventArgs e)
        {
            using (AddEditClientDialog acd = new AddEditClientDialog())
            {
                if (acd.ShowDialog() == DialogResult.OK)
                {
                    this.CurrentDatabase.AddNewClient(acd.ClientRecord);

                    //find the row in the datagridview and select it immediately
                    var row = clientListDataGridView.Rows
                        .Cast<DataGridViewRow>()
                        .FirstOrDefault(r => r.DataBoundItem == acd.ClientRecord);

                    if (row != null)
                    {
                        row.Selected = true;
                        clientListDataGridView.CurrentCell = row.Cells[0];
                    }
                }
            }
        }
Example #2
0
        private void renameClientToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (_activeClient == null)
                return;

            using (AddEditClientDialog acd = new AddEditClientDialog(_activeClient))
            {
                if (acd.ShowDialog() == DialogResult.OK)
                {
                    _activeClient.Name = acd.ClientRecord.Name;
                    _activeClient.ClientId = acd.ClientRecord.ClientId;

                    this.CurrentDatabase.CommitClient(_activeClient);
                }
            }
        }