VoidInvoice() public method

Voids the invoice the including removing all associated payments
public VoidInvoice ( Context context, long invoiceNumber, bool SendVoidToKitchen ) : bool
context Context The store id, station id, and cashier id the information should be restricted to.
invoiceNumber long The number of the invoice that is to be voided
SendVoidToKitchen bool
return bool
        static void TestVoidInvoice()
        {
            try
            {
                SalesAPI api = new SalesAPI();

                pcAmerica.DesktopPOS.API.Client.SalesService.Context context = new pcAmerica.DesktopPOS.API.Client.SalesService.Context();
                context.CashierID = "100101";
                context.StoreID = "1001";
                context.StationID = "01";

                Console.WriteLine("Enter an invoice number to void: ");
                string answer = Console.ReadLine();
                Console.WriteLine("Send voided invoice to the kitchen printer?" + Environment.NewLine + "1 for YES" + Environment.NewLine + "0 for NO");
                string answer2 = Console.ReadLine();

                api.VoidInvoice(context, Convert.ToInt64(answer), answer2 == "1" ? true : false );
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                Console.WriteLine("PRESS ENTER TO CONTINUE...");
                Console.ReadLine();
            }
        }
        static void testSendToKitchen()
        {
            try
            {
                SalesAPI api = new SalesAPI();

                pcAmerica.DesktopPOS.API.Client.SalesService.Context context = new pcAmerica.DesktopPOS.API.Client.SalesService.Context();
                context.CashierID = "100101";
                context.StoreID = "1001";
                context.StationID = "01";

                Random random = new Random();
                Invoice inv = api.StartNewInvoice(context, "Audry" + random.Next(0,10000) , "XXOPEN TABS");
                api.LockInvoice(context, inv.InvoiceNumber);
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 3, State = EntityState.Added, Guest = "1" });
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 3, State = EntityState.Added, Guest = "1" });
                inv.LineItems.Add(new LineItem() { Id = Guid.NewGuid(), ItemName = "TRIPPLE CHEESE BURGER", ItemNumber = "SAND4", Price = 3.99M, Quantity = 3, State = EntityState.Added, Guest = "1" });
                inv = api.ModifyItems(context, inv.InvoiceNumber, inv.LineItems);
                Console.WriteLine("Three Tripple Cheese Burgers added to invoice");

                Console.WriteLine("Needs to be sent to kitchen: {0}", inv.NeedsToBeSentToKitchen);
                DoItemsNeedToBeSentToKitchen(context, inv.InvoiceNumber);

                if (api.SendToKitchen(context, inv.InvoiceNumber))// should output items sent to kitchen
                {
                    Console.WriteLine("Items Sent To Kitchen");
                }
                else
                {
                    Console.WriteLine("Failed sending items to kitchen");
                }
                Console.WriteLine("");

                inv.LineItems[1].State = EntityState.Deleted;
                inv = api.ModifyItems(context, inv.InvoiceNumber, inv.LineItems);
                Console.WriteLine("Tripple Cheese Burger in position 1 deletd");
                Console.WriteLine("Needs to be sent to kitchen: {0}",inv.NeedsToBeSentToKitchen);
                DoItemsNeedToBeSentToKitchen(context, inv.InvoiceNumber);
                if (api.SendToKitchen(context, inv.InvoiceNumber))
                {
                    Console.WriteLine("Items Sent To Kitchen");
                }
                else
                {
                    Console.WriteLine("Failed sending items to kitchen");
                }
                Console.WriteLine("");

                Console.WriteLine("Did nothing checking for false");
                inv = api.GetInvoice(context, inv.InvoiceNumber);
                Console.WriteLine("Needs to be sent to kitchen: {0}", inv.NeedsToBeSentToKitchen);
                DoItemsNeedToBeSentToKitchen(context, inv.InvoiceNumber);
                if (api.SendToKitchen(context, inv.InvoiceNumber))
                {
                    Console.WriteLine("Items Sent To Kitchen");
                }
                else
                {
                    Console.WriteLine("Failed sending items to kitchen");
                }

                api.VoidInvoice(context, inv.InvoiceNumber, true);

            }
            catch (Exception ex)
            {

                Console.WriteLine(ex);
            }
            finally
            {
                Console.WriteLine("PRESS ENTER TO CONTINUE...");
                Console.ReadLine();
            }
        }