private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            int foo;
             int.TryParse( NavigationContext.QueryString["id1"],out foo);
             ıdvalue = foo;


             TProduct proc1=new TProduct();
                foreach (TProduct procxx in App.View.DBShop.Products)
                {
                    if (procxx.ProductId == ıdvalue)
                        proc1 = procxx;

                }
                nameTxt.Text = proc1.ProductName;
                priceTxt.Text = proc1.Price.ToString();
                storeTxt.Text = proc1.ProductStore;
        }
        private void appBarOkButton_Click(object sender, EventArgs e)
        {

            
                TProduct proc=new TProduct();
                foreach (TProduct procxx in App.View.DBShop.Products)
                {
                    if (procxx.ProductId == ıdvalue)
                        proc = procxx;

                }
                if (textBox1.Text.Length > 0)
                {
                    try
                    {
                        proc.Price = Convert.ToDecimal(textBox1.Text);     
                    }
                    catch
                    {
                        MessageBox.Show("Invalid price,please enter a number!");
                    }
                                 
                }

                if (textBox2.Text.Length > 0)
                {
                    proc.ProductStore = textBox2.Text;
                }
                if (checkBox1.IsChecked == true)
                proc.IsChance = true;
           

            App.View.DBShop.SubmitChanges();
            // Return to the main page.
            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
        }
        private void appBarOkButton_Click(object sender, EventArgs e)
        {
            if (addnewproductTextBox.Text.Length > 0)
            {

                // Create a new shop product.
                TProduct newProductItem = new TProduct
                {
                    ProductName = addnewproductTextBox.Text,
                    _PListId = ListID,
                };

                // Add the shop product to the View.
                App.View.AddProduct(newProductItem);

                // Return to the main page.
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
        }
        public void DeleteProduct(TProduct ProductsDelete)
        {

            AllProductItems.Remove(ProductsDelete);

            DBShop.Products.DeleteOnSubmit(ProductsDelete);

            DBShop.SubmitChanges();
        }
        public void AddProduct(TProduct newProduct)
        {
            DBShop.Products.InsertOnSubmit(newProduct);

            DBShop.SubmitChanges();

            AllProductItems.Add(newProduct);

        }
 // Called during a remove operation
 private void detach_Mshop(TProduct Mshopx)
 {
     NotifyPropertyChanging("TProducts");
     Mshopx.TListx = null;
 }
 // Called during an add operation
 private void attach_Mshop(TProduct Mshopx)
 {
     NotifyPropertyChanging("TProduct");
     Mshopx.TListx = this;
 }