示例#1
0
        public void SearchFunc(object parameter)
        {
            if (parameter != null)
            {
                SearchText = parameter.ToString();
            }

            SearchedProductTypes = string.IsNullOrEmpty(SearchText) ?
                                   ProductTypes :
                                   ProductTypes.Where(p => p.BarCode.ToLower().Contains(SearchText.ToLower()) || p.Name.ToLower().Contains(SearchText.ToLower()));
        }
        protected override async Task OnShellNavigated(string sender, ShellNavigatedEventArgs args)
        {
            await base.OnShellNavigated(sender, args);

            if (!IsAddProduct)
            {
                HeaderText = "Edit Product";

                SelectedProductType     = ProductTypes.Where(l => l.ProductTypeId.Equals(Product.ProductTypeId)).FirstOrDefault();
                ProductCategories       = App.MasterData.ProductCategoryList.Where(l => l.ProductTypeId.Equals(Product.ProductTypeId)).ToList();
                SelectedProductCategory = ProductCategories.Where(l => l.ProductCategoryId.Equals(Product.ProductCategoryId)).FirstOrDefault();
            }
            else
            {
                HeaderText = "Add Product";
                //SelectedProductCategory = null;
                //SelectedProductType = ProductTypes[0];
                //ProductCategories = null;
            }

            /*if(Product != null)
             * {
             *  ProductTypes.DefaultItem = ProductTypes.ControlValues.Where(x => x.ItemId.Equals(Product.ProductTypeId)).FirstOrDefault();
             *  //if(!string.IsNullOrEmpty(Product.ProductNameId))
             *  //{
             *  //    DefaultProductName = ProductNames.Where(l => l.ParentId.Equals(Product.ProductTypeId)).FirstOrDefault();
             *
             *  //}
             *  //DefaultProductName.SelectedIndex =
             * }
             * else if(ProductTypes == null)
             * {
             *  var productItems = InitializeProduct();
             *  ProductTypes = productItems.Item1;
             *  ProductNames = productItems.Item2;
             *  Product = productItems.Item3;
             *  DefaultProductName = productItems.Item2[0];
             * }*/

            //ProductCategories = App.MasterData.ProductCategoryList.Where(l => l.ProductTypeId.Equals(ProductTypes[0].ProductTypeId)).ToList();
        }