public static void SerializeNow(Invoice inv)
        {
            //setup a memory stream object that is needed
            //to hold the obj in memory during the
            //format and transformation process
            MemoryStream myStream = new MemoryStream();

            //setup the binary formatting obj that
            //performs the format process
            BinaryFormatter myFormat = new BinaryFormatter();

            //we call the serailize method, passing the
            //stream so we know where to save and obj it
            //will transform
            myFormat.Serialize(myStream, inv);

            //now that the obj is serialized, covert to
            //Base64 for encoding and easy storage
            string serializedValue = Convert.ToBase64String(myStream.ToArray());

            //call the Insert method of the DA class
            DataAdapter.Insert(serializedValue);

            //close the stream
            myStream.Close();
        }
 private void btnLoadInvoice_Click(object sender, EventArgs e)
 {
     lstBxInvoices.Items.Clear();
     invoices = DataAdapter.Get();
     foreach (Invoice inv in invoices)
     {
         lstBxInvoices.Items.Add(inv);
     }
 }
 private void btnStoreInvoice_Click(object sender, EventArgs e)
 {
     DataAdapter.ClearDB();
     foreach (Invoice inv in invoices)
     {
         Serializer.SerializeNow(inv);
     }
     lstBxInvoices.Items.Clear();
     btnStoreInvoice.Enabled    = false;
     btnPrintInvoice.Enabled    = false;
     btnDeleteInvoice.Enabled   = false;
     btnUnselectInvoice.Enabled = false;
     //invoices = new ArrayList();
 }
 private void FormList_Load(object sender, EventArgs e)
 {
     btnDeleteInvoice.Enabled      = false;
     btnDeletePackage.Enabled      = false;
     btnUnselectInvoice.Enabled    = false;
     btnUnselectPackage.Enabled    = false;
     btnPrintInvoice.Enabled       = false;
     btnPrintShippingLabel.Enabled = false;
     btnStoreInvoice.Enabled       = false;
     btnCreateInvoice.Enabled      = false;
     // Load the invoices from db onload
     invoices = DataAdapter.Get();
     foreach (Invoice inv in invoices)
     {
         lstBxInvoices.Items.Add(inv);
     }
 }