Beispiel #1
0
        private void ApplyQuery(int mode)
        {
            if (SelectedBroker.id != 3)
            {
                List <DebtorReport> debtorReport = new List <DebtorReport>();
                string[]            clientBins   = new string[] { };

                if (mode == 0)
                {
                    clientBins = DataBaseClient.GetSuppliersBins(SelectedBroker.id);
                }

                try {
                    if (mode == 0)
                    {
                        debtorReport = _1CTransport.GetDebtors(SelectedBroker.id == 4 ? 3 : SelectedBroker.id, StartDate, EndDate, clientBins);
                    }
                    else
                    {
                        debtorReport = _1CTransport.GetDebtors(SelectedBroker.id == 4 ? 3 : SelectedBroker.id, StartDate, EndDate, SelectedSupplier.companyBin);
                    }
                } catch (Exception) { }

                FullDebt = "0";

                // Fill from database
                foreach (var item in debtorReport)
                {
                    try {
                        item.clientName = DataBaseClient.GetCompanyName(item.clientBIN);
                        FullDebt        = (Convert.ToDecimal(FullDebt) + item.debit).ToString();
                    } catch (Exception) { }
                }

                DebtorsList = debtorReport.OrderByDescending(d => d.result).ToList();
            }
            else
            {
                MessagesService.Show("Оповещение", "По этому брокеру 1С недоступна");
            }
        }