private void mapToModel(PickHeader pickH, PickHeaderModel pickModel) { Mapper.Map <PickHeader, PickHeaderModel>(pickH, pickModel); if (pickH.Location != null) { pickModel.LocationName = pickH.Location.LocationName; } if (pickH.Country != null) { pickModel.ShipCountry = pickH.Country.CountryName; } }
public PickHeaderModel mapToModel(PickHeader pick) { PickHeaderModel newItem = Mapper.Map <PickHeader, PickHeaderModel>(pick); if (pick.Customer != null) { newItem.CustomerName = pick.Customer.Name; } if (pick.PickStatusId != null) { newItem.Status = db.FindPickStatus(pick.PickStatusId.Value).StatusName; } if (pick.LocationId != null) { newItem.LocationName = db.FindLocation(pick.LocationId.Value).LocationName; } if (pick.ShipCountryId != null) { newItem.ShipCountry = db.FindCountry(pick.ShipCountryId.Value).CountryName; } return(newItem); }
private Error createPick(CompanyModel company, SalesOrderHeaderModel soh, ref PickHeaderModel pickHeader) { // Creates a pick in the pick database tables. // This method does not create any files. var error = new Error(); if (soh.SalesOrderDetails == null || soh.SalesOrderDetails.Count == 0) { error.SetError(EvolutionResources.errCannotCreatePickWithNoItems, "", soh.OrderNumber.ToString()); } else { LookupService.LookupService lookupService = new LookupService.LookupService(db); var pickH = new PickHeader { CompanyId = soh.CompanyId, CustomerId = soh.CustomerId, //public DateTimeOffset? PickDate { set; get; } //public int? PickStatusId { set; get; } LocationId = soh.LocationId, //public DateTimeOffset? STWDate { set; get; } //public DateTimeOffset? PickComplete { set; get; } //public DateTimeOffset? PackComplete { set; get; } ShipAddress1 = soh.ShipAddress1, ShipAddress2 = soh.ShipAddress2, ShipAddress3 = soh.ShipAddress3, ShipAddress4 = soh.ShipAddress4, ShipSuburb = soh.ShipSuburb, ShipState = soh.ShipState, ShipPostcode = soh.ShipPostcode, //public DateTimeOffset? InvoiceDate { set; get; } InvoiceNumber = Convert.ToInt32(lookupService.GetNextSequenceNumber(company, SequenceNumberType.InvoiceNumber)), //public bool InvoiceFinalised { set; get; } ShipMethodId = soh.ShippingMethodId, SalesPersonId = soh.SalespersonId, //public DateTimeOffset? ShipDate { set; get; } //public string TrackingNumber { set; get; } //public int? BoxCount { set; get; } //public int? PickPriority { set; get; } //public int? PickedById { set; get; } //public int? PackedById { set; get; } //public DateTimeOffset? ReadyForShippingDate { set; get; } //public int? ShippingDocumentId { set; get; } //public DateTimeOffset? AddedToShipManifestDate { set; get; } //public bool DocumentPrinted { set; get; } CustPO = soh.CustPO, //public string SecretComment { set; get; } //public string PickComment { set; get; } //public string ShipMethodAccount { set; get; } //public double? FreightCost { set; get; } DeliveryInstructions = soh.DeliveryInstructions, //public string CustomerContact { set; get; } IsManualFreight = soh.IsManualFreight, ShipCountryId = soh.ShipCountryId, //public decimal? OurFreightCost { set; get; } //public string EnteredBy { set; get; } WarehouseInstructions = soh.WarehouseInstructions, EndUserName = soh.EndUserName, CreditCardId = soh.CreditCardId, //public bool IsRetailPick { set; get; } //public bool IsUploadedToWarehouse { set; get; } TermsID = soh.TermsId, //public string UnregisteredFreightCarrier { set; get; } //public DateTimeOffset? DateCreditCardCharged { set; get; } OrderTypeId = soh.OrderTypeId }; db.InsertOrUpdatePickHeader(pickH); mapToModel(pickH, pickHeader); } return(error); }