private void SaveShiftInfo() { try { Shifts shift = new Shifts(); shift.shiftName = ucShifts1.txtShiftName.Text; shift.timeStart = ucShifts1.txtTimeStart.Text; shift.timeEnd = ucShifts1.txtTimeEnd.Text; if (isAdd == true) { _shiftsRepository.Add(shift); MessageBox.Show("Successful added!"); isAdd = false; LoadData(); Init(); } else if (isUpdate == true) { _shiftsRepository.Update(selectedId, shift); MessageBox.Show("Successful updated!"); isUpdate = false; LoadData(); Init(); } } catch (Exception) { } }
private void SaveShiftInfo() { try { Shifts shift = new Shifts(); shift.shiftName = ucShifts1.txtShiftName.Text; shift.timeStart = DateTime.Parse(ucShifts1.txtTimeStart.Text); shift.timeEnd = DateTime.Parse(ucShifts1.txtTimeEnd.Text); _shiftsRepository.Add(shift); MessageBox.Show("Successful added!"); } catch (Exception ex) { } }