Exemple #1
0
 private void showCurrentToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex != 2)
     {
         Product currentProduct;
         if (tabControl1.SelectedIndex == 0)
         {
             currentProduct = exchange.FindProductById(new Guid(CatalogueGridView.CurrentRow.Cells[idDataGridViewTextBoxColumn2.Name].Value.ToString()));
         }
         else
         {
             currentProduct = exchange.FindProductById(new Guid(MyProductsGridView.CurrentRow.Cells[dataGridViewTextBoxColumn1.Name].Value.ToString()));
         }
         foreach (Form form in Application.OpenForms)
         {
             if (form.GetType().ToString() == "ExchangeApp.ShowProductForm")
             {
                 ShowProductForm Spf = (ShowProductForm)form;
                 if (Spf.CurrentProduct.Id == currentProduct.Id)
                 {
                     Spf.Show();
                     Spf.Activate();
                     return;
                 }
             }
         }
         User            seller = currentProduct.Seller;
         ShowProductForm spf    = new ShowProductForm(currentProduct, seller, seller.Id == currentUser.Id, this);
         spf.Show();
     }
 }
Exemple #2
0
        private void MyProductsGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Product currentProduct = exchange.FindProductById(new Guid(MyProductsGridView.CurrentRow.Cells[dataGridViewTextBoxColumn1.Name].Value.ToString()));

            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType().ToString() == "ExchangeApp.ShowProductForm")
                {
                    ShowProductForm Spf = (ShowProductForm)form;
                    if (Spf.CurrentProduct.Id == currentProduct.Id)
                    {
                        Spf.Show();
                        Spf.Activate();
                        return;
                    }
                }
            }
            User            seller = currentProduct.Seller;
            ShowProductForm spf    = new ShowProductForm(currentProduct, seller, seller.Id == currentUser.Id, this);

            spf.Show();
        }