示例#1
0
        public async Task GetTrackTimeDateRange_Success()
        {
            //Arrange
            var input = new GetTrackTimeDateRangeDatabaseInput("67d537cb-123d-424b-a6d1-2cc5b2920430");

            var dateRangeList = new List <GetTrackTimeDateRangeDatabaseOutput>();

            //Act
            dateRangeList = await _trackTimeRepo.GetTrakcTimeDateRanges(input);

            //Assert
            Assert.NotNull(dateRangeList);
        }
示例#2
0
        public async Task <IActionResult> DisplayTrackTimeDateRange()
        {
            if (TempData.Peek("userName") == null)
            {
                return(UserNotAllowedAccess());
            }

            //get the input object set up
            var dateRangeInput = new GetTrackTimeDateRangeDatabaseInput(TempData.Peek("userGuid").ToString());

            List <GetTrackTimeDateRangeDatabaseOutput> trackTimeDateRanges;

            try
            {
                //using the input object get the user's TrackTime date range(s)
                trackTimeDateRanges = await _ITrackTimeDomain.GetTrackTimeDateRanges(dateRangeInput);
            }
            catch (Exception)
            {
                throw;
            }

            return(View(trackTimeDateRanges));
        }
        /// <summary>
        /// Get the TrackTime data ranges that will be displayed on the UI
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <List <GetTrackTimeDateRangeDatabaseOutput> > GetTrakcTimeDateRanges(GetTrackTimeDateRangeDatabaseInput input)
        {
            var p = new DynamicParameters();

            p.Add("@p_UserGuid", input.UserGuid);

            IEnumerable <GetTrackTimeDateRangeDatabaseOutput> dateRanges;

            using (IDbConnection connection = new SqlConnection(_connectionString))
            {
                dateRanges = await connection.QueryAsync <GetTrackTimeDateRangeDatabaseOutput>("sp_GetTrackTimeDateRange", p, commandType : CommandType.StoredProcedure);
            }

            return(dateRanges.OrderByDescending(x => x.StartDate).ToList());
        }
示例#4
0
 /// <summary>
 /// Gets the TrackTime DateRanges for UI display
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task <List <GetTrackTimeDateRangeDatabaseOutput> > GetTrackTimeDateRanges(GetTrackTimeDateRangeDatabaseInput input)
 {
     return(await _ITrackTimeRepo.GetTrakcTimeDateRanges(input));
 }