コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int num = this.comboBox3.SelectedIndex;

            if (num != -1 && businessId != 0)
            {
                ProductDAO.RemoveProduct(products[num].id);
                resetComboBox3();
                this.comboBox2.SelectedIndex  = -1;
                this.dataGridView1.DataSource = ProductDAO.SelectFromProduct();
            }
            else
            {
                MessageBox.Show("Selecciona una opcion antes de eliminar");
            }
        }
コード例 #2
0
        public ProductsManage()
        {
            InitializeComponent();
            this.dataGridView1.DataSource = ProductDAO.SelectFromProduct();
            removeTextInit = this.label5.Text;

            business = BusinessDAO.GetList();
            var names = new object[business.Count];
            int n     = 0;

            foreach (var i in business)
            {
                names[n] = i.id + " - " + i.name;
                n++;
            }
            this.comboBox1.Items.AddRange(names);
            this.comboBox2.Items.AddRange(names);
        }