public void DeleteSection(Storage storage, StorageSection section, User user) { CheckPossibilityToDeleteSection(storage, user); storage.RemoveSection(section); storageRepository.Save(storage); }
public void AddSection(Storage storage, StorageSection section, User user) { CheckPossibilityToCreateAndEditSection(storage, user); ValidationUtils.Assert(storageRepository.IsSectionNameUnique(section.Name, section.Id, storage.Id), "Секция с таким названием уже существует."); storage.AddSection(section); storageRepository.Save(storage); }
private StorageStockSectionModel GetStorageStockSectionModel(List <Tuple <string, string, StockBase> > dic, string code) { StorageStockSectionModel model = new StorageStockSectionModel(); var finds = dic.Where(x => x.Item3.Code.Equals(code)); foreach (var item in finds) { StorageSection section = new StorageSection(); section.Title = item.Item1; section.Url = item.Item2; model.Sections.Add(section); } return(model); }
public void AddSection_RemoveSection_Test() { var storage = new Storage("Тестовое хранилище", StorageType.DistributionCenter); var storageSection = new StorageSection("Тестовая секция"); storage.AddSection(storageSection); Assert.AreEqual(storage.Sections.Count(), 1); Assert.AreEqual(storageSection.Storage.Name, "Тестовое хранилище"); Assert.AreEqual(storage.Sections.First().Name, "Тестовая секция"); storage.RemoveSection(storageSection); Assert.AreEqual(storage.Sections.Count(), 0); Assert.AreNotEqual(storageSection.DeletionDate, null); }
public void Storage_DeletionDate_Test() { var storage = new Storage("Тестовое хранилище", StorageType.DistributionCenter); var storageSection = new StorageSection("Тестовая секция"); Assert.IsNull(storage.DeletionDate); DateTime now = DateTime.Now; storage.AddSection(storageSection); storage.DeletionDate = now; Assert.AreEqual(storage.DeletionDate, now); DateTime new_now = new DateTime(2011, 1, 1); storage.DeletionDate = new_now; // не изменилось Assert.AreEqual(storage.DeletionDate, now); Assert.AreEqual(storageSection.DeletionDate, now); }
/// <summary> /// Default constructor /// </summary> private StorageBuilder() { this.StorageSection = ConfigurationManager.GetSection(SECTION_NAME) as StorageSection; }