コード例 #1
0
ファイル: Invoice.cs プロジェクト: hatefi-arman/Modules
        public Invoice(InvoiceTypes invoiceType,
                       string invoiceNumber,
                       Company owner,
                       DateTime invoiceDate,
                       DivisionMethods divisionMethod,
                       AccountingTypes accountType,
                       Invoice invoiceRefrence,
                       List<Order> orderRefrences,
                       Currency currency,
                       bool isCreditor,
                       Company transporter,
                       Company supplier,
                       string description,
                       List<InvoiceItem> list,
                       List<InvoiceAdditionalPrice> invoiceAdditionalPriceList,
                       IEntityConfigurator<Invoice> invoiceConfigurator,
                       IInvoiceDomainService invoiceDomainService,
                       IInvoiceItemDomainService invoiceItemDomainService,
                       IGoodUnitConvertorDomainService goodUnitConvertorDomainService,
                       IInvoiceAdditionalPriceDomainService invoiceAdditionalPriceDomainService,
                       IBalanceDomainService balanceDomainService)
            : this()
        {
            // TODO: Complete member initialization
            InvoiceType = invoiceType;
            InvoiceNumber = invoiceNumber;
            Owner = owner;
            InvoiceDate = invoiceDate;
            DivisionMethod = divisionMethod;
            AccountingType = accountType;
            InvoiceRefrence = invoiceRefrence;
            OrderRefrences = orderRefrences;
            Currency = currency;
            IsCreditor = isCreditor;
            Transporter = transporter;
            Supplier = supplier;

            TransporterId = Transporter == null ? (long?)null : Transporter.Id;
            SupplierId = Supplier == null ? (long?)null : Supplier.Id;
            InvoiceRefrenceId = InvoiceRefrence == null ? (long?)null : InvoiceRefrence.Id;
            Description = description;

            UpdateInvoiceItems(list, null, balanceDomainService);
            UpdateInvoiceAdditionalPrice(invoiceAdditionalPriceList, null);

            this.invoiceConfigurator = invoiceConfigurator;
            this.invoiceAdditionalPriceDomainService = invoiceAdditionalPriceDomainService;
            invoiceConfigurator.Configure(this);
            invoiceBaseType.ValidateType(this);

            checkInvoiceNumberToBeUnique(invoiceDomainService);
            CheckInvoiceHaveInvoiceItem();
            invoiceBaseType.CheckInvoiceItemValidateQuantityAndRefrence(this, invoiceItemDomainService, goodUnitConvertorDomainService);
            invoiceAdditionalPriceDomainService.CalculateAdditionalPrice(this);
        }
コード例 #2
0
ファイル: Invoice.cs プロジェクト: hatefi-arman/Modules
        public void Update(string invoiceNumber,
                           DateTime invoiceDate,
                           DivisionMethods divisionMethod,
                           Invoice invoiceRefrence,
                           List<Order> orderRefrences,
                           Currency currency,
                           bool isCreditor,
                           Company transporter,
                           Company supplier,
                           string description,
                           List<InvoiceItem> invoiceItems,
                           List<InvoiceAdditionalPrice> invoiceAdditionalPriceList,
                           IInvoiceDomainService invoiceDomainService,
                           IInvoiceItemDomainService invoiceItemDomainService,
                           IGoodUnitConvertorDomainService goodUnitConvertorDomainService,
                           IInvoiceAdditionalPriceDomainService invoiceAdditionalPriceDomainService,
                           IBalanceDomainService balanceDomainService)
        {
            InvoiceNumber = invoiceNumber;
            InvoiceDate = invoiceDate;
            DivisionMethod = divisionMethod;
            InvoiceRefrence = invoiceRefrence;
            OrderRefrences = orderRefrences;
            Currency = currency;
            Transporter = transporter;
            Supplier = supplier;
            Description = description;
            IsCreditor = isCreditor;
            UpdateInvoiceItems(invoiceItems, invoiceItemDomainService, balanceDomainService);
            UpdateInvoiceAdditionalPrice(invoiceAdditionalPriceList, invoiceAdditionalPriceDomainService);

            TransporterId = Transporter == null ? (long?)null : Transporter.Id;
            SupplierId = Supplier == null ? (long?)null : Supplier.Id;
            InvoiceRefrenceId = InvoiceRefrence == null ? (long?)null : InvoiceRefrence.Id;

            // this.invoiceConfigurator = invoiceConfigurator;
            //                        invoiceConfigurator.Configure(this);

            checkInvoiceNumberToBeUnique(invoiceDomainService);
            CheckInvoiceHaveInvoiceItem();
            invoiceBaseType.CheckInvoiceItemValidateQuantityAndRefrence(this, invoiceItemDomainService, goodUnitConvertorDomainService);
            invoiceBaseType.ValidateType(this);
            invoiceAdditionalPriceDomainService.CalculateAdditionalPrice(this);
            ApproveWorkFlows = new List<InvoiceWorkflowLog>();
        }