public ShipmentEntity GetByShipmentIdAndBoxId(string shipmentId, int boxId)
 {
     using (var scope = new TransactionScope())
     {
         // ShipmentInfor shipmentDataModel = _unitOfWork.ShipmentRepository.Get(t => t.ShipmentId.Equals(shipmentId, StringComparison.CurrentCultureIgnoreCase) && t.BoxId == boxId);
         ShipmentInfor shipmentDataModel = _unitOfWork.ShipmentRepository.Get(t => t.ShipmentId.Equals(shipmentId, StringComparison.CurrentCultureIgnoreCase));
         if (shipmentDataModel == null)
         {
             scope.Complete();
             return(null);
         }
         Mapper.CreateMap <ShipmentInfor, ShipmentEntity>();
         var shipmentData = Mapper.Map <ShipmentInfor, ShipmentEntity>(shipmentDataModel);
         scope.Complete();
         return(shipmentData);
     }
 }
 public ShipmentEntity GetByShipmentId(string shipmentId)
 {
     using (var scope = new TransactionScope())
     {
         ShipmentInfor shipmentDataModel = _unitOfWork.ShipmentRepository.Get(t => t.ShipmentId.Equals(shipmentId, StringComparison.CurrentCultureIgnoreCase));
         if (shipmentDataModel == null)
         {
             scope.Complete();
             return(null);
         }
         Mapper.CreateMap <ShipmentInfor, ShipmentEntity>();
         var shipmentData = Mapper.Map <ShipmentInfor, ShipmentEntity>(shipmentDataModel);
         shipmentData.Mawb        = shipmentDataModel.BoxInfo.MasterBill.MasterAirWayBill;
         shipmentData.BoxIdString = shipmentDataModel.BoxInfo.BoxId;
         scope.Complete();
         return(shipmentData);
     }
 }
        private static bool IsEquals(ShipmentInfor first, ShipmentInfor second)
        {
            if (first == null && second == null)
            {
                return(true);
            }
            if (first == null || second == null)
            {
                return(false);
            }
            if (String.Equals(first.Address, second.Address) && first.BoxId == second.BoxId && String.Equals(first.Consignee, second.Consignee) && String.Equals(first.Content, second.Content) &&
                String.Equals(first.Country, second.Country) && String.Equals(first.DateOfCompletion, second.DateOfCompletion) &&
                String.Equals(first.DeclarationNo, second.DeclarationNo) && String.Equals(first.Descrition, second.Descrition) && first.EmployeeId == second.EmployeeId &&
                first.Id == second.Id && first.NumberPackage == second.NumberPackage && String.Equals(first.Receiver, second.Receiver) && String.Equals(first.Sender, second.Sender) &&
                String.Equals(first.ShipmentId, second.ShipmentId) && String.Equals(first.Status, second.Status) && String.Equals(first.TelReceiver, second.TelReceiver) && first.TotalValue == second.TotalValue &&
                first.WarehouseId == second.WarehouseId && first.Weight == second.Weight && first.IsSyncOms == second.IsSyncOms)
            {
                return(true);
            }

            return(false);
        }
        public string[] GetReferenceOfShipment(string shipmentId)
        {
            using (var scope = new TransactionScope())
            {
                string[]      arr = new string[6];
                ShipmentInfor shipmentDataModel = _unitOfWork.ShipmentRepository.Get(t => t.ShipmentId.Equals(shipmentId, StringComparison.CurrentCultureIgnoreCase));

                if (shipmentDataModel != null)
                {
                    arr[0] = shipmentDataModel.Id.ToString();
                    arr[1] = shipmentDataModel.ShipmentId;
                    arr[2] = shipmentDataModel.BoxInfo.Id.ToString();
                    arr[3] = shipmentDataModel.BoxInfo.BoxId;
                    arr[4] = shipmentDataModel.BoxInfo.MasterBill.Id.ToString();
                    arr[5] = shipmentDataModel.BoxInfo.MasterBill.MasterAirWayBill;
                    scope.Complete();

                    return(arr);
                }

                scope.Complete();
                return(null);
            }
        }