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());
        }
Пример #3
0
        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);
        }
Пример #4
0
 public ActionResult Post([FromBody] ShiftDetailModel ShiftDetail)
 {
     try
     {
         _ShiftDetailService.AddShiftDetail(ShiftDetail);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(new ViewResult());
     }
 }
Пример #5
0
        /// <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();
                }
            }
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
 /// <summary>
 /// Request to cancel a shift
 /// </summary>
 /// <param name="shiftDetail"></param>
 public void CancelShiftDetail(ShiftDetailModel shiftDetail)
 {
     shiftDetail.IsCancelRequest = true;
     _userContext.SaveChanges();
 }
Пример #8
0
 /// <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();
 }
Пример #9
0
 /// <summary>
 /// Not implemented
 /// </summary>
 /// <param name="ShiftDetail"></param>
 public void UpdateShiftDetail(ShiftDetailModel ShiftDetail)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 /// <summary>
 /// Adding Shift Detail
 /// </summary>
 /// <param name="ShiftDetail"></param>
 public void AddShiftDetail(ShiftDetailModel ShiftDetail)
 {
     _userContext.ShiftDetailModels.Add(ShiftDetail);
     _userContext.SaveChanges();
 }
Пример #11
0
 /// <summary>
 /// MEthod to Cancel the shift as an Employee
 /// </summary>
 /// <param name="shiftDetail"></param>
 protected void CancelShiftDetails(ShiftDetailModel shiftDetail)
 {
     ShiftDetailService.CancelShiftDetail(shiftDetail);
 }
Пример #12
0
 public Task <ObservableCollection <PaymentListModel> > GetPaymentsByShiftList(ShiftDetailModel shiftDetailModel) => GetPaymentsCollection(PaymentsByShift(shiftDetailModel), Mapper.MapEntityToListModel);
Пример #13
0
 /// <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);
 }
Пример #14
0
 // GET: ShiftDetail/Edit/5
 public void Edit([FromBody] ShiftDetailModel ShiftDetail)
 {
     _ShiftDetailService.UpdateShiftDetail(ShiftDetail);
 }
Пример #15
0
 /// <summary>
 /// Setting IsCancel Request= false, when disapproving cancellation requests
 /// </summary>
 /// <param name="shiftDetail"></param>
 public void DisapproveCancelShiftDetail(ShiftDetailModel shiftDetail)
 {
     shiftDetail.IsCancelRequest = false;
     _userContext.SaveChanges();
 }
Пример #16
0
 /// <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);
 }
Пример #17
0
 private static Func <Payment, bool> PaymentsByShift(ShiftDetailModel shiftDetailModel) =>
 x => x.DateTime > shiftDetailModel.DateTime;