private BrandItemEntity GetBrandWithLoad(long?id) { BrandItemEntity brandItem = null; if (id.HasValue) { brandItem = GetBrand(id.Value); if (brandItem == null) { BrandInfo brandInfo = webService.GetBrandInfo(id.Value); if (brandInfo != null) { brandItem = DownLoadBrandItem(brandInfo); if (brandItem != null) { webService.ConfirmUpdateBrands(new[] { brandItem.Id }); } } } } return(brandItem); }
private void Update(CatalogItemEntity entity, CatalogInfo catalogInfo) { BrandItemEntity brandItem = GetBrandWithLoad(catalogInfo.BrandId); DirectoryEntity directory = GetDirectoryWithLoad(catalogInfo.DirectoryId); List <PhotoItemEntity> photos = GetPhotosWithLoad(catalogInfo.Photos); entity.Id = catalogInfo.Id; entity.UID = catalogInfo.UID; entity.Code = catalogInfo.Code; entity.Article = catalogInfo.Article; entity.Brand = brandItem; entity.BrandName = brandItem?.Name; entity.Name = catalogInfo.Name; entity.Unit = catalogInfo.Unit; entity.EnterpriceNormPack = catalogInfo.EnterpriceNormPack; entity.BatchOfSales = catalogInfo.BatchOfSales; entity.Balance = catalogInfo.Balance; entity.Price = catalogInfo.Price; entity.Currency = catalogInfo.Currency; entity.Multiplicity = catalogInfo.Multiplicity; entity.HasPhotos = catalogInfo.HasPhotos; entity.Photos = photos; entity.DateOfCreation = catalogInfo.DateOfCreation; entity.LastUpdated = catalogInfo.LastUpdated; entity.ForceUpdated = catalogInfo.ForceUpdated; entity.Status = LoadAssembler.Convert(catalogInfo.Status); entity.LastUpdatedStatus = catalogInfo.LastUpdatedStatus; entity.Directory = directory; }
public BrandInfo GetItem(long id) { BrandItemEntity entity = dataService.DataBaseContext.BrandItemEntities.Find(id); BrandInfo result = Assemble(entity); return(result); }
public static CatalogItemEntity Assemble(CatalogInfo catalogInfo, BrandItemEntity brandItem, List <PhotoItemEntity> photos, DirectoryEntity directory) { CatalogItemEntity catalogItem = new CatalogItemEntity { Id = catalogInfo.Id, UID = catalogInfo.UID, Code = catalogInfo.Code, Article = catalogInfo.Article, Brand = brandItem, BrandName = brandItem?.Name, Name = catalogInfo.Name, Unit = catalogInfo.Unit, EnterpriceNormPack = catalogInfo.EnterpriceNormPack, BatchOfSales = catalogInfo.BatchOfSales, Balance = catalogInfo.Balance, Price = catalogInfo.Price, Currency = catalogInfo.Currency, Multiplicity = catalogInfo.Multiplicity, HasPhotos = catalogInfo.HasPhotos, Photos = photos, DateOfCreation = catalogInfo.DateOfCreation, LastUpdated = catalogInfo.LastUpdated, ForceUpdated = catalogInfo.ForceUpdated, Status = Convert(catalogInfo.Status), LastUpdatedStatus = catalogInfo.LastUpdatedStatus, Directory = directory }; return(catalogItem); }
private BrandItemEntity Create(BrandInfo brandInfo, List <BrandItemEntity> entitiesToInsert = null) { BrandItemEntity brand = LoadAssembler.Assemble(brandInfo); brandRepository.Add(brand); entitiesToInsert?.Add(brand); return(brand); }
private void Update(BrandItemEntity brandItem, BrandInfo brandInfo, List <BrandItemEntity> entitiesToUpdate) { entitiesToUpdate.Add(brandItem); brandItem.Code = brandInfo.Code; brandItem.Name = brandInfo.Name; brandItem.DateOfCreation = brandInfo.DateOfCreation; brandItem.ForceUpdated = brandInfo.ForceUpdated; brandItem.LastUpdated = brandInfo.LastUpdated; }
private CatalogItemEntity Create(CatalogInfo catalogInfo) { BrandItemEntity brandItem = GetBrandWithLoad(catalogInfo.BrandId); DirectoryEntity directory = GetDirectoryWithLoad(catalogInfo.DirectoryId); List <PhotoItemEntity> photos = GetPhotosWithLoad(catalogInfo.Photos); CatalogItemEntity entity = LoadAssembler.Assemble(catalogInfo, brandItem, photos, directory); return(entity); }
public BrandItemEntity DownLoadBrandItem(BrandInfo brandInfo) { BrandItemEntity brand = null; if (brandInfo != null) { brand = Create(brandInfo); dataService.Insert(brand); webService.ConfirmUpdateBrands(new[] { brand.Id }); } return(brand); }
public static BrandItemEntity Assemble(BrandInfo brandInfo) { BrandItemEntity brand = new BrandItemEntity { Id = brandInfo.Id, Code = brandInfo.Code, Name = brandInfo.Name, DateOfCreation = brandInfo.DateOfCreation, LastUpdated = brandInfo.LastUpdated, ForceUpdated = brandInfo.ForceUpdated }; return(brand); }
public CatalogSearchCriteria() { edvanceSearchWidth = 0; enabledEdvanceSearch = false; FirstBrandItemEntity = new BrandItemEntity { Id = -1L, Code = Guid.NewGuid(), Name = "Все бренды" }; SelectedDirectoryItems = new HashSet <DirectoryItem>(); SelectedBrandItems = new HashSet <BrandItem>(); DirectoryItems = new List <DirectoryItem>(); BrandItems = new List <BrandItem>(); InitCommodityDirection(); Clear(); SearchComplited(); IsModified = true; }
private BrandInfo Assemble(BrandItemEntity item) { BrandInfo result = null; if (item != null) { result = new BrandInfo { Id = item.Id, Code = item.Code, Name = item.Name, DateOfCreation = item.DateOfCreation, ForceUpdated = item.ForceUpdated, LastUpdated = item.LastUpdated }; } return(result); }
public BrandItem(BrandItemEntity entity) { Entity = entity; Selected = false; Subbrands = new List <BrandItem>(); }
private BrandItemEntity GetBrand(long id) { BrandItemEntity brand = brandRepository.GetItem(id); return(brand); }