public void FromDto(ProductPropertyChoiceDTO dto) { if (dto == null) return; this.ChoiceName = dto.ChoiceName ?? string.Empty; this.Id = dto.Id; this.LastUpdated = dto.LastUpdated; this.PropertyId = dto.PropertyId; this.SortOrder = dto.SortOrder; this.StoreId = dto.StoreId; }
// DTO public ProductPropertyChoiceDTO ToDto() { ProductPropertyChoiceDTO dto = new ProductPropertyChoiceDTO(); dto.ChoiceName = this.ChoiceName; dto.Id = this.Id; dto.LastUpdated = this.LastUpdated; dto.PropertyId = this.PropertyId; dto.SortOrder = this.SortOrder; dto.StoreId = this.StoreId; return dto; }
private List<ProductPropertyChoiceDTO> GetPropertyChoices(int propertyId) { List<ProductPropertyChoiceDTO> result = new List<ProductPropertyChoiceDTO>(); data.bvc2004Entities db = new data.bvc2004Entities(EFConnString(settings.SourceConnectionString())); var choices = db.bvc_ProductPropertyChoice.Where(y => y.PropertyID == propertyId) .OrderBy(y => y.SortOrder); if (choices == null) return result; foreach (data.bvc_ProductPropertyChoice ppc in choices) { ProductPropertyChoiceDTO dto = new ProductPropertyChoiceDTO(); dto.ChoiceName = ppc.ChoiceName; dto.LastUpdated = DateTime.UtcNow; //dto.PropertyId = ppc.PropertyBvin; dto.SortOrder = ppc.SortOrder; result.Add(dto); } return result; }
private List<ProductPropertyChoiceDTO> GetPropertyChoices(string propertyBvin, PropertyMapperInfo mapInfo) { List<ProductPropertyChoiceDTO> result = new List<ProductPropertyChoiceDTO>(); data.BV53Entities db = new data.BV53Entities(EFConnString(settings.SourceConnectionString())); var choices = db.bvc_ProductPropertyChoice.Where(y => y.PropertyBvin == propertyBvin) .OrderBy(y => y.SortOrder); if (choices == null) return result; foreach (data.bvc_ProductPropertyChoice ppc in choices) { ProductPropertyChoiceDTO dto = new ProductPropertyChoiceDTO(); dto.ChoiceName = ppc.ChoiceName; dto.LastUpdated = ppc.LastUpdated; //dto.PropertyId = ppc.PropertyBvin; dto.SortOrder = ppc.SortOrder; result.Add(dto); PropertyChoiceMapperInfo choiceMapInfo = new PropertyChoiceMapperInfo(); choiceMapInfo.OldBvin = ppc.bvin; choiceMapInfo.SortOrder = ppc.SortOrder; choiceMapInfo.TextValue = ppc.ChoiceName; mapInfo.Choices.Add(choiceMapInfo); } return result; }