Ejemplo n.º 1
0
        /// <summary>
        /// Method to produce the timetable of the selected member of staff, on the selected date.
        /// </summary>
        /// <param name="dateTime">Date to view the time table for (same as date selected for register viewing)</param>
        /// <param name="staffMember">Name of the staff member to retrieve the tiemtable for</param>
        /// <returns>String list of times mapped to patient names which the member of staff has an appointment for.</returns>
        public static List <string> ProduceTimetable(DateTime dateTime, string staffMember)
        {
            List <string> staff = new List <string>();

            staffMember = staffMember.Split('.').Last().Trim();

            var date    = Convert.ToString(dateTime);//DateTimeFormatter.ConvertToUkFormat(dateTime.ToString());
            var results = StaffModel.getStaffMemberTimetable(staffMember, date);

            foreach (DataRow row in results.Rows)
            {
                var time    = DateTimeFormatter.RemoveSeconds(row["Time"].ToString());
                var patient = row["Patient Name"].ToString();

                var item = String.Concat(time, ": ", patient);

                if (staff.Contains(item))
                {
                    continue;
                }

                staff.Add(item);
            }

            return(staff);
        }
Ejemplo n.º 2
0
        public void TestExcludeSeconds_GivenADefaultTimeFormatString_ReturnsExpectedTimeStringWithoutSeconds()
        {
            // Arrange
            var expected    = "12:30";
            var initialTime = "12:30:05";

            // Act
            var time = DateTimeFormatter.RemoveSeconds(initialTime);

            // Assert
            Assert.That(time, Is.EqualTo(expected));
        }