コード例 #1
0
        private OutletDTO Map(tblCostCentre tbl)
        {
            var dto = new OutletDTO
                          {
                              MasterId = tbl.Id,
                              DateCreated = tbl.IM_DateCreated,
                              DateLastUpdated = tbl.IM_DateLastUpdated,
                              StatusId = tbl.IM_Status,
                              Name = tbl.Name,
                              CostCentreCode = tbl.Cost_Centre_Code,
                              ParentCostCentreId = tbl.ParentCostCentreId ?? Guid.Empty,
                              CostCentreTypeId = tbl.CostCentreType ?? 0,
                              RouteMasterId = tbl.RouteId ?? Guid.Empty,
                              OutletCategoryMasterId = tbl.Outlet_Category_Id ?? Guid.Empty,
                              OutletTypeMasterId = tbl.Outlet_Type_Id ?? Guid.Empty,
                              DiscountGroupMasterId = tbl.Outlet_DiscountGroupId ?? Guid.Empty,
                              OutletProductPricingTierMasterId = tbl.Tier_Id ?? Guid.Empty,
                              VatClassMasterId = tbl.VATClass_Id ?? Guid.Empty,
                              Latitude = tbl.StandardWH_Latitude,
                              Longitude = tbl.StandardWH_Longtitude,
                              IsApproved = tbl.IM_Status == (int)EntityStatus.Active,
                              ShippingAddresses = new List<ShipToAddressDTO>(),
                              SpecialPricingTierMasterId = tbl.SpecialPricingTierId ?? Guid.Empty,

                          };
            foreach (var item in tbl.tblShipToAddress.Where(n => n.IM_Status == (int)EntityStatus.Active))
            {
                var addressitem = new ShipToAddressDTO
                                      {
                                          OutletId = dto.MasterId,
                                          MasterId = item.Id,
                                          DateCreated = item.IM_DateCreated,
                                          DateLastUpdated = item.IM_DateLastUpdated,
                                          StatusId = item.IM_Status,
                                          Name = item.Name,
                                          Code = item.Code,
                                          Description = item.Description,
                                          PostalAddress = item.PostalAddress,
                                          PhysicalAddress = item.PhysicalAddress,
                                          Longitude = item.Longitude ?? 0,
                                          Latitude = item.Latitude ?? 0
                                      };
                dto.ShippingAddresses.Add(addressitem);
            }
            return dto;
        }
コード例 #2
0
 public ShipToAddress Map(ShipToAddressDTO dto)
 {
     if (dto == null) return null;
     var address = Mapper.Map<ShipToAddressDTO, ShipToAddress>(dto);
     return address;
 }