コード例 #1
0
        public long Add(ApplicationAdminModel model, TransitEditModel transit,
                        long clientId)
        {
            var transitId = _transitService.Add(transit, model.CarrierId);

            var data = new ApplicationEditData
            {
                Class                = null,
                TransitId            = transitId,
                Invoice              = model.Invoice,
                Characteristic       = model.Characteristic,
                AddressLoad          = model.AddressLoad,
                WarehouseWorkingTime = model.WarehouseWorkingTime,
                Weight               = model.Weight,
                Count                = model.Count,
                Volume               = model.Volume,
                TermsOfDelivery      = model.TermsOfDelivery,
                Value                = model.Currency.Value,
                CurrencyId           = model.Currency.CurrencyId,
                CountryId            = model.CountryId,
                FactoryName          = model.FactoryName,
                FactoryPhone         = model.FactoryPhone,
                FactoryEmail         = model.FactoryEmail,
                FactoryContact       = model.FactoryContact,
                MarkName             = model.MarkName,
                MethodOfDelivery     = model.MethodOfDelivery,
                IsPickup             = model.IsPickup,
                AirWaybillId         = null,
                DateInStock          = null,
                DateOfCargoReceipt   = null,
                TransitReference     = null,
                ClientId             = clientId,
                PickupCost           = model.PickupCost,
                TransitCost          = model.TransitCost,
                FactureCost          = model.FactureCost,
                FactureCostEx        = model.FactureCostEx,
                TariffPerKg          = model.TariffPerKg,
                ScotchCostEdited     = model.ScotchCostEdited,
                FactureCostEdited    = model.FactureCostEdited,
                FactureCostExEdited  = model.FactureCostExEdited,
                TransitCostEdited    = model.TransitCostEdited,
                PickupCostEdited     = model.PickupCostEdited,
                SenderId             = model.SenderId,
                ForwarderId          = GetForwarderId(model.ForwarderId, transit.CityId, null),
                SenderRate           = null,
                InsuranceRate        = model.InsuranceRate / 100,
                CountInInvoce        = model.CountInInvoce,
                DocumentWeight       = model.DocumentWeight,
                MRN      = model.MRN,
                Comments = model.Comments
            };

            return(_editor.Add(data));
        }
コード例 #2
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));
        }
コード例 #3
0
        public long Add(ClientModel client, TransitEditModel transit)
        {
            var data = GetData(client);

            using (var ts = new TransactionScope())
            {
                var transitId = _transits.Add(transit, null);

                var userId = _users.Add(client.Authentication.Login,
                                        client.Authentication.NewPassword,
                                        TwoLetterISOLanguageName.English);

                var clientId = _clients.Add(data, userId, transitId);

                ts.Complete();

                return(clientId);
            }
        }