private void toolStripMenuItem8_Click(object sender, EventArgs e) { switch (label4.Text) { case "Групи": AddGroup addGroup = new AddGroup(); addGroup.Show(); SqlConnection sqlConnectionString1 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt1 = new SqlDataAdapter("SELECT * FROM Групи", sqlConnectionString1); DataTable dataTable1 = new DataTable(); sqlDataAdapt1.Fill(dataTable1); dataGridView1.DataSource = dataTable1; fitness_DbDataSet1.AcceptChanges(); break; case "Тренер": AddCoach addCoach = new AddCoach(); addCoach.Show(); SqlConnection sqlConnectionString = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt = new SqlDataAdapter("SELECT * FROM Тренер", sqlConnectionString); DataTable dataTable = new DataTable(); sqlDataAdapt.Fill(dataTable); dataGridView1.DataSource = dataTable; fitness_DbDataSet1.AcceptChanges(); break; case "Абонемент": AddSeasonTicket addSeasonTicket = new AddSeasonTicket(); addSeasonTicket.Show(); SqlConnection sqlConnectionString3 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt3 = new SqlDataAdapter("SELECT * FROM Абонемент", sqlConnectionString3); DataTable dataTable3 = new DataTable(); sqlDataAdapt3.Fill(dataTable3); dataGridView1.DataSource = dataTable3; fitness_DbDataSet1.AcceptChanges(); break; case "Клієнт": ClientRegistration clientRegistration = new ClientRegistration(); clientRegistration.Show(); string query = "SELECT Клієнт.*, [Акаунт клієнта].Логін, [Акаунт клієнта].Пароль, [Акаунт клієнта].[Перевірочне слово] FROM Клієнт, [Акаунт клієнта] WHERE Клієнт.Id = [Акаунт клієнта].ID_клієнта"; SqlConnection sqlConnectionString4 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt4 = new SqlDataAdapter(query, sqlConnectionString4); DataTable dataTable4 = new DataTable(); sqlDataAdapt4.Fill(dataTable4); dataGridView1.DataSource = dataTable4; fitness_DbDataSet1.AcceptChanges(); break; } }
private void toolStripMenuItem3_Click(object sender, EventArgs e) { switch (label4.Text) { case "Власна інформація": DataGridViewRow selectData = dataGridView1.SelectedRows[0]; AdminEditing adminEditing = new AdminEditing(Convert.ToInt32(selectData.Cells[0].Value), Convert.ToString(selectData.Cells[1].Value), Convert.ToString(selectData.Cells[2].Value), Convert.ToString(selectData.Cells[3].Value), Convert.ToDateTime(selectData.Cells[4].Value), Convert.ToString(selectData.Cells[5].Value), Convert.ToString(selectData.Cells[6].Value), Convert.ToString(selectData.Cells[7].Value)); adminEditing.ShowDialog(); AdminLoginEditing adminLoginEditing = new AdminLoginEditing(Convert.ToInt32(selectData.Cells[0].Value), Convert.ToString(selectData.Cells[8].Value), Convert.ToString(selectData.Cells[9].Value), Convert.ToString(selectData.Cells[10].Value)); adminLoginEditing.ShowDialog(); OwnInformation(); fitness_DbDataSet1.AcceptChanges(); break; case "Групи": DataGridViewRow selectData1 = dataGridView1.SelectedRows[0]; AddGroup addGroup = new AddGroup(Convert.ToInt32(selectData1.Cells[0].Value), Convert.ToString(selectData1.Cells[1].Value), Convert.ToString(selectData1.Cells[2].Value), Convert.ToInt32(selectData1.Cells[3].Value), Convert.ToInt32(selectData1.Cells[4].Value)); addGroup.ShowDialog(); SqlConnection sqlConnectionString1 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt1 = new SqlDataAdapter("SELECT * FROM Групи", sqlConnectionString1); DataTable dataTable1 = new DataTable(); sqlDataAdapt1.Fill(dataTable1); dataGridView1.DataSource = dataTable1; fitness_DbDataSet1.AcceptChanges(); break; case "Тренер": DataGridViewRow selectData2 = dataGridView1.SelectedRows[0]; AddCoach addCoach = new AddCoach(Convert.ToInt32(selectData2.Cells[0].Value), Convert.ToString(selectData2.Cells[1].Value), Convert.ToString(selectData2.Cells[2].Value), Convert.ToString(selectData2.Cells[3].Value), Convert.ToDateTime(selectData2.Cells[4].Value), Convert.ToString(selectData2.Cells[5].Value), Convert.ToString(selectData2.Cells[6].Value), Convert.ToString(selectData2.Cells[7].Value), Convert.ToString(selectData2.Cells[8].Value)); addCoach.ShowDialog(); SqlConnection sqlConnectionString = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt = new SqlDataAdapter("SELECT * FROM Тренер", sqlConnectionString); DataTable dataTable = new DataTable(); sqlDataAdapt.Fill(dataTable); dataGridView1.DataSource = dataTable; fitness_DbDataSet1.AcceptChanges(); break; case "Абонемент": DataGridViewRow selectData3 = dataGridView1.SelectedRows[0]; AddSeasonTicket addSeasonTicket = new AddSeasonTicket(Convert.ToInt32(selectData3.Cells[0].Value), Convert.ToString(selectData3.Cells[1].Value), Convert.ToString(selectData3.Cells[2].Value), Convert.ToString(selectData3.Cells[3].Value)); addSeasonTicket.ShowDialog(); SqlConnection sqlConnectionString3 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt3 = new SqlDataAdapter("SELECT * FROM Абонемент", sqlConnectionString3); DataTable dataTable3 = new DataTable(); sqlDataAdapt3.Fill(dataTable3); dataGridView1.DataSource = dataTable3; fitness_DbDataSet1.AcceptChanges(); break; case "Клієнт": DataGridViewRow selectData4 = dataGridView1.SelectedRows[0]; ClientRegistration clientRegistration = new ClientRegistration(Convert.ToInt32(selectData4.Cells[0].Value), Convert.ToString(selectData4.Cells[1].Value), Convert.ToString(selectData4.Cells[2].Value), Convert.ToString(selectData4.Cells[3].Value), Convert.ToDateTime(selectData4.Cells[4].Value), Convert.ToString(selectData4.Cells[5].Value), Convert.ToString(selectData4.Cells[6].Value), Convert.ToString(selectData4.Cells[7].Value)); clientRegistration.ShowDialog(); ClientLoginRegistration clientLoginRegistration = new ClientLoginRegistration(Convert.ToInt32(selectData4.Cells[0].Value), Convert.ToString(selectData4.Cells[8].Value), Convert.ToString(selectData4.Cells[9].Value), Convert.ToString(selectData4.Cells[10].Value)); clientLoginRegistration.ShowDialog(); SqlConnection sqlConnectionString4 = new SqlConnection(ConnectionString); SqlDataAdapter sqlDataAdapt4 = new SqlDataAdapter("SELECT * FROM Клієнт", sqlConnectionString4); DataTable dataTable4 = new DataTable(); sqlDataAdapt4.Fill(dataTable4); dataGridView1.DataSource = dataTable4; fitness_DbDataSet1.AcceptChanges(); break; } }