public static void buttonDelSurface(EventArgs e, MainForm form) { int selectedIndex = StorageOfSelectedOperation.getIndexSelectedSurface(); try { if (selectedIndex != 0) { form.SurfacesTreeView.Nodes.RemoveAt(selectedIndex); for (int i = 1; i < form.SurfacesTreeView.Nodes.Count; i++) { if (form.SurfacesTreeView.Nodes[i].Text == $"Поверхность {i + 1}") { string nameSurface = "Поверхность " + Convert.ToString(i); form.SurfacesTreeView.Nodes[i].Text = nameSurface; Part.getSurfaceOnIndex(i).setNameSurface(nameSurface); } } Part.deleteSurface(selectedIndex); StorageOfSelectedOperation.setIndexSelectedSurface(selectedIndex - 1); } } catch { } }
public static void buttonSelectProcess(MainForm form) { string nameSurface = "Поверхность 1"; int countNodes = form.SurfacesTreeView.Nodes.Count; distributionIdOnTechnologicalProcess(Part.getSurfaceOnIndex(0).getOperations()); if (countNodes == 1) { form.SurfacesTreeView.Nodes.Add("notChange", nameSurface); Part.setNameSurfaceOnIndex(1, nameSurface); Part.copyTechnologicalProcessInSurface(1); } StorageOfSelectedOperation.setIndexSelectedSurface(1); form.SurfacesTreeView.SelectedNode = form.SurfacesTreeView.Nodes[1]; form.NameSurface.Text = nameSurface; Part.insertListOfOperationsInTreeView(form, 1); Part.insertListOfTechnologicalProcessInTreeView(form); enabledTextBoxes(form); }
public static void buttonAddSurface(MainForm form) { try { TreeNode surface = new TreeNode(); int count = form.SurfacesTreeView.Nodes.Count; Part.copyTechnologicalProcessInSurface(count); Part.insertListOfOperationsInTreeView(form, count); surface.Name = "notChange"; surface.Text = "Поверхность " + Convert.ToString(count); form.SurfacesTreeView.Nodes.Add(surface); StorageOfSelectedOperation.setIndexSelectedSurface(count); form.SurfacesTreeView.SelectedNode = form.SurfacesTreeView.Nodes[count]; form.NameSurface.Text = surface.Text; Part.getSurfaceOnIndex(count).setNameSurface(surface.Text); } catch { } }
private static void insertOperationsOnReachBox(FormResult form, int index) { int typeOfPart = Part.getSurfaceOnIndex(index).getParametersOfSurface().getTypeOfPart().getIndex(); char type; if (typeOfPart == 0) { type = '-'; } else { type = '+'; } ClassesToCalculate.ResultsOfCalculation resultWorkpiece = Part.getWorkpiece().getResultsOfCalculation(); form.richTextBoxResult.Text = "Исходные данные: " + Part.getWorkpiece().getNameOfWorkpiece() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + Part.getWorkpiece().getResultsOfCalculation().getAccuracies() + ")"; for (int i = 0; i < Part.getSurfaceOnIndex(index).getCountLongListOperation(); i++) { resultWorkpiece = Part.getSurfaceOnIndex(index).getParametersOperation()[i].getResultsOfCalculation(); form.richTextBoxResult.Text += "\n" + i.ToString() + ") "; form.richTextBoxResult.Text += Part.getSurfaceOnIndex(index).getParametersOperation()[i].getNameOperation(); form.richTextBoxResult.Text += "\nСоставляющая припуска E= " + resultWorkpiece.getdeviationOfInstallation().ToString() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nВеличина номинального припуска Znom= " + resultWorkpiece.getNominalAllowance().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + resultWorkpiece.getAccuracies() + ")"; } }
public static void storageParametersOfSurface(MainForm form, int selectedIndex) { if (selectedIndex != 0) { int lastSelectedIndex = StorageOfSelectedOperation.getLastIndexSelectedSurface(); Part.getSurfaceOnIndex(lastSelectedIndex).setParametersOfSurface(extractionOfParametersOfPartFromTextBoxes(form)); Part.getSurfaceOnIndex(selectedIndex).getParametersOfSurface().insertParametersOfPartInTextboxes(form); } }
private static void saveTechnologicalProcessInPart() { Part.getSurfaceOnIndex(0).getOperations().Clear(); List <Operation> listOperation = Part.getSurfaceOnIndex(0).getOperations(); foreach (DependenceOperationInTechnologicalProcess operations in technologicalProcess) { listOperation.Add(operations.getOperation()); } }
private static void saveToTableTechnologicalProcessAndSurfaces(FormSaveToDataBase form, int cipherDetail, int idCalculation) { ParametersWorkpiece workpiece = Part.getWorkpiece(); int idWorkpieceInDB = saveWorkpiece(cipherDetail, idCalculation, workpiece); List <Operation> technologicalProcess = Part.getSurfaceOnIndex(0).getOperations(); int countOperation = Part.getSurfaceOnIndex(0).getCountShortListOperation(); for (int i = 0; i < countOperation; i++) { int idOperation = saveOperationInTechnologicalProcess(cipherDetail, idCalculation, technologicalProcess[i], i + 1); } saveSurfaces(cipherDetail, idCalculation); }
private static void saveOperationsInSurface(int index) { int numberOperationInPart = index + 1; selectOperationInDB(index); defineDependenciesOperations(); List <Operation> operations = Part.getSurfaceOnIndex(numberOperationInPart).getOperations(); operations.Clear(); foreach (DependenceOperation operation in EventOutputDataFromDataBase.operations) { Part.getSurfaceOnIndex(numberOperationInPart).setOpetation(new Operation(operation.getOperation())); } }
private static bool includedInTechnologicalProcess(Operation operation) { int idOperationOntechnologicalProcess = operation.getIdOnTechnologicalProcess(); List <Operation> technologicalProcess = Part.getSurfaceOnIndex(0).getOperations(); foreach (Operation operationInTechnologicalProcess in technologicalProcess) { if (idOperationOntechnologicalProcess == operationInTechnologicalProcess.getIdOnTechnologicalProcess()) { return(true); } } return(false); }
public static void buttonOfSaveChanges(EventArgs e, MainForm form) { try { int selectedOperation = StorageOfSelectedOperation.getIndexSelectedOperation(); int selectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); if (selectedOperation != 0) { Operation operation = Part.getSurfaceOnIndex(selectedSurface).getOperationOnIndex(selectedOperation - 1); extractionOfParametersOfOperationFromTextBoxes(operation, form); insertNameOperationInTreeView(form, selectedOperation); } } catch { } }
private void buttonSaveToDisk_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Текстовый документ (*.txt)|*.txt|Все файлы (*.*)|*.*"; List <Surface> surfaces = Part.getSurfaces(); int count = surfaces.Count; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { StreamWriter sw = new StreamWriter(sfd.FileName); int typeOfPart = Part.getParametersOfPart().getTypeOfPart().getIndex(); char type; if (typeOfPart == 0) { type = '-'; } else { type = '+'; } ClassesToCalculate.ResultsOfCalculation resultWorkpiece = Part.getWorkpiece().getResultsOfCalculation(); sw.WriteLine("Исходные данные: " + Part.getWorkpiece().getNameOfWorkpiece() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + Part.getWorkpiece().getResultsOfCalculation().getAccuracies() + ")"); for (int index = 0; index < count; index++) { for (int i = 0; i < Part.getSurfaceOnIndex(index).getCountLongListOperation(); i++) { resultWorkpiece = Part.getSurfaceOnIndex(index).getParametersOperation()[i].getResultsOfCalculation(); sw.WriteLine("\n" + i.ToString() + ") "); sw.WriteLine(Part.getSurfaceOnIndex(index).getParametersOperation()[i].getNameOperation()); sw.WriteLine("\nСоставляющая припуска E= " + resultWorkpiece.getdeviationOfInstallation().ToString() + "\nСоставляющая припуска P= " + resultWorkpiece.getSpatialDeviation().ToString() + "\nВеличина номинального припуска Znom= " + resultWorkpiece.getNominalAllowance().ToString() + "\nРазмер= " + resultWorkpiece.getSizeOfWorkprieceAfterOperation().ToString() + "(" + type + resultWorkpiece.getAccuracies() + ")"); } } sw.Close(); } }
public static void clickOnNode(TreeNodeMouseClickEventArgs e, MainForm form) { int selectedIndex = e.Node.Index; //storageParametersOfSurface(form, selectedIndex); StorageOfSelectedOperation.setIndexSelectedSurface(selectedIndex); form.NameSurface.Text = Part.getSurfaceOnIndex(selectedIndex).getNameSurface(); if (selectedIndex == 0) { StorageOfSelectedOperation.setIndexSelectedSurface(0); form.SurfacesTreeView.SelectedNode = form.SurfacesTreeView.Nodes[0]; Part.insertListOfOperationsInTreeView(form); form.TreeOfOperations.Nodes.Clear(); Tables.getParametersOfSurfacesAfterVariousOperations().insertListOfOperationsInTreeView(form); form.Surfaces.Visible = false; form.NameSurface.Visible = false; form.SurfacesTreeView.Visible = false; form.addSurfaceButton.Visible = false; form.delSurfaceButton.Visible = false; form.TreeOfOperations.Size = new Size(400, 287); form.TreeOfOperations.Location = new Point(16, 270); form.labelOperationsOrTechProcess.Size = new Size(91, 13); form.labelOperationsOrTechProcess.Location = new Point(169, 250); form.labelOperationsOrTechProcess.Text = "Выбор операций"; form.SelectTechnologicalProcess.Visible = true; form.CalculationOfSchema.Visible = false; } else { int indexSelectSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Part.insertListOfOperationsInTreeView(form, indexSelectSurface); int countOperations = form.TreeOfSelectedOperations.Nodes.Count; form.TreeOfSelectedOperations.SelectedNode = form.TreeOfSelectedOperations.Nodes[countOperations - 1]; } }
private static void saveToTableOfOperations(FormSaveToDataBase form, int index) { Surface surface = Part.getSurfaceOnIndex(0); List <ParametersOperation> parametersOperations = surface.getParametersOperation(); int numberOfOperation = surface.getCountLongListOperation(); for (int i = 0; i < numberOfOperation; i++) { ParametersOperation parametersOperation = parametersOperations[i]; ClassesToCalculate.ResultsOfCalculation resultsOfCalculation = parametersOperation.getResultsOfCalculation(); string nameOperation = parametersOperation.getTypeOfMachining() + ',' + parametersOperation.getPrecisionOfMachining(); // form.переходыTableAdapter.Insert(Convert.ToInt16(form.dataGridView1[0, index - 1].Value.ToString()) + 1, i + 1, nameOperation, parametersOperation.getTypeOfInstrument(), (float)parametersOperation.getSurfaceRoughnessRz(), (float)parametersOperation.getThicknessOfDefectiveCoating(), (float)resultsOfCalculation.getSpatialDeviation(), (float)resultsOfCalculation.getdeviationOfInstallation(), (float)resultsOfCalculation.getAccuracies(), (float)resultsOfCalculation.getNominalAllowance(), (float)resultsOfCalculation.getSizeOfWorkprieceAfterOperation(), parametersOperation.getIdOperation(), null, (float)parametersOperation.getCoefficientOfRefinement(), (int)parametersOperation.getKvalitet()); } }
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 { } }
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); } ; }
public static void clickOnNode(TreeNodeMouseClickEventArgs e, MainForm form) { int selectedIndex = e.Node.Index; StorageOfSelectedOperation.setIndexSelectedOperation(selectedIndex); if (selectedIndex == 0) { EventClickOnButtonOfSelectWorkpriece.buttonSelectWorkpriece(form); } else { int index = selectedIndex - 1; int idSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Operation operation = Part.getSurfaceOnIndex(idSelectedSurface).getOperationOnIndex(index); StorageOfSelectedOperation.setOperation(operation); StorageOfSelectedOperation.insertParametersOfOperationsInTextboxes(form); } }
private static Operation extractionOfParametersOfOperationsFromTechnologicalProcess(int idOperation) { Operation operation = Part.getSurfaceOnIndex(0).getOperationOnIndex(idOperation); return(operation); }