private void ConnectToClients() { var sourceLoginCode = VgConnections.ConnectToSourceClient(_sourceClientName, _bapiKey); if (sourceLoginCode != 0) { MessageBox.Show(string.Format("Login mot {0} misslyckades. {1}{2}", _sourceClientName, Environment.NewLine, VgConnections.TranslateLoginCodeToMessage(sourceLoginCode))); } var destinationLoginCode = VgConnections.ConnectToDestinationClient(_destinationClientName, txtBapiKey.Text); if (destinationLoginCode != 0) { MessageBox.Show(string.Format("Login mot {0} misslyckades. {1}{2}", _destinationClientName, Environment.NewLine, VgConnections.TranslateLoginCodeToMessage(destinationLoginCode))); } btnGetInvoicesFromSourceClient.Enabled = (sourceLoginCode + destinationLoginCode) == 0; btnGetInvoicesFromSourceClient.Text = string.Format("Last ned fakturaer fra {0}", VgConnections.GetNameOfSourceClient()); btnTransferArticlesToDestination.Text = string.Format("Overfør artikkler til {0}", VgConnections.GetNameOfDestinationClient()); btnCreateCustomerOrders.Text = string.Format("Lag salgsordre i {0}", VgConnections.GetNameOfDestinationClient()); }
private void btnGetInvoicesFromSourceClient_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; _transferItems = new InvoiceQuery(VgConnections.SourceConnection).GetInvoices(_chainNo, _loanReturnNo); lstLog.Items.Add(string.Format("{0} ordre lest fra {1}", _transferItems.Count, VgConnections.GetNameOfSourceClient())); DisplayTransferItems(_transferItems); btnGetInvoicesFromSourceClient.Enabled = _transferItems.Count == 0; btnTransferArticlesToDestination.Enabled = _transferItems.Count > 0; Cursor = Cursors.Default; }