public void SaveState(SalesOrderData vm) { var data = this._ctx.Orders.SingleOrDefault(o => o.OrderId == vm.OrderId); if (data != null) { data.OrderId = vm.OrderId; data.OrderState = vm.OrderState; data.CustomerId = vm.CustomerId; data.ProductId = vm.ProductId; data.EditedAt = DateTime.Now; data.EditedBy = ""; data.ResponsiblePerson = ""; } else { data = new SalesOrderData { OrderId = vm.OrderId, OrderState = vm.OrderState, EditedAt = DateTime.Now, EditedBy = "", ResponsiblePerson = "" }; this._ctx.Orders.Add(data); } this._ctx.SaveChanges(); }
/// <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 }; 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); Projects = new ProjectData(Auth); SalesOrder = new SalesOrderData(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); }
/// <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); }