コード例 #1
0
        public void OpenFormToEdit(DataGrid dataGrid)
        {
            Products      prod = (Products)dataGrid.SelectedItems[0];
            ProductsAdder form = new ProductsAdder();

            form.prod             = prod;
            form.productName.Text = prod.ProductName;
            if (prod.SupplierID.HasValue)
            {
                form.supplier.SelectedIndex = form.foreignSuplID.IndexOf((int)prod.SupplierID);
            }
            if (prod.CategoryID.HasValue)
            {
                form.category.SelectedIndex = form.foreignCatID.IndexOf((int)prod.CategoryID);
            }
            form.unitPrice.Text        = prod.UnitPrice.ToString();
            form.unitsInStock.Text     = prod.UnitsInStock.ToString();
            form.quantityPerUnit.Text  = prod.QuantityPerUnit;
            form.disconinued.IsChecked = prod.Discontinued;
            form.ShowDialog();
        }
コード例 #2
0
        public void OpenForm()
        {
            ProductsAdder form = new ProductsAdder();

            form.ShowDialog();
        }