예제 #1
0
        /// <summary>
        /// To get the client history when start date and end date are given.
        /// </summary>
        /// <param name="clientCode"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public List <ClientHistoryViewModel> GetClientHistory(string clientCode, DateTime startDate, DateTime endDate)
        {
            List <ClientHistoryViewModel> clientHistoryViewModelList = null;

            try
            {
                List <ClientHistory> clientHistoryList = _clientDataRepository.GetClientHistory(clientCode, startDate, endDate);
                if (clientHistoryList != null)
                {
                    clientHistoryViewModelList = new List <ClientHistoryViewModel>();
                    foreach (ClientHistory clientHistory in clientHistoryList)
                    {
                        ClientHistoryViewModel clientHistoryViewModel = new ClientHistoryViewModel();
                        clientHistoryViewModel.ModifiedOrAddedBy      = clientHistory.ModifiedOrAddedBy;
                        clientHistoryViewModel.ModifiedOrAddedDate    = clientHistory.ModifiedOrAddedDate;
                        clientHistoryViewModel.UpdatedOrAddedProperty = clientHistory.UpdatedOrAddedProperty;
                        clientHistoryViewModel.NewValue = clientHistory.NewValue;
                        clientHistoryViewModel.OldValue = clientHistory.OldValue;
                        clientHistoryViewModel.Action   = clientHistory.Action;
                        clientHistoryViewModelList.Add(clientHistoryViewModel);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
            }
            return(clientHistoryViewModelList);
        }
예제 #2
0
 public HistoryModel(ICarRepository ICarRepository, UserManager <ApplicationUser> userManager,
                     IClientRepository clientRepository)
 {
     this.ICarRepository = ICarRepository;
     UserManager         = userManager;
     ClientRepository    = clientRepository;
     ClientHistory       = new ClientHistoryViewModel();
 }
예제 #3
0
        public PartialViewResult bookingCanceledByClient(int bookingId, string userID)
        {
            var booking = carRepository.GetAllBooking().SingleOrDefault(c => c.Id == bookingId);

            if (Convert.ToDateTime(booking.HireDate).Date > DateTime.Now.Date)
            {
                ClientRepository.CancelBooking(bookingId);
                ClientRepository.Save();
            }
            var UserBookingCars = carRepository.GetAllBookingByUserID(userID)
                                  .Where(c => !c.IsBookingCanceled).ToList();

            var UserCars = carRepository.GetAllUserCar(userID);

            ClientHistoryViewModel clientHistory = new ClientHistoryViewModel()
            {
                UserBookingCars = UserBookingCars,
                UserCars        = UserCars
            };

            return(PartialView("_History", clientHistory));
        }