private static DependenceSurface createSurface(DataRow row, FormOfWorkWithDatabase form)
        {
            int idInDb = Convert.ToInt32(row[0]);

            string nameSurface = Convert.ToString(row[2]);
            double diameter    = Convert.ToDouble(row[3]);

            int        typeIndex  = Convert.ToInt32(row[4]);
            ComboBox   comboBox   = form.parrentForm.TypeOfPart;
            TypeOfPart typeOfPart = selectIndexOfTypesFromComboBox(typeIndex, comboBox);

            typeIndex = Convert.ToInt32(row[5]);
            comboBox  = form.parrentForm.TypeOfAllowance;
            TypeOfPart typeOfAllowance = selectIndexOfTypesFromComboBox(typeIndex, comboBox);

            typeIndex = Convert.ToInt32(row[6]);
            comboBox  = form.parrentForm.TypeOfProcessedSurface;
            TypeOfPart typeOfProcessedSurface = selectIndexOfTypesFromComboBox(typeIndex, comboBox);

            double surfaceRoughness = Convert.ToDouble(row[7]);
            double holeDepth        = Convert.ToDouble(row[8]);
            double tolerance        = Convert.ToDouble(row[9]);

            DependenceSurface surface = new DependenceSurface(idInDb, nameSurface, diameter, typeOfPart, typeOfAllowance, typeOfProcessedSurface, surfaceRoughness, tolerance, holeDepth);

            return(surface);
        }
        private static void selectOperationInDB(int index)
        {
            DataTable tablesDataTable = new DataTable();
            DataTable tempDataTable   = new DataTable();

            DependenceSurface surface = surfaces[index];

            dbConnection.GetDataUsingDataAdapter($@"SELECT * FROM operations_and_Results WHERE ID_surface = {surface.getIdInDb()}", ref tempDataTable, ref tableDataAdapter);

            operations = new List <DependenceOperation>();
            try
            {
                foreach (DataRow row in tempDataTable.Rows)
                {
                    int    idOnTechnologicalProcess = Convert.ToInt32(row[0]);
                    int    numberOperation          = Convert.ToInt32(row[2]);
                    string typeOfInstrument         = Convert.ToString(row[3]);

                    DependenceOperation operation = new DependenceOperation(idOnTechnologicalProcess, numberOperation, typeOfInstrument);
                    operations.Add(operation);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        private static void insertParametersIntextBox(FormOfWorkWithDatabase form, int index)
        {
            DependenceSurface   surface    = surfaces[index];
            ParametersOfSurface parameters = surface.getParametersOfSurface();

            form.diameterOfSurface.Text = parameters.getDiameterOfPart().ToString();

            form.typeOfPart.Text             = parameters.getTypeOfPart().getName();
            form.typeOfAllowance.Text        = parameters.getTypeOfAllowance().getName();
            form.TypeOfProcessedSurface.Text = parameters.getTypeOfProcessedSurface().getName();

            form.SurfaceRoughness.Text = ConversionRoughnessRzAndRa.RzToRa(parameters.getSurfaceRoughnessRz()).ToString();
            form.HoleDepth.Text        = parameters.getHoleDepth().ToString();
            form.Tolerance.Text        = parameters.getAllowance().ToString();
        }
        private static void saveSurfaceInPart(FormOfWorkWithDatabase form)
        {
            int countSurface    = surfaces.Count;
            int selectIndexPart = form.NamePart.SelectedIndex;

            double lengtPart = parts[selectIndexPart].getLengthPart();

            for (int i = 0; i < countSurface; i++)
            {
                int numberSurfaceInPart   = i + 1;
                DependenceSurface surface = surfaces[i];

                surface.getParametersOfSurface().setLengthOfPart(lengtPart);

                Part.getSurfaceOnIndex(numberSurfaceInPart).setNameSurface(surface.getNameSurface());
                Part.getSurfaceOnIndex(numberSurfaceInPart).setParametersOfSurface(surfaces[i].getParametersOfSurface());

                saveOperationsInSurface(i);
            }
            ;
        }