private static int saveToTableOfPart(FormSaveToDataBase form, string date)
        {
            string nameOfPart   = form.textBox1.Text;
            int    cipherDetail = Convert.ToInt32(form.textBox2.Text);

            bool isCipherExist = false;

            try
            {
                dbConnection.GetDataUsingDataAdapter($@"SELECT * FROM {DETAIL} WHERE cipher_detail = {cipherDetail}", ref tempDataTable, ref tableDataAdapter);

                isCipherExist = tempDataTable.Rows[0] != null;
            }

            catch { isCipherExist = false; }

            if (!isCipherExist)
            {
                double lengthOfPart = Part.getLenghtOfPart();

                dbConnection.SetQuery($@"INSERT INTO {DETAIL} VALUES ('{nameOfPart}', {cipherDetail}, '{date}', {doubleToStringForDb(lengthOfPart)})");
            }

            return(cipherDetail);
        }
Exemple #2
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);
        }