private void CreateRowClick(object sender, EventArgs e) { if (LawyersTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "lawyers", true, -1); cer.Show(); } else if (ClientsTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "clients", true, -1); cer.Show(); } else if (CausesTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "causes", true, -1); cer.Show(); } else if (EfficiencyTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "success", true, -1); cer.Show(); } else if (FeesTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "fees", true, -1); cer.Show(); } else if (ReportsTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "reports", true, -1); cer.Show(); } else if (PasswordTable.Visibility == Visibility.Visible) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "authoriz", true, -1); cer.Show(); } else { System.Windows.Forms.MessageBox.Show("Вы не выбрали таблицу", "Добавление", MessageBoxButtons.OK); } }
private void EditRowClick(object sender, EventArgs e) { try { if (LawyersTable.Visibility == Visibility.Visible) { TableLawyers row = (TableLawyers)LawyersTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "lawyers", false, row.ID); cer.GetLawyerData(row); cer.Show(); } } else if (ClientsTable.Visibility == Visibility.Visible) { TableClients row = (TableClients)ClientsTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "clients", false, row.ID); cer.GetClientData(row); cer.Show(); } } else if (CausesTable.Visibility == Visibility.Visible) { TableCauses row = (TableCauses)CausesTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "causes", false, row.ID); cer.GetCauseData(row); cer.Show(); } } else if (EfficiencyTable.Visibility == Visibility.Visible) { TableEfficiency row = (TableEfficiency)EfficiencyTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "success", false, row.ID); cer.GetEfficiencyData(row); cer.Show(); } } else if (FeesTable.Visibility == Visibility.Visible) { TableFees row = (TableFees)FeesTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "fees", false, row.ID); cer.GetFeeData(row); cer.Show(); } } else if (ReportsTable.Visibility == Visibility.Visible) { TableReports row = (TableReports)ReportsTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "reports", false, row.ID); cer.GetReportData(row); cer.Show(); } } else if (PasswordTable.Visibility == Visibility.Visible) { TableAuthorization row = (TableAuthorization)PasswordTable.SelectedItems[0]; if (row != null) { admin.IsEnabled = false; CreateEditRow cer = new CreateEditRow(this, "authoriz", false, row.ID); cer.GetAuthorizData(row); cer.Show(); } } else { System.Windows.Forms.MessageBox.Show("Вы не выбрали запись для редактирования", "Редактирование", MessageBoxButtons.OK); } } catch { System.Windows.Forms.MessageBox.Show("Вы не выбрали запись для редактирования", "Редактирование", MessageBoxButtons.OK); } }