public async Task CloseShift() { if (await AddShiftRecord(ShiftRecordType.Close)) { _currentShift = null; _messenger.Send(new ShiftUpdatedMsg()); } }
public void LoadCurrentShiftStatus() { var shiftRecord = _vmLocator._dbShift.GetLastShiftRecord(); if (shiftRecord.ShiftRecordType is ShiftRecordType.Open) { _currentShift = shiftRecord; } _messenger.Send(new ShiftUpdatedMsg()); }
public bool RemoveShift(ShiftDetailModel shifDetailModel) { _connection.ChangeTracker.Clear(); var entity = Mapper.MapDetailModelToEntity(shifDetailModel); entity.User = _connection.Users.FirstOrDefault(x => x.ID == shifDetailModel.User.ID); _connection.Shifts.Remove(entity); return(_connection.SaveChanges() is 1); }
public ActionResult Post([FromBody] ShiftDetailModel ShiftDetail) { try { _ShiftDetailService.AddShiftDetail(ShiftDetail); return(RedirectToAction(nameof(Index))); } catch { return(new ViewResult()); } }
/// <summary> /// Selecting the shift as an employee /// </summary> /// <param name="shiftId"></param> protected async Task SelectedShiftAsEmployee(int shiftId) { if (LoggedInUser.RoleId == 4) { ShiftDetailModel shiftDetail = new ShiftDetailModel { PickedByEmployee = LoggedInUser.Id, ShiftId = shiftId }; ShiftDetailService.AddShiftDetail(shiftDetail); //signal r sending real time changes if (IsConnected) { await SendMessage(); } } }
public bool EditShift(ShiftDetailModel shifDetailModel) { _connection.ChangeTracker.Clear(); var entityShift = GetShiftWithIncludesData(_connection).First(x => x.ID == shifDetailModel.ID); var mappedEntityShift = Mapper.MapDetailModelToEntity(shifDetailModel); if (entityShift != mappedEntityShift) { _connection.Entry(entityShift).CurrentValues.SetValues(mappedEntityShift); return(_connection.SaveChanges() is 1); } else { return(false); } }
/// <summary> /// Request to cancel a shift /// </summary> /// <param name="shiftDetail"></param> public void CancelShiftDetail(ShiftDetailModel shiftDetail) { shiftDetail.IsCancelRequest = true; _userContext.SaveChanges(); }
/// <summary> /// Hard Deleteing the shift detail from database, when approving cancellation requests /// </summary> /// <param name="shiftDetail"></param> public void DeleteShiftDetail(ShiftDetailModel shiftDetail) { _userContext.ShiftDetailModels.Remove(shiftDetail); _userContext.SaveChanges(); }
/// <summary> /// Not implemented /// </summary> /// <param name="ShiftDetail"></param> public void UpdateShiftDetail(ShiftDetailModel ShiftDetail) { throw new NotImplementedException(); }
/// <summary> /// Adding Shift Detail /// </summary> /// <param name="ShiftDetail"></param> public void AddShiftDetail(ShiftDetailModel ShiftDetail) { _userContext.ShiftDetailModels.Add(ShiftDetail); _userContext.SaveChanges(); }
/// <summary> /// MEthod to Cancel the shift as an Employee /// </summary> /// <param name="shiftDetail"></param> protected void CancelShiftDetails(ShiftDetailModel shiftDetail) { ShiftDetailService.CancelShiftDetail(shiftDetail); }
public Task <ObservableCollection <PaymentListModel> > GetPaymentsByShiftList(ShiftDetailModel shiftDetailModel) => GetPaymentsCollection(PaymentsByShift(shiftDetailModel), Mapper.MapEntityToListModel);
/// <summary> /// Method to Approve the Cancellation as a supervisor/manager /// </summary> /// <param name="shiftDetailModel"></param> protected void ApproveCancellation(ShiftDetailModel shiftDetailModel) { //delete the shift details ShiftDetailService.DeleteShiftDetail(shiftDetailModel); }
// GET: ShiftDetail/Edit/5 public void Edit([FromBody] ShiftDetailModel ShiftDetail) { _ShiftDetailService.UpdateShiftDetail(ShiftDetail); }
/// <summary> /// Setting IsCancel Request= false, when disapproving cancellation requests /// </summary> /// <param name="shiftDetail"></param> public void DisapproveCancelShiftDetail(ShiftDetailModel shiftDetail) { shiftDetail.IsCancelRequest = false; _userContext.SaveChanges(); }
/// <summary> /// Method to Disapprove the Cancellation as a supervisor/manager /// </summary> /// <param name="shiftDetailModel"></param> protected void DisapproveCancellation(ShiftDetailModel shiftDetailModel) { //set the iscancelRequest of the shiftdetail to false ShiftDetailService.DisapproveCancelShiftDetail(shiftDetailModel); }
private static Func <Payment, bool> PaymentsByShift(ShiftDetailModel shiftDetailModel) => x => x.DateTime > shiftDetailModel.DateTime;