コード例 #1
0
        private void btnDeny_Click(object sender, EventArgs e)
        {
            BLAdmin bl = new BLAdmin();

            if (gridRequests.SelectedRows[0] != null)
            {
                DialogResult res = MessageBox.Show("Respingerea cererii implica stergerea totala a acesteia din baza de date.\nContinuati?", "Respingere", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (res == DialogResult.Yes)
                {
                    DataGridViewRow row = gridRequests.SelectedRows[0];
                    bl.DenyRequest(Convert.ToInt32(row.Cells["ExternalId"].Value), Convert.ToInt32(row.Cells["StudentId"].Value));
                    MessageBox.Show("Cererea a fost respinsa!", "Succes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DataTable requestsTable = bl.GetRequests();
                    gridRequests.DataSource = requestsTable;
                }
                else
                {
                    return;
                }
            }
            else
            {
                MessageBox.Show("Alegeti cererea pe care doriti sa o respingeti!", "Atentie", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }