private static void selectSurfaceInDB(FormOfWorkWithDatabase form, int index) { DataTable tablesDataTable = new DataTable(); DataTable tempDataTable = new DataTable(); DependenceCalculation calculation = calculations[index]; dbConnection.GetDataUsingDataAdapter($@"SELECT * FROM surface WHERE idCalculation = {calculation.getId()}", ref tempDataTable, ref tableDataAdapter); surfaces = new List <DependenceSurface>(); try { foreach (DataRow row in tempDataTable.Rows) { surfaces.Add(createSurface(row, form)); } } catch (Exception e) { MessageBox.Show(e.Message); } }
private static void selectTechnologicalProcess(int index, FormOfWorkWithDatabase form) { DataTable tablesDataTable = new DataTable(); DataTable tempDataTable = new DataTable(); DependenceCalculation calculation = calculations[index]; dbConnection.GetDataUsingDataAdapter($@"SELECT * FROM Operations WHERE ID_calculation = {calculation.getId()}", ref tempDataTable, ref tableDataAdapter); try { int countRows = tempDataTable.Rows.Count; workpriece = createWorkpriece(tempDataTable.Rows[0]); technologicalProcess = new List <DependenceOperationInTechnologicalProcess>(); for (int i = 1; i < countRows; i++) { DataRow row = tempDataTable.Rows[i]; technologicalProcess.Add(createOperation(row)); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }