Exemple #1
0
        private void btnInsertArticle_Click(object sender, EventArgs e)
        {
            InsertArticle form = new InsertArticle();

            form.ShowDialog();
            form.BringToFront();
            this.refreshDGV("article");
        }
Exemple #2
0
        private void datagridviews_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = (DataGridView)sender;
            string       id  = dgv.SelectedRows[0].Cells[0].Value.ToString();

            if (dgv.Name == "dgvArticleType")
            {
                if (e.ColumnIndex == 2)
                {
                    InsertArticleType form = new InsertArticleType(id);
                    form.ShowDialog();
                    form.BringToFront();
                    this.refreshDGV("type_article");
                }
                else if (e.ColumnIndex == 3)
                {
                    TypeArticle type = new TypeArticle();
                    type.get(id);
                    type.delete();
                    this.refreshDGV("type_article");
                }
            }
            else if (dgv.Name == "dgvArticle")
            {
                if (e.ColumnIndex == 3)
                {
                    InsertArticle form = new InsertArticle(id);
                    form.ShowDialog();
                    form.BringToFront();
                    this.refreshDGV("article");
                }
                else if (e.ColumnIndex == 4)
                {
                    Article article = new Article();
                    article.get(id);
                    article.delete();
                    this.refreshDGV("article");
                }
            }
            else if (dgv.Name == "dgvLoans")
            {
                if (e.ColumnIndex == 7)
                {
                    InsertLoan form = new InsertLoan(id);
                    form.ShowDialog();
                    form.BringToFront();
                    this.refreshDGV("loans");
                }
                else if (e.ColumnIndex == 8)
                {
                    Loan loan = new Loan();
                    loan.get(id);
                    loan.delete();
                    this.refreshDGV("loans");
                }
            }
            else if (dgv.Name == "dgvClients")
            {
                if (e.ColumnIndex == 6)
                {
                    InsertClient form = new InsertClient(id);
                    form.ShowDialog();
                    form.BringToFront();
                    this.refreshDGV("client");
                }
                else if (e.ColumnIndex == 7)
                {
                    Client client = new Client();
                    client.get(id);
                    client.delete();
                    this.refreshDGV("client");
                }
            }
        }