public static bool verifyNoDub(string[] str) { bool has_db = false; int index_max = MyData.takeMax("TabelMaterii", "ID_Materie"); for (int i = 0; i < str.Length; i++) { for (int j = i + 1; j < str.Length - 1; j++) { if (str[i] == str[j]) { has_db = true; break; } } } for (int i = 0; i < str.Length; i++) { if (Convert.ToInt32(str[i]) > index_max) { has_db = true; break; } } return(has_db); }
private void teste_dgv_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex >= 0) { if (teste_dgv.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0 && !test_opened) { TestForm test = new TestForm(); string namePath = string.Format("{0}_{1}", teste_dgv["name", e.RowIndex].Value.ToString(), teste_dgv["prename", e.RowIndex].Value.ToString()); CurrentTest = $"teste/{teste_dgv["Materie", e.RowIndex].Value.ToString()}/{namePath}/{teste_dgv[1, e.RowIndex].Value.ToString()}.txt"; int max = MyData.takeMax("Teste_Materii", "ID_Test", "Materie", teste_dgv["Materie", e.RowIndex].Value.ToString()); test.Text = $"Testul {teste_dgv[0, e.RowIndex].Value}/{max}"; test.prop = teste_dgv; test.IndexRow = e.RowIndex; test.reload = this; test.Show(); test.Focus(); test_opened = true; } } }