/*医生查看发件箱*/ public AllMessage MessageSent(DateTime? startDate, DateTime? endDate) { AllMessageEntity allMessageEntity = null; if (startDate == null) { allMessageEntity = new AllMessageEntity(); allMessageEntity.ErrorMessage = "Start Date! @Service"; } else if (endDate == null) { allMessageEntity = new AllMessageEntity(); allMessageEntity.ErrorMessage = "End Date! @Service"; } else { allMessageEntity = doctorLogic.MessageSent(startDate, endDate); } AllMessage allMessage = new AllMessage(); TranslateAllMessageEntityToAllMessageContractData(allMessageEntity, allMessage); return allMessage; }
private void TranslateAllMessageEntityToAllMessageContractData( AllMessageEntity allMessageEntity, AllMessage allMessage) { allMessage.ErrorMessage = allMessageEntity.ErrorMessage; allMessage.Count = allMessageEntity.Count; if (allMessage.Count > 0) { allMessage.message = new Message[allMessage.Count]; for (int i = 0; i < allMessage.Count; i++) { allMessage.message[i] = new Message(); allMessage.message[i].ErrorMessage = allMessageEntity.messageEntity[i].ErrorMessage; allMessage.message[i].Date = allMessageEntity.messageEntity[i].Date; allMessage.message[i].Sender = allMessageEntity.messageEntity[i].Sender; allMessage.message[i].Receiver = allMessageEntity.messageEntity[i].Receiver; allMessage.message[i].Status = allMessageEntity.messageEntity[i].Status; allMessage.message[i].Context = allMessageEntity.messageEntity[i].Context; } } }
/*用户取回发件箱*/ public AllMessage MessageSent(string userID, string password, DateTime? startDate, DateTime? endDate) { UserService userService = new UserService(); UserInfo userInfo = userService.Login(userID, password); if (userInfo.ErrorMessage == null) { return userService.MessageSent(startDate, endDate); } else { AllMessage allMessage = new AllMessage(); allMessage.ErrorMessage = userInfo.ErrorMessage; return allMessage; } }