how to set null value to datetimepicker and textbox fields to save data into EF

  • Thread starter Thread starter zleug
  • Start date Start date
Z

zleug

Guest
Hi All.

In Save button event I have

private void SaveEmployee_Click(object sender, RoutedEventArgs e)
{
var employee = new EmployeeDT();

if (Validate == true)
{
employee.EmployeeId = Guid.NewGuid();
employee.Name = NameTextBox.Text;
employee.Department = DepartmentTextBox.Text;
employee.IsActive = IsActiveCheckBox.IsChecked.HasValue ? IsActiveCheckBox.IsChecked.Value : false;
employee.CreatedDate = DateTime.Now;
employee.CreatedBy = CreatedByTextBox.Text;
employee.UpdateDate = ???????
employee.UpdateBy = ???????

var ea = new EmployeeAdapter();
ea.SaveEmployee(employee);
}
else
errorMessage();
}


How assign to employee.UpdateDate and employee.UpdateBy null or DBNull value?

Thanks.

Continue reading...
 
Back
Top