Exemplo n.º 1
0
 public static GetEquipmentResponse ResponseFromEntity(Equipment equipment, Entities.ParamEntities.Param equipmentType, Room room)
 {
     return(new GetEquipmentResponse()
     {
         Status = equipment.Status,
         RoomId = room?.RoomId ?? -1,
         RoomName = room?.Name ?? "null",
         CreatedDateTime = equipment.CreatedDate,
         LastUpdatedDateTime = equipment.LastUpdated,
         CreatedDate = equipment.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
         LastUpdated = equipment.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
         EquipmentId = equipment.EquipmentId,
         Price = equipment.Price,
         Code = equipment.Code,
         EquipmentTypeId = equipmentType.ParamTypeId,
         EquipmentTypeName = equipmentType.Name,
     });
 }
Exemplo n.º 2
0
        public static GetStudentProfileResponse MapFromStudent(Student student, Entities.ParamEntities.Param param, User user, Room room)
        {
            GetStudentProfileResponsePriorityType priorityType = null;

            if (param != null)
            {
                priorityType = new GetStudentProfileResponsePriorityType()
                {
                    Name        = param.Name,
                    ParamTypeId = param.ParamTypeId,
                    ParamId     = param.ParamId
                };
            }

            return(new GetStudentProfileResponse()
            {
                Id = student.StudentId,
                Email = user.Email,
                //if null then room is null
                Room = (room != null) ? new GetStudentProfileResponseRoom()
                {
                    Id = room.RoomId,
                    Name = room.Name,
                }: null,
                PriorityType = priorityType,
                Gender = student.Gender,
                Address = student.Address,
                BirthDay = student.BirthDay.ToString(GlobalParams.BirthDayFormat),
                EvaluationScore = student.EvaluationScore,
                IdentityCardImageIrl = student.IdentityCardImageUrl,
                IdentityNumber = student.IdentityNumber,
                IsRoomLeader = student.IsRoomLeader,
                PhoneNumber = student.PhoneNumber,
                Name = student.Name,
                StartedSchoolYear = student.StartedSchoolYear,
                StudentCardNumber = student.StudentCardNumber,
                Term = student.Term,
            });
        }
Exemplo n.º 3
0
 public static GetRoomTransferResponse ResponseFromEntity(RoomTransferRequestForm roomTransfer, Student student, Room room, Entities.ParamEntities.Param roomType)
 {
     return(new GetRoomTransferResponse()
     {
         StudentId = roomTransfer.StudentId,
         StudentName = student.Name,
         StudentEmail = student.Email,
         RoomId = roomTransfer.RoomId ?? -1,
         RoomName = room?.Name ?? "null",
         Status = roomTransfer.Status,
         CreatedDate = roomTransfer.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
         LastUpdated = roomTransfer.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
         RejectDate = roomTransfer.RejectDate.ToString(GlobalParams.DateTimeResponseFormat),
         TransferDate = roomTransfer.TransferDate.ToString(GlobalParams.DateTimeResponseFormat),
         TargetRoomType = roomTransfer.TargetRoomType,
         TargetRoomTypeName = roomType.Name,
         Reason = roomTransfer.Reason,
         RoomTransferRequestFormId = roomTransfer.RoomTransferRequestFormId
     });
 }
 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)
     });
 }
Exemplo n.º 5
0
 public static GetAllMissingEquipmentRoomResponse ResponseFromEntity(RoomsAndEquipmentTypes roomsAndEquipmentTypesRoom, Room room, Entities.ParamEntities.Param equipmentType)
 {
     return(new GetAllMissingEquipmentRoomResponse()
     {
         RoomId = room.RoomId,
         RoomName = room.Name,
         EquipmentTypeId = equipmentType.ParamId,
         EquipmentTypeName = equipmentType.Name,
         MissingQuantity = roomsAndEquipmentTypesRoom.Quantity - roomsAndEquipmentTypesRoom.RealQuantity
     });
 }
Exemplo n.º 6
0
        public static GetIssueTicketDetailResponse ResponseFromEntity(IssueTicket issueTicket, Student owner, Entities.ParamEntities.Param type)
        {
            return(new GetIssueTicketDetailResponse()
            {
                IssueTicketId = issueTicket.IssueTicketId,
                Status = issueTicket.Status,
                CreatedDate = issueTicket.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
                LastUpdated = issueTicket.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
                EquipmentId = issueTicket.EquipmentId,
                Description = issueTicket.Description,
                ImageUrl = issueTicket.ImageUrl,

                Type = type.ParamId,
                TypeName = type.Name,

                OwnerId = owner.StudentId,
                OwnerEmail = owner.Email,
                OwnerName = owner.Name,

//                TargetStudentId = targetStudent?.StudentId,
//                TargetStudentEmail = targetStudent?.Email,
//                TargetStudentName = targetStudent?.Name
            });
        }
        public static GetIssueTicketResponse ResponseFromEntity(IssueTicket issueTicket, Student owner, Entities.ParamEntities.Param type, Equipment equipment, Entities.ParamEntities.Param equipmentType, Room room)
        {
            return(new GetIssueTicketResponse()
            {
                Status = issueTicket.Status,
                CreatedDate = issueTicket.CreatedDate.ToString(GlobalParams.DateTimeResponseFormat),
                LastUpdated = issueTicket.LastUpdated.ToString(GlobalParams.DateTimeResponseFormat),
                EquipmentId = equipment?.EquipmentId ?? -1,
                EquipmentCode = equipment?.Code ?? "null",
                EquipmentType = equipmentType?.ParamId ?? -1,
                EquipmentTypeName = equipmentType?.Name ?? "null",
                Description = issueTicket.Description,
                OwnerId = issueTicket.OwnerId,
                OwnerName = owner.Name,
                ImageUrl = issueTicket.ImageUrl,
//                TargetStudentId = issueTicket.TargetStudentId,
                Type = issueTicket.Type,
                TypeName = type.Name,
                IssueTicketId = issueTicket.IssueTicketId,
                RoomId = equipment?.RoomId ?? -1,
                RoomName = room?.Name ?? "null"
            });
        }
Exemplo n.º 8
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)
     });
 }