예제 #1
0
        /// <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);
        }
예제 #2
0
        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());
        }
예제 #3
0
            public static Task Handle(InvoiceCreated message, IDocumentSession session)
            {
                var invoice = new Invoice {
                    Id = message.InvoiceId
                };

                session.Store(invoice);

                return(session.SaveChangesAsync());
            }
예제 #4
0
        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
            });
        }
예제 #5
0
        public EventHistoryItem Visit(InvoiceCreated evt)
        {
            evt.Apply(_Invoice);

            var historyItem = CreateEventHistoryItem(evt);

            historyItem.Message = "Invoice created";

            return(historyItem);
        }
예제 #6
0
        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));
        }
예제 #7
0
 private void _viewModel_InvoiceSaved(object sender, InvoiceEventArgs e)
 {
     InvoiceCreated.SafeRaise(sender, e);
 }
예제 #8
0
 public void When(InvoiceCreated invoiceCreated)
 {
     InvoiceId = invoiceCreated.InvoiceId;
 }
 public void invoice_created_should_not_be_null()
 {
     InvoiceCreated.Should().NotBeNull();
 }
예제 #10
0
 public void Handle(InvoiceCreated created)
 {
     // handle the invoice created message
 }