public void CreateException(string id, SelectionsViewModel selection, out bool isFinish) { var workTime = Model.Teachers.FirstOrDefault(x => x.MemberId == id); if (workTime != null) { var workTimeItem = workTime.Times.FirstOrDefault(x => x.Weekday == selection.SelectTime.DayOfWeek && x.Time == selection.SelectTime.TimeOfDay); workTimeItem.Exceptions.Add(new MemberWorkTimeItemException() { MemberWorkTimeItemId = workTimeItem.Id, ExceptionDate = selection.SelectTime, Status = Status.Disabled }); _removeStock(workTimeItem); MemberBooking booking; _cancelSchedule(id, selection, out booking); bool isSuccess; MakePair(booking, out isSuccess); if (isSuccess) { CreateSchedule(booking); isFinish = true; } else { isFinish = false; } } else { isFinish = false; } }
public JsonResult CancelException(string id, DateTimeOffset selection) { SelectionsViewModel selectTime = new SelectionsViewModel() { SelectTime = selection }; bool isFinish; _service.CancelException(id, selectTime, out isFinish); return(Json(new { info = isFinish })); }
public JsonResult ConfirmException(string Id, DateTimeOffset selection) { SelectionsViewModel selectTime = new SelectionsViewModel() { SelectTime = selection }; bool isFinish = false; _service.CreateException(Id, selectTime, out isFinish); return(Json(new { info = isFinish })); }
public JsonResult CheckException(string Id, DateTimeOffset selection) { SelectionsViewModel selectTime = new SelectionsViewModel() { SelectTime = selection }; bool hasClass = false; _service.CheckException(Id, selectTime, out hasClass); return(Json(new { info = hasClass })); }
public void CheckException(string id, SelectionsViewModel selection, out bool hasClass) { Schedule teacher = Model.Schedules.FirstOrDefault(x => x.MemberId == id); var tEvent = teacher.Events.FirstOrDefault(x => x.StartDate == selection.SelectTime); if (tEvent != null) { hasClass = true; } else { hasClass = false; } }
private void _cancelSchedule(string id, SelectionsViewModel selection, out MemberBooking booking) { var tSchedule = Model.Schedules.FirstOrDefault(x => x.MemberId == id); if (tSchedule != null) { var tEventItem = tSchedule?.Events.FirstOrDefault(x => x.StartDate == selection.SelectTime); if (tEventItem != null) { var sSchedule = Model.Schedules.FirstOrDefault(x => x.Id == tEventItem.SourceKey2); if (sSchedule != null) { var sEventItem = sSchedule?.Events.FirstOrDefault(x => x.StartDate == selection.SelectTime); if (sEventItem != null) { booking = Model.Bookings.FirstOrDefault(x => x.Id == tEventItem.SourceKey); booking.Status = BookingStatus.Booking; booking.Assigners.LastOrDefault().Status = AssignStatus.Cancel; tSchedule.Events.Remove(tEventItem); sSchedule.Events.Remove(sEventItem); } else { booking = null; } } else { booking = null; } } else { booking = null; } } else { booking = null; } }
public void CancelException(string id, SelectionsViewModel selection, out bool isFinish) { var workTime = Model.Teachers.Where(x => x.MemberId == id).FirstOrDefault(); if (workTime != null) { var workTimeItem = workTime.Times.FirstOrDefault(x => x.Weekday == selection.SelectTime.DayOfWeek && x.Time == selection.SelectTime.TimeOfDay); workTimeItem.Exceptions.Add(new MemberWorkTimeItemException() { MemberWorkTimeItemId = workTimeItem.Id, ExceptionDate = selection.SelectTime, Status = Status.Enabled }); _addStock(workTimeItem); isFinish = true; } else { isFinish = false; } }