示例#1
0
文件: Users.cs 项目: Lara87/gradebook
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                //del
                if (MessageBox.Show("Вы действительно хотите удалить запись?", "Внимание", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    using (SqlConnection sqlConnection = new SqlConnection(url))
                    {
                        sqlConnection.Open();
                        var           rowIndex = e.RowIndex;
                        var           cell     = dataGridView1.Rows[rowIndex].Cells[2].Value;
                        var           com1     = new SqlCommand("DELETE FROM Table_User WHERE [Id_Role] = '" + cell + "' ", sqlConnection);
                        SqlDataReader sqldr    = com1.ExecuteReader();
                        dataGridView1.Rows.RemoveAt(rowIndex);
                    }
                    MessageBox.Show("Данные успешно удалены!", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            if (e.ColumnIndex == 1)
            {
                //edit
                UsersInfo usersInfo = new UsersInfo(userList[e.RowIndex], false, this);
                usersInfo.Show();
            }
        }
示例#2
0
        //Users Info
        private void UsersInfo_Click(object sender, EventArgs e)
        {
            UsersInfo myForm = new UsersInfo();

            this.Hide();
            myForm.ShowDialog();
            this.Close();
        }
示例#3
0
文件: Users.cs 项目: Lara87/gradebook
        private void button1Add_Click(object sender, EventArgs e)
        {
            UsersInfo usersInfo = new UsersInfo(null, true, this);

            usersInfo.Show();
        }