private void btnSave_Click(object sender, EventArgs e) { bool valid = true; Decimal money; string description; Decimal weight; int quantity; Guid productGroupID; Units unit; if (!Decimal.TryParse(txtBoxMoney.Text, out money)) { notify("Не правильно введена цена"); valid = false; } description = txtBoxDescription.Text; if (!Int32.TryParse(txtBoxQuantity.Text, out quantity)) { notify("Не правильно введено количество"); valid = false; } if (!Decimal.TryParse(txtBoxWeight.Text, out weight)) { notify("Не правильно введен вес"); valid = false; } unit = (Units)cmbUnit.SelectedItem; productGroupID = (cmbProductGroupID.SelectedItem as ProductGroup).Id; if (valid) { presenter.save(listBox1.SelectedItem as Product, money, description, weight, quantity, productGroupID, unit); } }