private void Import_Bill(object sender, RoutedEventArgs e) { if (_DBConnection.BillTemplates.ContainsKey(Bill.Category)) { DBConnection.Bill ImportedBill = (from item in _DBConnection.Bills where item.Category == Bill.Category select item).FirstOrDefault <DBConnection.Bill>(); DataContext = null; Bill.Payer = ImportedBill.Payer.ToString(); Bill.Category = ImportedBill.Category; Bill.Recipient = ImportedBill.Recipient; Bill.Currency = ImportedBill.Currency; Bill.Amount = Convert.ToDouble(ImportedBill.Amount); Bill.IBANOfRecipient = ImportedBill.IBANOfRecipient; Bill.Model = ImportedBill.Model; Bill.ReferenceNumber = ImportedBill.ReferenceNumber; Bill.Description = ImportedBill.Description; Bill.DueDate = ImportedBill.DueDate; Bill.ForMonth = ImportedBill.ForMonth; DataContext = Bill; } else { MessageBoxResult error = MessageBox.Show("No similar data based on given [Category] found to be imported.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public Bill_Creation(DBConnection _DBConnection) { this._DBConnection = _DBConnection; InitializeComponent(); Bill = new DBConnection.Bill(); Bill_Template BT = new Bill_Template(_DBConnection); BT.ShowDialog(); if (BT.Key != null) { if (BT.Key != "New") { Bill.Payer = _DBConnection.BillTemplates[BT.Key].Payer; Bill.Category = _DBConnection.BillTemplates[BT.Key].Category; Bill.Recipient = _DBConnection.BillTemplates[BT.Key].Recipient; Bill.Currency = _DBConnection.BillTemplates[BT.Key].Currency; Bill.IBANOfRecipient = _DBConnection.BillTemplates[BT.Key].IBANOfRecipient; Bill.Model = _DBConnection.BillTemplates[BT.Key].Model; } } DataContext = Bill; }
public Payment(DBConnection _DBConnection, DBConnection.Bill Bill) { this._DBConnection = _DBConnection; InitializeComponent(); BillPaymentInformation = new ObservableCollection <DBConnection.BillPayment>(_DBConnection.DB_GetPaymentsForBill(Bill.Id)); DataContext = this; TXT_TotalAmount.Text = Bill.amount; }
public MemberPayment(DBConnection _DBConnection, DBConnection.Bill Bill, DBConnection.Member Member) { MemberId = Member.Id; Name = Member.GetName(); PaymentAmount = 0; PaidAmount = _DBConnection.DB_GetMonthlyPaymentAmount(Member, Bill.DueDateMonth, Bill.DueDateYear); }
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!BillMenuOpened) { ListBox list = (ListBox)sender; if (list.SelectedIndex > -1) { BillMenuOpened = true; DBConnection.Bill BillItem = (DBConnection.Bill)list.SelectedItem; Bill_Overview BO = new Bill_Overview(_DBConnection, BillItem); BO.Owner = this; BO.ShowDialog(); switch (BO.HasChanges) { case BillCloseOption.Cancel: break; case BillCloseOption.Delete: Bills.Remove(BillItem); _DBConnection.DB_RemoveBill(BillItem.Id); RefreshBillListItems(); CalculateReviews(); _DBConnection.RefreshTemplates(); break; case BillCloseOption.Save: _DBConnection.DB_UpdateBill(BO.Bill); for (int i = 0; i < Bills.Count; i++) { if (Bills[i] == BillItem) { Bills[i] = BO.Bill; break; } } RefreshBillListItems(); CalculateReviews(); _DBConnection.RefreshTemplates(); break; } list.SelectedIndex = -1; } } else { BillMenuOpened = !BillMenuOpened; } }
private void UpdateBillPointer(DBConnection.Bill vBill) { Bill.Id = vBill.Id; Bill.Payer = vBill.Payer; Bill.Category = vBill.Category; Bill.Recipient = vBill.Recipient; Bill.Currency = vBill.Currency; Bill.Amount = vBill.Amount; Bill.IBANOfRecipient = vBill.IBANOfRecipient; Bill.Model = vBill.Model; Bill.ReferenceNumber = vBill.ReferenceNumber; Bill.Description = vBill.Description; Bill.DueDate = vBill.DueDate; Bill.ForMonth = vBill.ForMonth; Bill.Paid = vBill.Paid; Bill.DatePaid = vBill.DatePaid; }
public Bill_Overview(DBConnection _DBConnection, DBConnection.Bill bill) { this._DBConnection = _DBConnection; InitializeComponent(); if (bill.Id == 0) { bill.Id = _DBConnection.UpdateId(bill.GUID); } if (String.IsNullOrWhiteSpace(bill.GUID)) { _DBConnection.CreateGUID(bill); } Bill = bill; vBill = CreateBillEnvironment(); DataContext = vBill; CheckViews(); }
private DBConnection.Bill CreateBillEnvironment() { DBConnection.Bill vBill = new DBConnection.Bill() { Id = Bill.Id, GUID = Bill.GUID, Payer = Bill.Payer, Category = Bill.Category, Recipient = Bill.Recipient, Currency = Bill.Currency, Amount = Bill.Amount, IBANOfRecipient = Bill.IBANOfRecipient, Model = Bill.Model, ReferenceNumber = Bill.ReferenceNumber, Description = Bill.Description, DueDate = Bill.DueDate, ForMonth = Bill.ForMonth, Paid = Bill.Paid, DatePaid = Bill.DatePaid }; return(vBill); }