public DebtorWindow(Debter Debter)
 {
     InitializeComponent();
     debterDictionary          = Debter.returnList();
     debter                    = Debter;
     DebtorInvoice.ItemsSource = debterDictionary;
 }
        private void WiredUpDebtorList(List <Invoice> debtorInvoice)
        {
            debters.Clear();
            string fullName = "";
            int    iD;
            int    debt;
            int    paid;
            int    toPay;
            string invoiceNumber;

            foreach (Invoice invoice in debtorInvoice)
            {
                paid  = Int32.Parse(invoice.Paid);
                toPay = Int32.Parse(invoice.ToPay);
                if (paid < toPay)
                {
                    debt          = toPay - paid;
                    iD            = invoice.IdSeller;
                    invoiceNumber = invoice.Number;
                    foreach (Seller seller in sellers)
                    {
                        if (invoice.IdSeller == seller.IdSeller)
                        {
                            fullName = seller.Name + " " + seller.Surname;
                        }
                    }
                    Debter debter   = new Debter(fullName, iD, debt, invoiceNumber);
                    bool   isInList = false;
                    foreach (Debter debter1 in debters)
                    {
                        if (debter1.FullName.Equals(debter.FullName))
                        {
                            isInList = true;
                            debter   = debter1;
                        }
                    }
                    if (isInList)
                    {
                        debter.AddDebts(debt);
                        debters.Remove(debter);
                    }
                    debter.AddToInvoiceDictionary(invoiceNumber, debt);
                    debters.Add(debter);
                }
            }
        }
Exemple #3
0
 public AddDebterViewModel(Debter debter)
 {
     Debter = debter;
 }
Exemple #4
0
 public AddDebtViewModel(Debter debter)
 {
     Debts  = new ObservableCollection <Debt>(debter.DebtList);
     Debter = debter;
 }