예제 #1
0
        public long Add(ApplicationClientModel application, TransitEditModel transit, long clientId)
        {
            var transitId = _transits.Add(transit, null);

            var forwarderId = _forwarders.GetByCityOrAny(transit.CityId, null);

            var client = _clients.Get(clientId);

            var data = new ApplicationEditData
            {
                Class                = null,
                TransitId            = transitId,
                Invoice              = application.Invoice,
                Characteristic       = application.Characteristic,
                AddressLoad          = application.AddressLoad,
                WarehouseWorkingTime = application.WarehouseWorkingTime,
                Weight               = application.Weight,
                Count                = application.Count,
                Volume               = application.Volume,
                TermsOfDelivery      = application.TermsOfDelivery,
                Value                = application.Currency.Value,
                CurrencyId           = application.Currency.CurrencyId,
                CountryId            = application.CountryId,
                FactoryName          = application.FactoryName,
                FactoryPhone         = application.FactoryPhone,
                FactoryEmail         = application.FactoryEmail,
                FactoryContact       = application.FactoryContact,
                MarkName             = application.MarkName,
                MethodOfDelivery     = application.MethodOfDelivery,
                IsPickup             = application.IsPickup,
                AirWaybillId         = null,
                DateInStock          = null,
                DateOfCargoReceipt   = null,
                TransitReference     = null,
                ClientId             = clientId,
                PickupCost           = client.PickupCost,
                TransitCost          = client.TransitCost,
                FactureCost          = client.FactureCost,
                FactureCostEx        = client.FactureCostEx,
                TariffPerKg          = client.TariffPerKg,
                ScotchCostEdited     = client.ScotchCostEdited,
                FactureCostEdited    = null,
                FactureCostExEdited  = null,
                TransitCostEdited    = null,
                PickupCostEdited     = null,
                SenderId             = client.DefaultSenderId,
                SenderRate           = null,
                ForwarderId          = forwarderId,
                InsuranceRate        = client.InsuranceRate ?? _applications.GetDefaultInsuranceRate()
            };

            return(_updater.Add(data));
        }
예제 #2
0
        private void Add(ApplicationEditData application, long clientId, long senderId)
        {
            var transit = _transits.GetByClient(clientId);

            transit.Id = 0;
            var transitId = _transits.Add(transit);

            application.TransitId   = transitId;
            application.ForwarderId = _forwarders.GetByCityOrAny(transit.CityId, null);
            application.Class       = null;
            application.SenderId    = senderId;
            application.ClientId    = clientId;

            _editor.Add(application);
        }
예제 #3
0
 private long GetForwarderId(long?forwarderId, long cityId, long?oldForwarderId)
 {
     return(forwarderId.HasValue
                         ? forwarderId.Value
                         : _forwarders.GetByCityOrAny(cityId, oldForwarderId));
 }