Пример #1
0
        public IEnumerable <ShipperViewModel> GetShippers(string value)
        {
            var shippers = _shipperRepository.Query(sh => (Equals(sh.ShipperC.Contains(value) || sh.ShipperN.Contains(value))) &&
                                                    sh.IsActive == Constants.ACTIVE);

            if (shippers != null)
            {
                var destination = Mapper.Map <IEnumerable <Shipper_M>, IEnumerable <ShipperViewModel> >(shippers);
                return(destination);
            }
            return(null);
        }
Пример #2
0
        public OrderPatternViewModel GetOrderPattern(string custMainCode, string custSubCode, string orderPatternC, DateTime?date)
        {
            var pattern = _orderPatternRepository.Query(pat => pat.CustomerMainC == custMainCode && pat.CustomerSubC == custSubCode && pat.OrderPatternC.Equals(orderPatternC)).FirstOrDefault();

            if (pattern == null)
            {
                return(null);
            }
            var destination = Mapper.Map <OrderPattern_M, OrderPatternViewModel>(pattern);

            var customer =
                _customerRepository.Query(
                    p => p.CustomerMainC == destination.CustomerMainC && p.CustomerSubC == destination.CustomerSubC)
                .FirstOrDefault();

            destination.CustomerN = customer != null ? customer.CustomerN : String.Empty;

            var shippingCompany = _shippingCompanyRepository.Query(p => p.ShippingCompanyC == destination.ShippingCompanyC).FirstOrDefault();

            destination.ShippingCompanyN = shippingCompany != null ? shippingCompany.ShippingCompanyN : String.Empty;

            var vessel = _vesselRepository.Query(p => p.VesselC == destination.VesselC).FirstOrDefault();

            destination.VesselN = vessel != null ? vessel.VesselN : String.Empty;

            var shipper = _shipperRepository.Query(p => p.ShipperC == destination.ShipperC).FirstOrDefault();

            destination.ShipperN = shipper != null ? shipper.ShipperN : String.Empty;

            var locLoadingPlace = _locationRepository.Query(p => p.LocationC == destination.LoadingPlaceC).FirstOrDefault();

            destination.LoadingPlaceN = locLoadingPlace != null ? locLoadingPlace.LocationN : String.Empty;

            var locStopoverPlace = _locationRepository.Query(p => p.LocationC == destination.StopoverPlaceC).FirstOrDefault();

            destination.StopoverPlaceN = locStopoverPlace != null ? locStopoverPlace.LocationN : String.Empty;

            var locDischargePlace = _locationRepository.Query(p => p.LocationC == destination.DischargePlaceC).FirstOrDefault();

            destination.DischargePlaceN = locDischargePlace != null ? locDischargePlace.LocationN : String.Empty;

            var conttainertype =
                _containerTypeRepository.Query(p => p.ContainerTypeC == destination.ContainerTypeC).FirstOrDefault();

            destination.ContainerTypeN = conttainertype != null ? conttainertype.ContainerTypeN : String.Empty;

            destination.PatternIndex = FindIndex(custMainCode, custSubCode, orderPatternC);

            //get list of contract tariff pattern
            destination.ContractTariffPatterns = _contractTariffPatternService.GetContractTariffPatterns(destination.CustomerMainC, destination.CustomerSubC, destination.LoadingPlaceC, destination.DischargePlaceC, date);
            return(destination);
        }