Exemple #1
0
        private void UpdateRequestedProductList()
        {
            lrequestedproduct = new ObservableProduct(_dataDC);
            var q1 = from c in lrequestedproduct
                     join o in _dataDC.SaleSet on c.Id equals o.Product_ID
                     where o.Client_ID == _client.Id
                     select new ItemRequestedProductList
            {
                ProductID     = c.Id,
                Name          = c.Producto + " " + c.Marca + " " + c.Modelo,
                ClientPrice   = (int)o.PriceforClient,
                LastEmailDate = (DateTime)o.LastEmailDate,
                SaleID        = o.Id
            };

            //select new ProductsSet
            //{
            //    Id = c.Id,
            //    Producto = c.Producto,
            //    Marca = c.Marca,
            //    Modelo = c.Modelo,
            //    Año = c.Año,
            //    Potencia = c.Potencia,
            //    Peso = c.Peso,
            //    Descripcion = c.Descripcion,
            //    Precio = c.Precio,
            //    Cantidad = c.Cantidad,
            //    Enventa = c.Enventa,
            //    Enbusca = c.Enbusca,
            //    Proveedor_ID = c.Proveedor_ID
            //};
            lvProductRequested.ItemsSource = q1.ToList();
        }
        public void refresh()
        {
            lp = new ObservableProduct(_dataDC);
            this.DataContext = lp;


            ProductsSetListView.ItemsSource = lp;
        }
Exemple #3
0
 public Products()
 {
     InitializeComponent();
     _dataDC          = ModelSingleton.getDataDC;
     lpr              = new ObservableProveedor(_dataDC);
     lp               = new ObservableProduct(_dataDC);
     this.DataContext = lp;
     ProductsSetListView.ItemsSource = lp;
 }
        public UCProductList()
        {
            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                _dataDC = ModelSingleton.getDataDC;
                InitializeComponent();

                lp = new ObservableProduct(_dataDC);
                this.DataContext          = lp;
                ProductsSetListView.Width = this.Width;

                ProductsSetListView.ItemsSource = lp;
            }
        }
        private void DeleteProduct(string productID)
        {
            //Change the state to Delete
            ProductsSet product = lp.First(S => S.Id == productID);

            product.Enbusca      = "false";
            product.Enventa      = "false";
            product.Proveedor_ID = "Borrado";
            foreach (SaleSet item in _dataDC.SaleSet.Where(S => S.Product_ID == productID && S.FinalPrice == 0))
            {
                _dataDC.SaleSet.DeleteObject(item);
            }
            foreach (NotificationSet item in _dataDC.NotificationSet.Where(S => S.ProductID == productID))
            {
                _dataDC.NotificationSet.DeleteObject(item);
            }
            _dataDC.SaveChanges();
            lp = new ObservableProduct(_dataDC);
            ProductsSetListView.ItemsSource = lp;
        }