private void HandleAddSpecialOrder(object sender, DayInfoWPF.DayInfoEventArg e)
        {
            SpecialOrderWPF SO_WPF = e.SpecialOrder_WPF;

            // show SO window
            SpecialOrderWindow So_Win = new SpecialOrderWindow(SO_WPF, lck_Comm);

            So_Win.ShowDialog();
            if (So_Win.Cancel == false)
            {
                // add to Special Order table
                lck_Comm.AddSpecialOrder(SO_WPF);

                // add entry to NewOrders table
                int lastSO_id = lck_Comm.GetLastSpecialOrderID();
                if (lastSO_id != 0) // check for bad return
                {
                    NewOrderWPF no_wpf = new NewOrderWPF();
                    SO_WPF.Id          = lastSO_id;
                    no_wpf.SO          = SO_WPF;
                    no_wpf.StoreOrigin = Globals.SelectedStore;
                    no_wpf.Created     = DateTime.Now;
                    no_wpf.Fulfilled   = false;
                    lck_Comm.AddNewOrder(no_wpf);
                }
                else
                {
                    Log("Error Adding new entry to NewOrder. Check NewOrders table for 'so_id'=0");
                }
            }

            RefreshSelectedDay();
        }
        private void HandleAddDailyFlavor(object sender, DayInfoWPF.DayInfoEventArg e)
        {
            BatchWPF tmp = e.Batch_WPF;

            tmp.Store      = Globals.SelectedStore;
            tmp.Day_number = Globals.DateTime_to_DayNumber(SelectedDate);

            bool success = lck_Comm.AddBatch(tmp);

            RefreshSelectedDay();
        }
 private void HandleDayInfoClicked(object sender, DayInfoWPF.DayInfoEventArg e)
 {
     try
     {
         if (sender != null)
         {
             DayInfoWPF tmp = (DayInfoWPF)sender;
             SelectedDate = Globals.DayNumber_to_DateTime(tmp.DayNumber);
             //SelectedDay = tmp;
         }
     }
     catch (Exception ex)
     { }
 }
        private void HandleRemoveDailyFlavor(object sender, DayInfoWPF.DayInfoEventArg e)
        {
            // confirm with user then exe
            MessageBoxResult res = MessageBox.Show("Delete Flavor '" + e.Batch_WPF.Flavor.Name + "'?", "Delete Flavor?", MessageBoxButton.YesNo);

            if (res != MessageBoxResult.Yes)
            {
                return;
            }

            bool success = lck_Comm.DeleteBatch(e.Batch_WPF);

            RefreshSelectedDay();
        }
        private void HandleDeleteSpecialOrder(object sender, DayInfoWPF.DayInfoEventArg e)
        {
            SpecialOrderWPF SO_WPF = e.SpecialOrder_WPF;

            // confirm with user then exe
            MessageBoxResult res = MessageBox.Show("Delete selected Special Order?", "Delete Special Order?", MessageBoxButton.YesNo);

            if (res != MessageBoxResult.Yes)
            {
                return;
            }

            bool success = lck_Comm.DeleteSpecialOrder(SO_WPF);

            RefreshSelectedDay();
        }
        private void HandleUpdateSpecialOrder(object sender, DayInfoWPF.DayInfoEventArg e)
        {
            SpecialOrderWPF SO_WPF = e.SpecialOrder_WPF;

            SpecialOrderWindow SO_Win = new SpecialOrderWindow(SO_WPF, lck_Comm);

            SO_Win.ShowDialog();

            if (SO_Win.Cancel == false)
            {
                MessageBoxResult res = MessageBox.Show("Update selected Special Order?", "Update Special Order?", MessageBoxButton.YesNo);
                if (res != MessageBoxResult.Yes)
                {
                    return;
                }

                // update SO
                lck_Comm.UpdateSpecialOrder(SO_WPF.Id, SO_WPF);

                SO_WPF.SpecialInstructions = "--Editted--" + SO_WPF.SpecialInstructions;
                lck_Comm.UpdateSpecialOrder(SO_WPF.Id, SO_WPF);

                // add editted SO to NewOrder table
                NewOrderWPF no_wpf = new NewOrderWPF();
                no_wpf.Id = SO_WPF.Id;
                //SO_WPF.Id = lastSO_id;
                no_wpf.SO          = SO_WPF;
                no_wpf.StoreOrigin = Globals.SelectedStore;
                no_wpf.Created     = DateTime.Now;
                no_wpf.Fulfilled   = false;
                no_wpf.Editted     = true;
                lck_Comm.AddNewOrder(no_wpf);
            }

            RefreshSelectedDay();
        }
 private void HandleRefreshSpecialOrder(object sender, DayInfoWPF.DayInfoEventArg e)
 {
     RefreshSelectedDay();
 }