Exemple #1
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            List <string> ids = new List <string>();

            MySql sql = new MySql();

            sql.OpenConnection();

            if (Dgv.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow row in Dgv.SelectedRows)
                {
                    ids.Add(row.Cells[0].Value.ToString());
                }

                var confirmResult = MessageBox.Show("Are you sure you want to delete the " + ControlType.ToLower() + "s with following ids:\n" +
                                                    string.Join(", ", ids), "Confirm Delete", MessageBoxButtons.YesNo);

                if (confirmResult != DialogResult.Yes)
                {
                    return;
                }

                foreach (string id in ids)
                {
                    sql.ArchiveComponent(id, ControlType);
                }

                MessageBox.Show("Successfully Deleted");

                setDgv();
            }
        }
Exemple #2
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            List <string> ids = new List <string>();

            MySql sql = new MySql();

            sql.OpenConnection();

            if (UserDGV.SelectedRows.Count > 0)
            {
                foreach (DataGridViewRow row in UserDGV.SelectedRows)
                {
                    ids.Add(row.Cells[0].Value.ToString());
                }

                var confirmResult = MessageBox.Show("Are you sure you want to delete the users with the following ids:\n" +
                                                    string.Join(", ", ids), "Confirm Delete", MessageBoxButtons.YesNo);

                if (confirmResult != DialogResult.Yes)
                {
                    return;
                }
                else
                {
                    foreach (string s in ids)
                    {
                        sql.ArchiveComponent(s, "Reviewer");
                    }

                    MessageBox.Show("Successfully Deleted");

                    UpdateUserList();
                }
            }
        }