private DateNote GetFields(DateNote dnote) { dnote.Note = tbNote.Text; dnote.AppearOnAddingBooking = cbAppearOnBooking.Checked; dnote.AppearOnRoster = cbAppearOnRoster.Checked; dnote.StartDate = dtpStart.Value; dnote.EndDate = dtpEnd.Value; dnote.DateCreated = DateTime.Now; dnote.Restaurant = new UnitOfWork().RestaurantRepository.Get().FirstOrDefault(); return dnote; }
private void AddEditDateNote_Load(object sender, EventArgs e) { if(DateNoteID.HasValue) { var unitOfWork = new UnitOfWork(); workingnote = unitOfWork.DateNoteRepository.GetByID(DateNoteID); dtpStart.Value = workingnote.StartDate; dtpEnd.Value = workingnote.EndDate; cbAppearOnBooking.Checked = workingnote.AppearOnAddingBooking; cbAppearOnRoster.Checked = workingnote.AppearOnRoster; tbNote.Text = workingnote.Note; } }