private void gunaButton20_Click(object sender, EventArgs e) { NewWorker newWorker = new NewWorker(); DialogResult dialogResult = new DialogResult(); dialogResult = newWorker.ShowDialog(); UpdateWorker(); }
private void gunaButton19_Click(object sender, EventArgs e) { connection = new SqlConnection(connectionString); connection.Open(); int index = 0; foreach (DataGridViewCell cell in AllDataGridView.SelectedCells) { index = cell.RowIndex; } string a = (AllDataGridView[0, index].Value.ToString()); string b = (AllDataGridView[1, index].Value.ToString()); string c = (AllDataGridView[2, index].Value.ToString()); string d = (AllDataGridView[3, index].Value.ToString()); string ee = (AllDataGridView[4, index].Value.ToString()); string f = (AllDataGridView[5, index].Value.ToString()); string g = (AllDataGridView[6, index].Value.ToString()); DateTime date = Convert.ToDateTime((AllDataGridView[7, index].Value)); int index1 = 0; foreach (DataGridViewCell cell in AllDataGridView.SelectedCells) { index1 = cell.RowIndex; } string query = $"select * from [user] join admin on [User].ID_user=admin.Id_user"; AllDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; AllDataGridView.AllowUserToAddRows = false; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); adapter = new SqlDataAdapter(query, connection); dataSet = new DataSet(); adapter.Fill(dataSet); AllDataGridView.DataSource = dataSet.Tables[0]; connection.Close(); } connection = new SqlConnection(connectionString); connection.Open(); string choose_id = (AllDataGridView[0, index1].Value.ToString()); UpdateWorker(); NewWorker newWorker = new NewWorker(Convert.ToInt32(choose_id), a, b, c, d, ee, f, g, date); DialogResult dialogResult = new DialogResult(); dialogResult = newWorker.ShowDialog(); UpdateWorker(); }