public DependenceSurface(int idInDb, string nameSurface, double diameter, TypeOfPart typeOfPart, TypeOfPart typeOfAllowance,
                          TypeOfPart typeOfProcessedSurface, double surfaceRoughness, double tolerance, double holeDepth)
 {
     this.idInDb              = idInDb;
     this.nameSurface         = nameSurface;
     this.parametersOfSurface = new ParametersOfSurface(diameter, typeOfPart, typeOfAllowance, typeOfProcessedSurface, surfaceRoughness, tolerance, holeDepth);
 }
        private static void saveSurfaces(int cipherDetail, int idCalculation)
        {
            List <Surface> surfaces     = Part.getSurfaces();
            int            countSufaces = Part.getCountSurfaces();

            for (int i = 1; i < countSufaces; i++)
            {
                Surface             surface             = surfaces[i];
                ParametersOfSurface parametersOfSurface = surface.getParametersOfSurface();

                string nameSurface = surface.getNameSurface();

                double diameterOfSurface = parametersOfSurface.getDiameterOfPart();

                int typeOfPart             = parametersOfSurface.getTypeOfPart().getIndex();
                int typeOfAllowance        = parametersOfSurface.getTypeOfAllowance().getIndex();
                int typeOfProcessedSurface = parametersOfSurface.getTypeOfProcessedSurface().getIndex();

                double surfaseRoughness = parametersOfSurface.getSurfaceRoughnessRz();

                double holeDepth = parametersOfSurface.getHoleDepth();
                double tolerance = parametersOfSurface.getAllowance();

                dbConnection.SetQuery($@"INSERT INTO {SURFACE} VALUES ({idCalculation}, '{nameSurface}', {doubleToStringForDb(diameterOfSurface)}, {typeOfPart}, {typeOfAllowance}, {typeOfProcessedSurface}, {doubleToStringForDb(surfaseRoughness)}, {doubleToStringForDb(holeDepth)}, {doubleToStringForDb(tolerance)})");

                int idSurface = getIdentCurrent(SURFACE);

                saveToTableOperationsAndResults(idSurface, surface, idCalculation);
            }
        }
Example #3
0
 public ParametersOfSurface getParametersOfSurface()
 {
     if (parametersOfSurface == null)
     {
         parametersOfSurface = new ParametersOfSurface();
     }
     return(parametersOfSurface);
 }
Example #4
0
        public void calculationOFSurface()
        {
            ParametersOfSurface parametersOfSurface = this.getParametersOfSurface();

            parametersOfSurface.setLengthOfPart(Part.getLenghtOfPart());

            DataStructures.CalculationOfSurface.ParametersOperationsForCalculation parametersOperations = getParametersOperationsForCalculation();

            CalculationOfSurface calculationOfSurface = new CalculationOfSurface(parametersOfSurface, parametersOperations);

            ClassesToCalculate.ResultsOfCalculation[] resultsOfCalculation = calculationOfSurface.calculation();

            recordOfResultsOfOperations(resultsOfCalculation);
        }
        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();
        }
Example #6
0
        public static ParametersOfSurface extractionOfParametersOfPartFromTextBoxes(MainForm form)
        {
            double diameterOfPart = StringConvertToDoubleOrZero(form.DiameterOfPart.Text);

            TypeOfPart typeOfPart             = createType(form.TypeOfPart);
            TypeOfPart typeOfAllowance        = createType(form.TypeOfAllowance);
            TypeOfPart typeOfProcessedSurface = createType(form.TypeOfProcessedSurface);

            double surfaceRoughness = StringConvertToDoubleOrZero(form.SurfaceRoughness.Text);
            double allowance        = StringConvertToDoubleOrZero(form.Allowance.Text);
            double holeDepth        = StringConvertToDoubleOrZero(form.HoleDepth.Text);


            ParametersOfSurface parameters = new ParametersOfSurface(diameterOfPart, typeOfPart, typeOfAllowance, typeOfProcessedSurface, surfaceRoughness, allowance, holeDepth);

            return(parameters);
        }
        public static void buttonOfCalculation(MainForm form)
        {
            try
            {
                int indexSelectedSurface       = StorageOfSelectedOperation.getIndexSelectedSurface();
                ParametersOfSurface parameters = extractionOfParametersOfPartFromTextBoxes(form);

                Part.getSurfaceOnIndex(indexSelectedSurface).setParametersOfSurface(parameters);

                Part.calculationOfSurfaces();

                if (Part.getSurfaceOnIndex(1).getParametersOperation()[0] != null && !ErrorMessage.getGlobalError())
                {
                    FormResult formResult = new FormResult();
                    formResult.ShowDialog();
                }
            }
            catch { }
        }
Example #8
0
 public void setParametersOfSurface(ParametersOfSurface parametersOfSurface)
 {
     this.parametersOfSurface = parametersOfSurface;
 }
Example #9
0
 public static void setParametersOfPart(ParametersOfSurface parametersOfPart)
 {
     Part.parametersOfSurface = parametersOfPart;
 }
 public CalculationOfSurface(ParametersOfSurface parametersOfPart, DataStructures.CalculationOfSurface.ParametersOperationsForCalculation parametersForCalculation)
 {
     this.parametersOfPart         = parametersOfPart;
     this.parametersForCalculation = parametersForCalculation;
 }