Beispiel #1
0
        private void Delete_Grant()
        {
            DataTable temp = (DataTable)Priv_dataGridView.DataSource;

            foreach (DataRow dr in temp.Rows)
            {
                string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();
                Oracle.revoke_priv(MainForm.Login_Form.conn, table_name, MainForm.username, "DELETE");
            }

            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]))
                {
                    string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();;
                    if (Convert.ToBoolean(dr["WITH GRANT OPTION"]))
                    {
                        Oracle.Grant_Delete(MainForm.Login_Form.conn, table_name, MainForm.username, true);
                    }
                    else
                    {
                        Oracle.Grant_Delete(MainForm.Login_Form.conn, table_name, MainForm.username, false);
                    }
                }
            }
        }
Beispiel #2
0
        private int Delete_Grant()
        {
            DataTable temp = (DataTable)Priv_dataGridView.DataSource;

            // CHECK XEM CÓ BẢNG NÀO THUỘC DẠNG EXCEPTION KHÔNG, NẾU CÓ BÁO ERROR (DO CHƯA CÓ CÁCH XỬ LÍ)
            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]) && dr["TABLE_NAME"].ToString() == "LUONG")
                {
                    MessageBox.Show("BANG " + dr["TABLE_NAME"].ToString().ToUpper() + "ĐÃ ĐƯỢC MÃ HÓA, KHÔNG ĐƯỢC PHÉP ADD QUYỀN SELECT QUA APP!!", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(0);
                }
            }
            MainForm.Login_Form.conn.Open();

            foreach (DataRow dr in temp.Rows)
            {
                string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();
                Oracle.revoke_priv(MainForm.Login_Form.conn, table_name, MainForm.username, "DELETE");
            }

            foreach (DataRow dr in temp.Rows)
            {
                if (Convert.ToBoolean(dr["ENABLED"]) && MainForm.is_user)
                {
                    string table_name = dr["OWNER"].ToString() + "." + dr["TABLE_NAME"].ToString();;
                    if (Convert.ToBoolean(dr["WITH GRANT OPTION"]))
                    {
                        Oracle.Grant_Delete(MainForm.Login_Form.conn, table_name, MainForm.username, true);
                    }
                    else
                    {
                        Oracle.Grant_Delete(MainForm.Login_Form.conn, table_name, MainForm.username, false);
                    }
                }
            }
            MainForm.Login_Form.conn.Close();
            return(1);
        }