Exemplo n.º 1
0
        /// <summary>
        ///     Creates a connection using token.
        /// </summary>
        /// <param name="companyId">Company context</param>
        /// <param name="token">The predefined token from Visma.net</param>
        /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param>
        public VismaNet(int companyId, string token, int branchId = 0)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new InvalidArgumentsException("Token is missing");
            }

            Auth = new VismaNetAuthorization
            {
                Token     = token,
                CompanyId = companyId,
                BranchId  = branchId
            };
            Attribute                = new AttributeData(Auth);
            Customer                 = new CustomerData(Auth);
            Currency                 = new CurrencyData(Auth);
            CustomerInvoice          = new CustomerInvoiceData(Auth);
            Supplier                 = new SupplierData(Auth);
            SupplierInvoice          = new SupplierInvoiceData(Auth);
            CashSale                 = new CashSaleData(Auth);
            CustomerDocument         = new CustomerDocumentData(Auth);
            Dimension                = new DimensionData(Auth);
            Discount                 = new DiscountData(Auth);
            Inventory                = new InventoryData(Auth);
            JournalTransaction       = new JournalTransactionData(Auth);
            GeneralLedgerTransaction = new GeneralLedgerTransactionData(Auth);
            GeneralLedgerBalance     = new GeneralLedgerBalanceData(Auth);
            Account         = new FinAccountData(Auth);
            FinancialPeriod = new FinancialPeriodData(Auth);
            Employee        = new EmployeeData(Auth);
            Shipment        = new ShipmentData(Auth);
            Contact         = new ContactData(Auth);
            Project         = new ProjectData(Auth);
#pragma warning disable CS0618 // Type or member is obsolete
            SalesOrder = new SalesOrderData(Auth);
#pragma warning restore CS0618 // Type or member is obsolete
            Branch             = new BranchData(Auth);
            Warehouse          = new WarehouseData(Auth);
            Location           = new LocationData(Auth);
            Subaccount         = new SubaccountData(Auth);
            CustomerPayment    = new CustomerPaymentData(Auth);
            Dynamic            = new VismaNetDynamicEndpoint(null, Auth);
            Resources          = new VismaNetDynamicEndpoint(null, Auth, true);
            SupplierDocument   = new SupplierDocumentData(Auth);
            InventoryIssue     = new InventoryIssueData(Auth);
            InventoryReceipt   = new InventoryReceiptData(Auth);
            PurchaseReceipt    = new PurchaseReceiptData(Auth);
            CustomerSalesPrice = new CustomerSalesPriceData(Auth);
            CustomerCreditNote = new CustomerCreditNoteData(Auth);
            PurchaseOrder      = new PurchaseOrderData(Auth);
            CashTransaction    = new CashTransactionData(Auth);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates a connection using token.
        /// </summary>
        /// <param name="companyId">Company context</param>
        /// <param name="token">The predefined token from Visma.net</param>
        /// <param name="branchId">Branch ID to work with in the Visma.net Company (optional)</param>
        public VismaNet(int companyId, string token, int branchId = 0)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new InvalidArgumentsException("Token is missing");
            }

            Auth = new VismaNetAuthorization
            {
                Token     = token,
                CompanyId = companyId,
                BranchId  = branchId
            };
            Customer           = new CustomerData(Auth);
            CustomerInvoice    = new CustomerInvoiceData(Auth);
            Supplier           = new SupplierData(Auth);
            SupplierInvoice    = new SupplierInvoiceData(Auth);
            CashSale           = new CashSaleData(Auth);
            CustomerDocument   = new CustomerDocumentData(Auth);
            Dimension          = new DimensionData(Auth);
            Inventory          = new InventoryData(Auth);
            JournalTransaction = new JournalTransactionData(Auth);
            Account            = new FinAccountData(Auth);
            Employee           = new EmployeeData(Auth);
            CreditNote         = new CreditNoteData(Auth);
            Shipment           = new ShipmentData(Auth);
            Contact            = new ContactData(Auth);
            Project            = new ProjectData(Auth);
            SalesOrder         = new SalesOrderData(Auth);
            Payment            = new PaymentData(Auth);
            Branch             = new BranchData(Auth);
            Warehouse          = new WarehouseData(Auth);
            Location           = new LocationData(Auth);
            Subaccount         = new SubaccountData(Auth);
            CustomerPayment    = new CustomerPaymentData(Auth);
            Dynamic            = new VismaNetDynamicEndpoint(null, Auth);
            Resources          = new VismaNetDynamicEndpoint(null, Auth, true);
        }