protected void AddProduct(object sender, EventArgs e)
        {
            UCProductList s = (UCProductList)sender;

            if (s.ProductsSetListView.SelectedItem != null)
            {
                ProductsSet productSelected = (ProductsSet)s.ProductsSetListView.SelectedItem;
                if (_dataDC.SaleSet.Where(S => S.Client_ID == _clientID &&
                                          S.Product_ID == productSelected.Id).Count() == 0)
                {
                    SaleListItem Item = new SaleListItem();
                    Item.Name          = productSelected.Producto + " " + productSelected.Marca + " " + productSelected.Modelo;
                    Item.ProviderPrice = productSelected.Precio;
                    Item.ClientPrice   = 0;
                    Item.Profit        = 0;
                    Item.SendEmail     = false;
                    Item.ProductID     = productSelected.Id;
                    ItemList.Add(Item);
                    addlist.ItemsSource = ItemList.ToList();
                }
                else
                {
                    MessageBox.Show("Este producto ya ha sido previamente solicitado por este cliente,vuelva a la ventana de cliente para visualizar o modificar los detalles de la solicitud anterior");
                }
            }
        }
Example #2
0
        private void lvProductRequested_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lvProductRequested.Items.Count > 0 && lvProductRequested.SelectedItem != null)
            {
                ItemRequestedProductList selectedProductitem = (ItemRequestedProductList)lvProductRequested.SelectedItem;
                ProductsSet selectedProduct = lrequestedproduct.Where(S => S.Id == selectedProductitem.ProductID).ToList()[0];

                Machine productdetails = new Machine(selectedProduct);
                productdetails._new = false;

                productdetails.ShowDialog();

                if (!productdetails.Cancel)
                {
                    _dataDC.SaveChanges();
                    UCProductList.checkNotifications(selectedProduct);
                }
            }
        }