private void dockP_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (dockP.SelectedIndex > -1)
     {
         timer.Stop();
         timer2.Stop();
         _initiated = true;
         var bc    = new BrushConverter();
         int index = dockP.SelectedIndex;
         var card  = new CardItemOrd();
         card = (CardItemOrd)dockP.SelectedValue;
         if (card.backGrdMyGrid == Brushes.LimeGreen)
         {
             SalesFirst.tableN   = card.Nombre;
             SalesFirst.ordrDone = true;
             dockP.Items.RemoveAt(index);
         }
         else
         {
             SalesFirst.tableN   = card.Nombre;
             SalesFirst.ordrDone = true;
             dockP.Items.RemoveAt(index);
             card.backGrdMyGrid = Brushes.LimeGreen;
             card.backFgrdO     = (Brush)bc.ConvertFrom("#000000");
             card.backFgrdC2    = (Brush)bc.ConvertFrom("#000000");
             card.backFgrdC1    = (Brush)bc.ConvertFrom("#000000");
             dockP.Items.Insert(index, card);
         }
         timer.Start();
         timer2.Start();
     }
 }
示例#2
0
 private void BtnInic_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         bool             isBusyTable;
         MessageBoxResult boxResult;
         string           ordenStr = SendToProduction();
         int tableid     = Convert.ToInt32(CboListBox.SelectedValue.ToString());
         var itemProduct = new List <Pending_Orders>();
         itemProduct = SaveOrdrTemp();
         var setIdTable = new Busy_tables
         {
             Table_busy = tableid
         };
         isBusyTable = OrderBL.GetInstance().VerifyTable(setIdTable);
         if (isBusyTable)
         {
             boxResult = MessageBoxRM.Show("Esta mesa está ocupada, desea agregar otro producto a esta mesa?", "Mesa ocupada", MessageBoxButtonRM.YesNo, MessageBoxIconRM.Question);
             if (boxResult == MessageBoxResult.OK)
             {
                 OrderBL.GetInstance().RegisterPendingOrdr2(itemProduct);
                 var card = new CardItemOrd();
                 card.Nombre = $"Mesa #{tableid}";
                 card.Orden  = ordenStr;
                 GetOrdens   = card;
                 sendOrder   = true;
                 if (NtfIcon.Visibility == Visibility.Hidden)
                 {
                     NtfIcon.Visibility = Visibility.Visible;
                 }
                 NtfIcon.Badge = OrderBL.GetInstance().NofPOrder();
                 DtGridOrden.Items.Clear();
                 CalculateTotal();
             }
         }
         else
         {
             OrderBL.GetInstance().RegisterPendingOrdr(setIdTable, itemProduct);
             //MessageBoxRM.Show(ordenStr);
             var card = new CardItemOrd();
             card.Nombre = $"Mesa #{tableid}";
             card.Orden  = ordenStr;
             GetOrdens   = card;
             sendOrder   = true;
             if (NtfIcon.Visibility == Visibility.Hidden)
             {
                 NtfIcon.Visibility = Visibility.Visible;
             }
             NtfIcon.Badge = OrderBL.GetInstance().NofPOrder();
             DtGridOrden.Items.Clear();
             CalculateTotal();
         }
     }
     catch (Exception ex)
     {
         MessageBoxRM.Show(ex.Message, "Error al iniciar orden", MessageBoxButtonRM.OK, MessageBoxIconRM.Error);
     }
 }
        private void Timer_Tick(object sender, EventArgs e)
        {
            _initiated = true;
            switch (count1)
            {
            case 1:
                count1 = 0;
                break;

            case 0:
                count1 = 1;
                break;

            default:
                break;
            }
            if (count1 == 1)
            {
                for (int i = 0; i < dockP.Items.Count; i++)
                {
                    var bc    = new BrushConverter();
                    int index = dockP.SelectedIndex;
                    var card  = new CardItemOrd();
                    card = (CardItemOrd)dockP.Items[i];

                    if (card.backGrdMyGrid != Brushes.LimeGreen)
                    {
                        dockP.Items.RemoveAt(i);
                        card.backGrdMyGrid = Brushes.Orange;
                        dockP.Items.Insert(i, card);
                    }
                }
            }
            else
            {
                for (int i = 0; i < dockP.Items.Count; i++)
                {
                    var bc    = new BrushConverter();
                    int index = dockP.SelectedIndex;
                    var card  = new CardItemOrd();
                    card = (CardItemOrd)dockP.Items[i];

                    if (card.backGrdMyGrid != Brushes.LimeGreen)
                    {
                        dockP.Items.RemoveAt(i);
                        card.backGrdMyGrid = Brushes.Gray;
                        dockP.Items.Insert(i, card);
                    }
                }
            }
        }
        private void Timer3_Tick(object sender, EventArgs e)
        {
            if (SalesFirst.sendOrder == true)
            {
                var Ordens = new CardItemOrd();
                Ordens = SalesFirst.GetOrdens;
                var itemLbx = (ListBoxItem)dockP.ItemContainerGenerator.ContainerFromItem(Ordens);
                dockP.Items.Add(Ordens);

                int index = dockP.Items.Count;
                //index--;
                //itemLbx = (ListBoxItem)dockP.Items[index];
                //MessageBox.Show(itemLbx.Height.ToString());
                if (_initiated == false)
                {
                    timer.Start();
                }
                SalesFirst.sendOrder = false;
            }
        }
 private void Timer2_Tick(object sender, EventArgs e)
 {
     _initiated = true;
     if (count2 == 30)
     {
         count2 = 0;
         for (int i = 0; i < dockP.Items.Count; i++)
         {
             var bc   = new BrushConverter();
             var card = new CardItemOrd();
             card = (CardItemOrd)dockP.Items[i];
             if (card.backGrdMyGrid == Brushes.LimeGreen)
             {
                 SalesFirst.tableN   = card.Nombre;
                 SalesFirst.ordrDone = true;
                 dockP.Items.RemoveAt(i);
                 timer2.Stop();
             }
         }
     }
     count2++;
 }