/// <summary>
        /// Получение исходящей строки
        /// </summary>
        /// <param name="type">Тип исходящей накладной</param>
        /// <param name="id">Код строки исходящей накладной</param>
        /// <returns></returns>
        public OutgoingWaybillRow GetRow(WaybillType type, Guid id)
        {
            switch (type)
            {
            case WaybillType.ChangeOwnerWaybill:
                var changeOwnerWaybillRow = changeOwnerWaybillRepository.GetRowById(id);

                return(changeOwnerWaybillRow == null ? null : ConvertToOutgoingWaybillRow(changeOwnerWaybillRow));

            case WaybillType.MovementWaybill:
                var movementWaybillRow = movementWaybillRepository.GetRowById(id);

                return(movementWaybillRow == null ? null : ConvertToOutgoingWaybillRow(movementWaybillRow));

            case WaybillType.WriteoffWaybill:
                var writeoffWaybillRow = writeoffWaybillRepository.GetRowById(id);

                return(writeoffWaybillRow == null ? null : ConvertToOutgoingWaybillRow(writeoffWaybillRow));

            case WaybillType.ExpenditureWaybill:
                var expenditureWaybillRow = expenditureWaybillRepository.GetRowById(id);

                return(expenditureWaybillRow == null ? null : ConvertToOutgoingWaybillRow(expenditureWaybillRow));

            default:
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// Приведение IncomingWaybillRow к BaseWaybillRow
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        public BaseWaybillRow GetWaybillRow(IncomingWaybillRow row)
        {
            switch (row.Type)
            {
            case WaybillType.ReceiptWaybill:
                var rwr = receiptWaybillRepository.GetRowById(row.Id);
                ValidationUtils.NotNull(rwr, "Позиция приходной накладной не найдена. Возможно, она была удалена.");

                return(rwr);

            case WaybillType.MovementWaybill:
                var mwr = movementWaybillRepository.GetRowById(row.Id);
                ValidationUtils.NotNull(mwr, "Позиция накладной перемещения не найдена. Возможно, она была удалена.");

                return(mwr);

            case WaybillType.ChangeOwnerWaybill:
                var cowr = changeOwnerWaybillRepository.GetRowById(row.Id);
                ValidationUtils.NotNull(cowr, "Позиция накладной смены собственника не найдена. Возможно, она была удалена.");

                return(cowr);

            case WaybillType.ReturnFromClientWaybill:
                var rfcwr = returnFromClientWaybillRepository.GetRowById(row.Id);
                ValidationUtils.NotNull(rfcwr, "Позиция накладной возврата от клиента не найдена. Возможно, она была удалена.");

                return(rfcwr);

            default:
                throw new Exception("Неопределенный тип позиции накладной.");
            }
        }