Ejemplo n.º 1
0
        public void Should_convert_supplier_response_to_supplier()
        {
            var supplier =
                _supplierConverter.ConvertSupplierResponse(_middlewareData.GetSupplierData(), _session.Office);

            Assert.IsNotNull(supplier);
        }
Ejemplo n.º 2
0
        private void dataInladen_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                dataVeld.Items.Clear();
                Gegevens?.Clear();

                switch (DataComboBox.Text)
                {
                case CustomersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Customers", _customerInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld customers", _middlewareData.GetCustomerData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case SuppliersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Suppliers", _supplierInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld suppliers", _middlewareData.GetSupplierData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case ArticlesText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Articles", _articleInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld articles", _middlewareData.GetProductData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case SalesInvoicesText:
                    if (!radioButton1.Checked)
                    {
                        LogBox.AppendText("\r\nSales invoices inladen...");
                        foreach (var s in _salesInvoiceInterface.GetAll())
                        {
                            if (!dataVeld.Items.Contains(s.Header))
                            {
                                Gegevens?.Add(s.Header);
                                dataVeld.Items.Add(s.Header);
                            }
                        }

                        dataVeld.SelectedIndex = 0;
                        dataVeld.DisplayMember = "InvoiceTypeAndNumber";
                        LogBox.AppendText("\r\nSales invoices geladen");
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("InvoiceTypeAndNumber", "Voorbeeld sales invoice",
                                           _middlewareData.GetSalesInvoiceData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case BalanceSheetsText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Balance sheets", _balanceSheetInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeels balance sheets", _middlewareData.GetBalanceSheetData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case ProfitAndLossText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Profit and loss", _profitLossInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld profit and loss", _middlewareData.GetProfitAndLossData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;

                case CostCentersText:
                    if (!radioButton1.Checked)
                    {
                        _ldf.LoadDataItems("Code", "Cost centers", _costCenterInterface.GetSummaries());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Convert);
                    }
                    else
                    {
                        _ldf.LoadDataItems("Code", "Voorbeeld cost center", _middlewareData.GetCostCenterData());
                        SetFunctions(FunctionEnum.Read, FunctionEnum.Create, FunctionEnum.Delete);
                    }

                    LogBox.ScrollToCaret();
                    break;
                }

                LogBox.ScrollToCaret();
                functie.Enabled          = true;
                functieUitvoeren.Enabled = true;
                dataVeld.Enabled         = true;
                this.Cursor         = Cursors.Arrow;
                resultBar.BackColor = Color.Chartreuse;
            }
            catch (Exception ex)
            {
                this.Cursor         = Cursors.Arrow;
                resultBar.BackColor = Color.Red;
                LogBox.AppendText("\r\nDe data kan niet ingeladen worden");
                LogBox.AppendText("\r\nError: " + ex.Message);
            }
        }