public DeliveryReportMessageDTO GetDeliveryReportMessage(int deliveryReportMessageId) { try { //Requires.NotNegative("deliveryReportMessageId", deliveryReportMessageId); log.Debug("deliveryReportMessageId: " + deliveryReportMessageId + " "); // get R_DeliveryReportMessage t = Repository.GetDeliveryReportMessage(deliveryReportMessageId); DeliveryReportMessageDTO dto = new DeliveryReportMessageDTO(t); log.Debug(DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(dto)); return(dto); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public int AddDeliveryReportMessage(DeliveryReportMessageDTO dto) { int id = 0; try { log.Debug(DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(dto)); R_DeliveryReportMessage t = DeliveryReportMessageDTO.ConvertDTOtoEntity(dto); // add id = Repository.AddDeliveryReportMessage(t); dto.DeliveryReportMessageId = id; log.Debug("result: 'success', id: " + id); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } return(id); }
public void DeleteDeliveryReportMessage(DeliveryReportMessageDTO dto) { try { log.Debug(DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(dto)); R_DeliveryReportMessage t = DeliveryReportMessageDTO.ConvertDTOtoEntity(dto); // delete Repository.DeleteDeliveryReportMessage(t); dto.IsDeleted = t.IsDeleted; log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
public void UpdateDeliveryReportMessage(DeliveryReportMessageDTO dto) { try { //Requires.NotNull(t); //Requires.PropertyNotNegative(t, "DeliveryReportMessageId"); log.Debug(DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(dto)); R_DeliveryReportMessage t = DeliveryReportMessageDTO.ConvertDTOtoEntity(dto); // update Repository.UpdateDeliveryReportMessage(t); log.Debug("result: 'success'"); } catch (System.Exception e) { // error log.Error(e.ToString()); throw; } }
private DeliveryReportMessageDTO Update(DeliveryReportMessageViewModel viewModel) { try { log.Debug(DeliveryReportMessageViewModel.FormatDeliveryReportMessageViewModel(viewModel)); // get log.Debug("_deliveryReportMessageService.GetDeliveryReportMessage - deliveryReportMessageId: " + viewModel.DeliveryReportMessageId + " "); var existingDeliveryReportMessage = _deliveryReportMessageService.GetDeliveryReportMessage(viewModel.DeliveryReportMessageId); log.Debug("_deliveryReportMessageService.GetDeliveryReportMessage - " + DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(existingDeliveryReportMessage)); if (existingDeliveryReportMessage != null) { // copy values viewModel.UpdateDTO(existingDeliveryReportMessage, null); //RequestContext.Principal.Identity.GetUserId()); // update log.Debug("_deliveryReportMessageService.UpdateDeliveryReportMessage - " + DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(existingDeliveryReportMessage)); _deliveryReportMessageService.UpdateDeliveryReportMessage(existingDeliveryReportMessage); log.Debug("result: 'success'"); } else { log.Error("existingDeliveryReportMessage: null, DeliveryReportMessageId: " + viewModel.DeliveryReportMessageId); } return(existingDeliveryReportMessage); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }
private DeliveryReportMessageDTO Create(DeliveryReportMessageViewModel viewModel) { try { log.Debug(DeliveryReportMessageViewModel.FormatDeliveryReportMessageViewModel(viewModel)); DeliveryReportMessageDTO deliveryReportMessage = new DeliveryReportMessageDTO(); // copy values viewModel.UpdateDTO(deliveryReportMessage, null); //RequestContext.Principal.Identity.GetUserId()); // audit deliveryReportMessage.CreateBy = null; //RequestContext.Principal.Identity.GetUserId(); deliveryReportMessage.CreateOn = DateTime.UtcNow; // add log.Debug("_deliveryReportMessageService.AddDeliveryReportMessage - " + DeliveryReportMessageDTO.FormatDeliveryReportMessageDTO(deliveryReportMessage)); int id = _deliveryReportMessageService.AddDeliveryReportMessage(deliveryReportMessage); deliveryReportMessage.DeliveryReportMessageId = id; log.Debug("result: 'success', id: " + id); return(deliveryReportMessage); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }