private void btnSubmit_Click(object sender, EventArgs e) { try { if (_model != null) { _model.RowMaterialName = txtRowMaterial.Text; _model.RowHedarId = Convert.ToDecimal(((DropDown)cmbRowHeaderName.SelectedItem).Value); _model.MeasurmentId = Convert.ToDecimal(((DropDown)cmbMeasurement.SelectedItem).Value); _model.IsActive = toggleActive.Checked; if (_model.RowMaterialId > 0) { receiver.Update(_model); } else { receiver.Add(_model); } } } catch (Exception ex) { } }