示例#1
0
        public UpdateUserControl(Product product)
        {
            this.InitializeComponent();
            Product = product;

            try
            {
                //Load Product_Images
                List <Product_Images> img    = new List <Product_Images>();
                DataTable             images = QueryForSQLServer.GetProducts_Image(Product.Id);

                foreach (DataRow item in images.Rows)
                {
                    var Product_Images = new Product_Images()
                    {
                        id        = (int)item.ItemArray[0],
                        ProductId = (int)item.ItemArray[1],
                        Name      = (string)item.ItemArray[2]
                    };
                    img.Add(Product_Images);
                }
                Product.Product_Images = img;
                lvManyImg.ItemsSource  = img;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("ex: " + ex.Message);
            }



            this.DataContext = Product;
            var categoriesList = PageHome.GetCategoriesFromDb();

            cbbListType.ItemsSource   = categoriesList;
            cbbListType.SelectedIndex = (int)product.CatId - 1;


            //back
            SystemNavigationManager manager = SystemNavigationManager.GetForCurrentView();

            manager.BackRequested += DetailPage_BackRequested;
            manager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
        }
示例#2
0
        public DetailsUserControl(Product product)
        {
            if (product != null)
            {
                this.InitializeComponent();
                this.DataContext     = product;
                pageInfo.DataContext = "1";
                objProduct           = product;
                List <Product_Images> img    = new List <Product_Images>();
                DataTable             images = QueryForSQLServer.GetProducts_Image(product.Id);



                foreach (DataRow item in images.Rows)
                {
                    var Product_Images = new Product_Images()
                    {
                        id        = (int)item.ItemArray[0],
                        ProductId = (int)item.ItemArray[1],
                        Name      = (string)item.ItemArray[2]
                    };
                    img.Add(Product_Images);
                }

                lvManyImg.ItemsSource = img;

                //back
                SystemNavigationManager manager = SystemNavigationManager.GetForCurrentView();
                manager.BackRequested += DetailPage_BackRequested;
                manager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
            else
            {
                this.Visibility = Visibility.Collapsed;
            }
        }