Beispiel #1
0
        /// <summary>
        /// Validates invoice from invoice Id only.  Ensures Invoice.Meter object is complete with all required tariff information.
        /// Returns JSON string.
        /// </summary>
        /// <param name="invoiceId">id of invoice to validate</param>
        /// <param name="saveAfterValidation">whether the changes to the invoice should be saved after validation</param>
        /// <returns>JSON representation of the validated Invoice, wrapped in EMRepsonse.</returns>
        public string validateInvoice(int invoiceId, bool saveAfterValidation)
        {
            Invoice invoice = mediator.DataManager.getInvoice(invoiceId);

            invoice = validateInvoice(invoice, saveAfterValidation);
            return(EMConverter.fromObjectToJSON(invoice));
        }
Beispiel #2
0
        //* * * UPDATE METHODS

        public string editInvoice(int invoiceId, string invoiceJSON, int propertyId)
        {
            Invoice updatedInvoice = EMConverter.fromJSONtoA <Invoice>(invoiceJSON);

            updatedInvoice = mediator.DataManager.editInvoice(invoiceId, updatedInvoice);

            ///validate updated invoice
            mediator.validateInvoice(updatedInvoice.Id, true);
            mediator.updatePropertyAnnualTotalCost(propertyId);
            return(EMConverter.fromObjectToJSON(updatedInvoice));
        }