private void mnuDeleteMini_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SO_BatchWPF selected = (SO_BatchWPF)lvwSoBatchesMini.SelectedItem;
         _miniSize.Remove(selected);
         RefreshBatches();
     }
     catch (Exception ex)
     { }
 }
        private void btnSOBatchAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SO_BatchWPF so_wpf = new SO_BatchWPF();
                //so_wpf.Flavor = (FlavorWPF)cboFlavors.SelectedItem;
                so_wpf.Flavor     = (FlavorWPF)ddmFlavor.SelectedItem;
                so_wpf.Quantity   = int.Parse(txtBatchAdd_Qty.Text);
                so_wpf.Day_number = localSO.Day_Number;
                so_wpf.Store      = Globals.SelectedStore;
                so_wpf.IsMini     = false;

                _fullSize.Add(so_wpf);
                RefreshBatches();
            }
            catch (Exception ex)
            {
            }
        }
        public int SO_BatchTable()
        {
            int count = 0;
            // will be used to link flavor in new db entry
            List <FlavorWPF> AllFlavors = new_WCF.GetAllFlavors();

            try
            {
                // read from old db
                old_Access.Open();
                string          strCmd = @"SELECT * from SpecialOrder_Batch";
                OleDbCommand    cmd    = new OleDbCommand(strCmd, old_Access);
                OleDbDataReader rdr    = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    SO_BatchWPF itm_WPF = new SO_BatchWPF();
                    itm_WPF.So_id      = int.Parse(rdr["SO_Number"].ToString());
                    itm_WPF.Day_number = rdr["Day_Number"].ToString();

                    // using flavor name, find flavor in new db to make foreign key link
                    string    tmp  = rdr["Flavor"].ToString();
                    FlavorWPF flav = AllFlavors.Find(x => x.Name.Contains(tmp));
                    itm_WPF.Flavor = flav;

                    itm_WPF.Quantity            = int.Parse(rdr["Quantity"].ToString());
                    itm_WPF.IsMini              = rdr["Mini"].ToString() == "Yes" ? true : false;
                    itm_WPF.SpecialInstructions = rdr["Special_Instructions"].ToString();

                    new_WCF.AddSpecialOrderBatch(itm_WPF.Id, itm_WPF);
                    count++;
                }
                rdr.Close();
                old_Access.Close();
            }
            catch (Exception ex)
            {
                return(-1);
            }

            return(count);
        }