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 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 TypeOfPart createType(ComboBox comboBox)
        {
            string name  = comboBox.Text;
            int    index = comboBox.SelectedIndex;

            TypeOfPart typeOfPart = new TypeOfPart(name, index);

            return(typeOfPart);
        }
Esempio n. 4
0
 public ParametersOfSurface()
 {
     this.diameterOfPart         = 0;
     this.typeOfPart             = new TypeOfPart("", 0);
     this.typeOfAllowance        = new TypeOfPart("", 0);
     this.typeOfProcessedSurface = new TypeOfPart("", 0);
     this.surfaceRoughnessRz     = 0;
     this.allowance = 0;
     this.holeDepth = 0;
 }
Esempio n. 5
0
 public ParametersOfSurface(double diameterOfPart,
                            TypeOfPart typeOfPart, TypeOfPart typeOfAllowance, TypeOfPart typeOfProcessedSurface,
                            double surfaceRoughnessRa, double allowance, double holeDepth = 0)
 {
     this.diameterOfPart         = diameterOfPart;
     this.typeOfPart             = typeOfPart;
     this.typeOfAllowance        = typeOfAllowance;
     this.typeOfProcessedSurface = typeOfProcessedSurface;
     this.surfaceRoughnessRz     = ConversionRoughnessRzAndRa.RaToRz(surfaceRoughnessRa);
     this.allowance = allowance;
     this.holeDepth = holeDepth;
 }
Esempio n. 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);
        }
Esempio n. 7
0
        private static TypeOfPart selectIndexOfTypesFromComboBox(string type, ComboBox comboBox)
        {
            bool validType   = false;
            int  indexOfType = 0;

            for (int i = 0; i < comboBox.Items.Count; i++)
            {
                if (comboBox.Items[i].ToString().Equals(type))
                {
                    validType   = true;
                    indexOfType = i;
                }
            }
            if (!validType)
            {
                throw new Exception();
            }
            TypeOfPart typeOfPart = new TypeOfPart(type, indexOfType);

            return(typeOfPart);
        }
Esempio n. 8
0
 public void setTypeOfAllowance(TypeOfPart typeOfAllowance)
 {
     this.typeOfAllowance = typeOfAllowance;
 }
Esempio n. 9
0
        public void setTypeOfPart(string name, int index)
        {
            TypeOfPart typeOfPart = new TypeOfPart(name, index);

            this.typeOfPart = typeOfPart;
        }
Esempio n. 10
0
 public void setTypeOfPart(TypeOfPart typeOfPart)
 {
     this.typeOfPart = typeOfPart;
 }
Esempio n. 11
0
        public void setTypeOfProcessedSurface(string name, int index)
        {
            TypeOfPart typeOfProcessedSurface = new TypeOfPart(name, index);

            this.typeOfProcessedSurface = typeOfProcessedSurface;
        }
Esempio n. 12
0
 public void setTypeOfProcessedSurface(TypeOfPart typeOfProcessedSurface)
 {
     this.typeOfProcessedSurface = typeOfProcessedSurface;
 }
Esempio n. 13
0
        public void setTypeOfAllowance(string name, int index)
        {
            TypeOfPart typeOfAllowance = new TypeOfPart(name, index);

            this.typeOfAllowance = typeOfAllowance;
        }