Пример #1
0
        private string GenarateSchedule(RoomAllocationVM roomAllocation)
        {
            var      rooms    = GetAllRooms();
            var      room     = rooms.Find(x => x.Id == roomAllocation.RoomId);
            DateTime dt       = roomAllocation.FromTime;
            DateTime dt2      = roomAllocation.ToTime;
            string   schedule = "R. No. : " + room.RoomNo + ", " + roomAllocation.Day + ", " + dt.ToString("hh:mm tt") +
                                " - " + dt2.ToString("hh:mm tt");

            return(schedule);
        }
Пример #2
0
 public string Allocate(RoomAllocationVM roomAllocation)
 {
     roomAllocation.Schedule = GenarateSchedule(roomAllocation);
     if (aClassroomGateway.ScheduleExist(roomAllocation))
     {
         return("This Schedule overlaps with another class,Please choose a different time or room");
     }
     else
     {
         int rowAffected = aClassroomGateway.SaveSchedule(roomAllocation);
         if (rowAffected > 0)
         {
             return("Save Successfull");
         }
         return("Save Failed");
     }
 }