/// <summary> /// Pull all the invoiced records from DB. /// </summary> /// <param name="invoicedto"></param> /// <returns></returns> internal Invoicedto LoadInvoiced(Invoicedto invoicedto) { List <InvoiceCreated> invoiceCreatedList = new List <InvoiceCreated>(); using (SqlConnection sqlConnection = new SqlConnection(invoicedto.ConnectionString)) { string oString = string.Format("select * from TimeActivity where RealmId='{0}' and Invoice_QboId is not null", invoicedto.CompanyId); SqlCommand oCmd = new SqlCommand(oString, sqlConnection); sqlConnection.Open(); using (SqlDataReader oReader = oCmd.ExecuteReader()) { while (oReader.Read()) { InvoiceCreated nvoiceCreated = new InvoiceCreated(); nvoiceCreated.Employee = oReader["Employee"].ToString(); nvoiceCreated.Customer = oReader["Customer"].ToString(); nvoiceCreated.Item = oReader["Item"].ToString(); nvoiceCreated.Date = Convert.ToDateTime(oReader["Date"].ToString()).ToShortDateString(); nvoiceCreated.Hours = oReader["Hours"].ToString(); nvoiceCreated.QboId = oReader["Invoice_QboId"].ToString(); invoiceCreatedList.Add(nvoiceCreated); } sqlConnection.Close(); } } if (invoicedto.InvoiceCreated == null) { invoicedto.InvoiceCreated = new List <InvoiceCreated>(); } invoicedto.InvoiceStatus = "Invoiced"; invoicedto.InvoiceListLength = invoiceCreatedList.Count; invoicedto.InvoiceCreated = invoiceCreatedList; return(invoicedto); }
public void InvoiceCreatedTest() { var invoiceCreated = new InvoiceCreated(); invoiceCreated.AddWatchProperty(p => p.Payment, p => p.Id); var tracker = new Tracker <Invoice>(); Assert.AreEqual(0, tracker.GetObservers().Count); tracker.Subscribe(invoiceCreated); Assert.AreEqual(1, tracker.GetObservers().Count); AssertNotificationsCreated(tracker, 0); var invoice11 = new Invoice { Id = 11, Cancelled = false, Payment = 1000.0 }; tracker.AddOrUpdate(new Invoice { Id = 11, Cancelled = false, Payment = 2000.0 }); tracker.AddOrUpdate(invoice11); AssertNotificationsCreated(tracker, 1); Assert.AreEqual(invoice11, tracker.GetObservers().First(o => o.GetType() == typeof(InvoiceCreated)).Notifications.First().Values.First()); }
public static Task Handle(InvoiceCreated message, IDocumentSession session) { var invoice = new Invoice { Id = message.InvoiceId }; session.Store(invoice); return(session.SaveChangesAsync()); }
public async Task Handle(InvoiceCreated message, IMessageHandlerContext context) { Console.WriteLine($"\t[{Data.BillingRunId}] Invoice was created."); Data.InvoiceId = message.InvoiceId; await context.Send(new SubmitInvoiceToNavisionRequest() { InvoiceId = message.InvoiceId }); }
public EventHistoryItem Visit(InvoiceCreated evt) { evt.Apply(_Invoice); var historyItem = CreateEventHistoryItem(evt); historyItem.Message = "Invoice created"; return(historyItem); }
public Task Handle(ApartmentsReserved message, IMessageHandlerContext context) { _logger.Info($"ApartmentsReserved message recived, apartments id: {message.ApartmentsId}, reservation id: {message.ReservationId}"); var @event = new InvoiceCreated(); @event.InvoiceId = invoiceCounter; @event.ReservationId = message.ReservationId; _logger.Info($"InvoiceCreated event publishing, reservation id: {message.ReservationId}, apartments id: {message.ApartmentsId}, invoice id: {@event.InvoiceId}"); invoiceCounter++; return(context.Publish(@event)); }
private void _viewModel_InvoiceSaved(object sender, InvoiceEventArgs e) { InvoiceCreated.SafeRaise(sender, e); }
public void When(InvoiceCreated invoiceCreated) { InvoiceId = invoiceCreated.InvoiceId; }
public void invoice_created_should_not_be_null() { InvoiceCreated.Should().NotBeNull(); }
public void Handle(InvoiceCreated created) { // handle the invoice created message }