private void OKDateButton_Click(object sender, EventArgs e) { if (Edit) { if (MachinesOperationsGrid.SelectedRows.Count == 0) { return; } if (String.IsNullOrWhiteSpace(MachinesOperationNameTextBox.Text)) { Infinium.LightMessageBox.Show(ref TopForm, false, "Некорректное название!", "Ошибка"); return; } decimal Norm; decimal PreparatoryNorm; try { Norm = Convert.ToDecimal(NormTextBox.Text); } catch { Infinium.LightMessageBox.Show(ref TopForm, false, "Некорректное значение нормы в час!", "Ошибка"); return; } try { PreparatoryNorm = Convert.ToDecimal(tbPreparatoryNorm.Text); } catch { Infinium.LightMessageBox.Show(ref TopForm, false, "Некорректное значение доп. нормы в час!", "Ошибка"); return; } TechStoreManager.EditMachinesOperation(MachinesOperationID, MachinesOperationNameTextBox.Text, Norm, PreparatoryNorm, Convert.ToInt32(MeasureComboBox.SelectedValue), ArticleTextBox.Text, Convert.ToInt32(cbPositions.SelectedValue), Convert.ToInt32(tbRank.Text), Convert.ToInt32(cbPositions2.SelectedValue), Convert.ToInt32(tbRank2.Text), Convert.ToInt32(cbDocTypes.SelectedValue), Convert.ToInt32(cbAlgorithms.SelectedValue)); } else { if (MachinesOperationsGrid.SelectedRows.Count == 0) { return; } TechStoreManager.AddMachinesOperationToMachine(MachineID, Convert.ToInt32(MachinesOperationsGrid.SelectedRows[0].Cells["MachinesOperationID"].Value)); } Ok = true; this.Close(); }