public void loadGrid(string like) { try { invoiceImpl = new InvoiceImpl(); dgvDatos.ItemsSource = null; dgvDatos.ItemsSource = invoiceImpl.Selectlike(like).DefaultView; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Addsubject_Click(object sender, RoutedEventArgs e) { try { if (txtamount.Text != "") { if (Convert.ToDouble(txtamount.Text) <= total) { if (idPayer == -1) { MessageBox.Show("Select some Nit Payer"); } else { double amount = Convert.ToDouble(txtamount.Text); double amountsend = Convert.ToDouble(txtamount.Text); foreach (var l in paymentlist) { if (l.Balance <= amount) { l.Paidout = l.Balance; l.Status = 2; amount = amount - l.Balance; } else { l.Paidout = amount; l.Status = 1; } } invoiceImpl = new InvoiceImpl(); invoiceImpl.InsertTransaction(paymentlist, amount, payer); } } else { MessageBox.Show("You can't pay more"); } } else { MessageBox.Show("Please don't forgot amount"); } } catch { throw; } }
private void DgvDatos_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { if (dgvDatos.Items.Count > 0 && dgvDatos.SelectedItem != null) { try { DataRowView dataRow = (DataRowView)dgvDatos.SelectedItem; int id = int.Parse(dataRow.Row.ItemArray[0].ToString()); invoiceImpl = new InvoiceImpl(); invoice = invoiceImpl.Get(id); lblnames.Content = invoice.BussinesName; lblmail.Content = invoice.IdPayer.ToString(); lblid.Text = invoice.IdInvoide.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }