private async void MethodLoadDetails()
 {
     await Task.Factory.StartNew(() =>
     {
         CollectionESGR_CartaDiaDetalle.Source = new CmpObservableCollection <ESGR_CartaDiaDetalle>(new BSGR_CartaDiaDetalle().GetCollectionCartaDiaDetalle(ESGR_CartaDia));
         Application.Current.Dispatcher.Invoke(() =>
         {
             CollectionESGR_CartaDiaDetalle.ToList().ForEach(x =>
             {
                 MethodAddDetails(x);
             });
         });
     });
 }
Example #2
0
 private async void MethodCompare(ESGR_CartaDiaDetalle ESGR_CartaDiaDetalle)
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionVMSGR_CartaDiaDetalleCategoria.ToList().ForEach(x =>
             {
                 x.CollectionVMSGR_CartaDiaDetalleSubCategoria.ToList().ForEach(Z =>
                 {
                     Z.CollectionESGR_CartaDiaDetalle.ToList().ForEach(s =>
                     {
                         if (CollectionESGR_CartaDiaDetalle.Count() > 0)
                         {
                             CollectionESGR_CartaDiaDetalle.ToList().ForEach(d =>
                             {
                                 var Firts = Z.CollectionESGR_CartaDiaDetalle.ToList().Exists(r => r.ESGR_Producto.IdProducto == ESGR_CartaDiaDetalle.ESGR_Producto.IdProducto);
                                 if (Firts)
                                 {
                                     var TempProducto = Z.CollectionESGR_CartaDiaDetalle.FirstOrDefault(f => f.ESGR_Producto.IdProducto == ESGR_CartaDiaDetalle.ESGR_Producto.IdProducto);
                                     if (TempProducto == null)
                                     {
                                         return;
                                     }
                                     TempProducto.Precio      = ESGR_CartaDiaDetalle.Precio;
                                     TempProducto.Observacion = ESGR_CartaDiaDetalle.Observacion;
                                     TempProducto.Cantidad    = ESGR_CartaDiaDetalle.Cantidad;
                                     TempProducto.CartaDia    = true;
                                 }
                             });
                         }
                         else
                         {
                             s.CartaDia = false;
                         }
                     });
                 });
             });
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }
        public VMSGR_CartaDiaDetalleSubCategoria()
        {
            UpdateIsSelectedForDatail = true;

            var LogTimer = new DispatcherTimer();

            LogTimer.Interval = TimeSpan.FromMilliseconds(250);
            LogTimer.Tick    += (s, e) =>
            {
                if (CollectionESGR_CartaDiaDetalle.ToList().Exists(x => !x.CartaDia))
                {
                    UpdateIsSelectedForDatail = false;
                    IsSelected = false;
                    UpdateIsSelectedForDatail = true;
                }
                else
                {
                    IsSelected = true;
                }
            };
            LogTimer.Start();
        }
Example #4
0
 private async void MethodLoadCartaDiaDetalle()
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_CartaDiaDetalle.Source = new BSGR_CartaDiaDetalle().GetCollectionCartaDiaDetalle(ESGR_CartaDia);
             if (CollectionESGR_CartaDiaDetalle.Count > 0)
             {
                 CollectionESGR_CartaDiaDetalle.ToList().ForEach(x => { MethodCompare(x); });
             }
             else
             {
                 MethodCompare(new ESGR_CartaDiaDetalle());
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
         }
     });
 }