Пример #1
0
        public static RoomBookingRequestForm UpdateFromRequest(RoomBookingRequestForm roomBooking, EditRoomBookingRequest request)
        {
            roomBooking.LastUpdated    = DateTime.Now.AddHours(GlobalParams.TimeZone);
            roomBooking.Month          = request.Month;
            roomBooking.TargetRoomType = request.TargetRoomType;
            //If Image is request is null don't change
            if (!string.IsNullOrEmpty(request.IdentityCardImageUrl))
            {
                roomBooking.IdentityCardImageUrl = request.IdentityCardImageUrl;
            }

            //If Image is request is null don't change
            if (!string.IsNullOrEmpty(request.PriorityImageUrl))
            {
                roomBooking.PriorityImageUrl = request.PriorityImageUrl;
            }

            //If Image is request is null don't change
            if (!string.IsNullOrEmpty(request.StudentCardImageUrl))
            {
                roomBooking.StudentCardImageUrl = request.StudentCardImageUrl;
            }
            roomBooking.PriorityType = request.PriorityType;

            return(roomBooking);
        }
 public static GetRoomBookingDetailResponse ResponseFromEntity(RoomBookingRequestForm roomBooking, Student student, Entities.ParamEntities.Param roomType, Entities.ParamEntities.Param priorityType, Room room)
 {
     return(new GetRoomBookingDetailResponse()
     {
         CreatedDate = roomBooking.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
         StudentId = student.StudentId,
         RoomType = roomType.Name,
         LastUpdated = roomBooking.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
         Term = student.Term,
         PriorityTypeId = priorityType.ParamId,
         Name = student.Name,
         Gender = student.Gender,
         Month = roomBooking.Month,
         PriorityType = priorityType.Name,
         PriorityImageUrl = roomBooking.PriorityImageUrl,
         PhoneNumber = student.PhoneNumber,
         IdentityCardImageUrl = roomBooking.IdentityCardImageUrl,
         StudentCardImageUrl = roomBooking.StudentCardImageUrl,
         Address = student.Address,
         RoomTypeId = roomBooking.TargetRoomType,
         IdentityCardNumber = student.IdentityNumber,
         RoomBookingId = roomBooking.RoomBookingRequestFormId,
         RoomId = room?.RoomId,
         RoomName = room?.Name,
         RestrictDate = roomBooking.RejectDate.ToString(GlobalParams.DateTimeResponseFormat)
     });
 }
Пример #3
0
 public static GetRoomBookingResponse ResponseFromEntity(RoomBookingRequestForm roomBooking, Student student, Entities.ParamEntities.Param roomType, Room room)
 {
     return(new GetRoomBookingResponse()
     {
         StudentId = roomBooking.StudentId,
         Status = roomBooking.Status,
         Name = student.Name,
         CreatedDate = roomBooking.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
         LastUpdated = roomBooking.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
         Email = student.Email,
         TargetRoomType = roomBooking.TargetRoomType,
         RoomBookingRequestFormId = roomBooking.RoomBookingRequestFormId,
         Month = roomBooking.Month,
         StudentCardNumber = student.StudentCardNumber,
         TargetRoomTypeName = roomType.Name,
         RoomId = room?.RoomId ?? -1,
         RoomName = room?.Name ?? "null",
         RejectDate = roomBooking.RejectDate.ToString(GlobalParams.DateTimeResponseFormat)
     });
 }
Пример #4
0
 public static ArrangeRoomResponseStudent ResponseFromEntity(Student student, Room room, RoomBookingRequestForm roomBooking)
 {
     return(new ArrangeRoomResponseStudent()
     {
         StudentId = student.StudentId,
         RoomId = room.RoomId,
         Email = student.Email,
         RoomName = room.Name,
         StudentName = student.Name,
         RoomBookingId = roomBooking.RoomBookingRequestFormId
     });
 }