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 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 Initialize() { mockProduct = new Mock <IProductService>(); mockProduct.Setup(x => x.GetAllProducts()).Returns(new List <ProductDTO>() { new ProductDTO() { UPC = "123", BrandID = 1, CategoryListID = 1, Description = "Test", IsTaxable = true, HasDeposit = true, MinimumAge = 1, Name = "Test Item", MinOnHand = 0, OnHand = 1, SellingPrice = 1, StoreCost = 2, } }); mockBrand = new Mock <IBrandService>(); mockBrand.Setup(x => x.GetAllBrands()).Returns(new List <BrandDTO>() { new BrandDTO() { Id = 1, Name = "Test1" }, new BrandDTO() { Id = 2, Name = "Test2" } }); mockCategory = new Mock <ICategoryService>(); mockCategory.Setup(x => x.GetAll()).Returns(new List <CategoryDTO>() { new CategoryDTO() { Id = 1, Name = "Test Category", Description = "A test category" }, }); testProduct = new ObservableProduct(new ProductDTO { UPC = "555", BrandID = 1, CategoryListID = 1, Description = "Test", IsTaxable = true, HasDeposit = true, MinimumAge = 1, Name = "Test Item", MinOnHand = 0, OnHand = 1, SellingPrice = 1, StoreCost = 2 }); viewModel = new InventoryViewModel(mockProduct.Object, mockBrand.Object, mockCategory.Object); }
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; }
public void refresh() { lp = new ObservableProduct(_dataDC); this.DataContext = lp; ProductsSetListView.ItemsSource = lp; }
/// <summary> /// Default constructor, sets the ProductDTO represented by this TransactionItem /// </summary> /// <param name="item">the ProductDTO this object will represent</param> public TransactionItem(ProductDTO item) { Item = new ObservableProduct(item); }