private void Save() { _violation.Date = dtpDate.Value.Date; _violation.Number = tbNumber.Text; if (chbPaid.Checked) { _violation.DatePay = dtpDatePaid.Value.Date; } else { _violation.DatePay = null; } TextBox tbFile = ucFile.Controls["tbFile"] as TextBox; _violation.File = tbFile.Text; _violation.IDViolationType = cbViolationType.SelectedValue.ToString(); _violation.Sum = tbSum.Text; TextBox tbFilePay = ucFilePay.Controls["tbFile"] as TextBox; _violation.FilePay = tbFilePay.Text; _violation.NoDeduction = chbNoDeduction.Checked; _violation.Save(); }