private static void Map(ApplicationEditData from, DbContext.Application to) { to.Characteristic = from.Characteristic; to.AddressLoad = from.AddressLoad; to.WarehouseWorkingTime = from.WarehouseWorkingTime; to.Weight = from.Weight; to.Count = from.Count; to.Volume = from.Volume; to.TermsOfDelivery = from.TermsOfDelivery; to.Value = from.Value; to.CurrencyId = (int)@from.CurrencyId; to.MethodOfDeliveryId = (int)from.MethodOfDelivery; to.DateInStock = from.DateInStock; to.DateOfCargoReceipt = from.DateOfCargoReceipt; to.TransitReference = from.TransitReference; to.IsPickup = from.IsPickup; to.ClientId = from.ClientId; to.TransitId = from.TransitId; to.ClassId = (int?)from.Class; to.AirWaybillId = from.AirWaybillId; to.CountryId = from.CountryId; to.SenderId = from.SenderId; to.ForwarderId = from.ForwarderId; to.FactoryName = from.FactoryName; to.FactoryPhone = from.FactoryPhone; to.FactoryEmail = from.FactoryEmail; to.FactoryContact = from.FactoryContact; to.MarkName = from.MarkName; to.Invoice = from.Invoice; to.FactureCost = from.FactureCost; to.FactureCostEx = from.FactureCostEx; to.TariffPerKg = from.TariffPerKg; to.TransitCost = from.TransitCost; to.PickupCost = from.PickupCost; to.FactureCostEdited = from.FactureCostEdited; to.FactureCostExEdited = from.FactureCostExEdited; to.TransitCostEdited = from.TransitCostEdited; to.PickupCostEdited = from.PickupCostEdited; to.ScotchCostEdited = from.ScotchCostEdited; to.SenderRate = from.SenderRate; to.InsuranceRate = from.InsuranceRate; to.CalculationProfit = from.CalculationProfit; to.CalculationTotalTariffCost = from.CalculationTotalTariffCost; to.MRN = from.MRN; to.CountInInvoce = from.CountInInvoce; to.DocumentWeight = from.DocumentWeight; to.Comments = from.Comments; }
public long Add(ApplicationEditData application) { var entity = new DbContext.Application(); Map(application, entity); entity.StateId = _defaultStateId; entity.StateChangeTimestamp = DateTimeProvider.Now; entity.DisplayNumber = _executor.Query<int>("[dbo].[GetNextDisplayNumber]"); entity.CreationTimestamp = DateTimeProvider.Now; _context.Applications.InsertOnSubmit(entity); _context.SaveChanges(); return entity.Id; }
public long Add(ApplicationEditData application) { var entity = new DbContext.Application(); Map(application, entity); entity.StateId = _defaultStateId; entity.StateChangeTimestamp = DateTimeProvider.Now; entity.DisplayNumber = _executor.Query <int>("[dbo].[GetNextDisplayNumber]"); entity.CreationTimestamp = DateTimeProvider.Now; _context.Applications.InsertOnSubmit(entity); _context.SaveChanges(); return(entity.Id); }