// GET: Invoice public ActionResult Index(string sortOrder) { ViewBag.IdInvoiceSortParam = string.IsNullOrEmpty(sortOrder) ? "idInvoice_desc" : ""; ViewBag.IdOwnerSortParam = sortOrder == "idOwner" ? "idOwner_desc" : "idOwner"; ViewBag.EventDateSortParam = sortOrder == "eventDate" ? "eventDate_desc" : "eventDate"; var invoices = from i in invoiceRepository.GetAllInvoices() select i; switch (sortOrder) { case "idInvoice_desc": invoices = invoiceRepository.OrderByDescendingParameter("IdInvoice"); break; case "idOwner_desc": invoices = invoiceRepository.OrderByDescendingParameter("IdOwner"); break; case "idOwner": invoices = invoiceRepository.OrderByParameter("IdOwner"); break; case "eventDate_desc": invoices = invoiceRepository.OrderByDescendingParameter("EventDate"); break; case "eventDate": invoices = invoiceRepository.OrderByParameter("EventDate"); break; default: invoices = invoiceRepository.OrderByParameter("IdInvoice"); break; } return View(invoices.ToList()); }
public void TestRepository() { IInvoiceRepository _invoiceRepository = new InvoiceRepository(new InvoiceContext()); List <InvoiceDetail> _list = _invoiceRepository.GetAllInvoices().ToList(); InvoiceBusinessLayer _businessLayer = new InvoiceBusinessLayer(); List <Invoices> _list1 = _businessLayer.GetMonthlyInvoiceReportWithTax(_list); }
public ActionResult Invoicing() { ViewBag.Title = "Verwerk Nota's"; IInvoiceRepository InvRepo = new InvoiceRepository(); List <Invoice> invList = InvRepo.GetAllInvoices(); return(View(invList)); }
public void GetAllInvoices_Test() { // arrange var fakeService = A.Fake <IXmlService>(); InvoiceRepository repo = new InvoiceRepository(fakeService); // act repo.GetAllInvoices(); // assert A.CallTo(() => fakeService.ReadXml()).MustHaveHappened(); }
public MainWindow() { InitializeComponent(); IInvoiceRepository InvRepo = new InvoiceRepository(); List<Invoice> InvList = InvRepo.GetAllInvoices(); foreach (Invoice inv in InvList) { switch (inv.Status) { case "Justified": LstbToProcess.Items.Add(inv); break; case "Sent": LstbSent.Items.Add(inv); break; } } }
void CargarFacturas() { List <dynamic> facturasConDetalle = new List <dynamic>(); List <Invoice> facturas = new List <Invoice>(); List <InvoiceDetail> detalleFacturas = new List <InvoiceDetail>(); facturasConDetalle = repository.GetAllInvoicesAndDetails(); facturas = repository.GetAllInvoices().Select(x => new Invoice { id = x.id, nroinvoice = x.nroinvoice, company = x.company, customer = x.customer, datecreate = x.datecreate, }).ToList(); detalleFacturas = repository.GetAllInvoicesDetails().Select(x => new InvoiceDetail { id = x.id, idInvoice = x.idInvoice, productname = x.productname, quantity = x.quantity, unitprice = x.unitprice, subtotal = x.subtotal }).ToList(); //Agregamos detalle a la Lista foreach (var factura in facturas) { factura.InvoiceDetails.AddRange(detalleFacturas.Where(x => x.idInvoice == factura.id).ToList()); factura.ammount = factura.InvoiceDetails.Select(x => x.subtotal).Sum(); factura.nroproducts = factura.InvoiceDetails.Select(x => x.quantity).Sum(); } gvFacturas.DataSource = facturas; gvFacturas.DataBind(); gvDetalle.DataSource = null; gvDetalle.DataBind(); }