/// <summary> /// Проверка данного проведенного реестра цен на наличие зависимых от него документов /// </summary> /// <returns></returns> private void CheckAccountingPriceListDependencies(AccountingPriceList accountingPriceList) { var subQuery = accountingPriceListRepository.GetArticleAccountingPricesSubquery(accountingPriceList.Id); var template = "Отменить проводку реестра цен невозможно из-за следующих документов:"; // приходные накладные var receiptWaybillList = receiptWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (receiptWaybillList.Any()) { throw new Exception(String.Format("{0} приходная накладная {1}.", template, receiptWaybillList.First().ReceiptWaybill.Name)); } // накладные перемещения var movementWaybillList = movementWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (movementWaybillList.Any()) { throw new Exception(String.Format("{0} накладная перемещения {1}.", template, movementWaybillList.First().MovementWaybill.Name)); } // накладные смены собственника var changeOwnerWaybillList = changeOwnerWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (changeOwnerWaybillList.Any()) { throw new Exception(String.Format("{0} накладная смены собственника {1}.", template, changeOwnerWaybillList.First().ChangeOwnerWaybill.Name)); } // накладные списания var writeoffWaybillList = writeoffWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (writeoffWaybillList.Any()) { throw new Exception(String.Format("{0} накладная списания {1}.", template, writeoffWaybillList.First().WriteoffWaybill.Name)); } //накладные реализации var expenditureWaybillList = expenditureWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (expenditureWaybillList.Any()) { throw new Exception(String.Format("{0} накладная реализации {1}.", template, expenditureWaybillList.First().ExpenditureWaybill.Name)); } // накладные возврата от клиента var returnFromClientWaybillList = returnFromClientWaybillRepository.GetRowsThatUseArticleAccountingPrices(subQuery, 1); if (returnFromClientWaybillList.Any()) { throw new Exception(String.Format("{0} накладная возврата от клиента {1}.", template, returnFromClientWaybillList.First().ReturnFromClientWaybill.Name)); } }