/// <summary> /// Creates a connection using token. /// </summary> /// <param name="companyId">Company context</param> /// <param name="token">The predefined token from Visma.net</param> public VismaNet(int companyId, string token) { if (string.IsNullOrEmpty(token)) { throw new InvalidArgumentsException("Token is missing"); } _auth = new VismaNetAuthorization { Token = token, CompanyId = companyId }; Customers = new CustomerData(_auth); CustomerInvoices = new CustomerInvoiceData(_auth); Suppliers = new SupplierData(_auth); SupplierInvoices = new SupplierInvoiceData(_auth); CashSales = new CashSaleData(_auth); CustomerDocuments = new CustomerDocumentData(_auth); Dimensions = new DimensionData(_auth); Inventory = new InventoryData(_auth); JournalTransactions = new JournalTransactionData(_auth); Accounts = new FinAccountData(_auth); Employee = new EmployeeData(_auth); CreditNote = new CreditNoteData(_auth); Shipments = new ShipmentData(_auth); Contacts = new ContactData(_auth); InventoryIssue = new InventoryIssueData(_auth); }
/// <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); }