示例#1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     BLL.Quyen_BLL quyenBLL = new BLL.Quyen_BLL();
     foreach (quyen item in listQuyen)
     {
         quyenBLL.removeQuyenHT(item.name, role);
     }
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
         bool chk   = (bool)row.Cells[1].Value;
         bool grant = (bool)row.Cells[2].Value;
         if (chk)
         {
             quyen quyen;
             if (grant)
             {
                 quyen = new quyen(row.Cells[0].Value.ToString(), "1");
             }
             else
             {
                 quyen = new quyen(row.Cells[0].Value.ToString(), "-1");
             }
             quyens.Add(quyen);
         }
     }
     foreach (quyen item in quyens)
     {
         quyenBLL.updateHT(role, item.name, item.grant);
     }
     MessageBox.Show("Thanh Cong");
 }
示例#2
0
        private void cbTable_SelectedIndexChanged(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            BLL.Quyen_BLL quyen_BLL        = new BLL.Quyen_BLL();
            DataTable     quyenRoleOnTable = quyen_BLL.getQuyenTable(username);
            DataTable     quyenTable       = quyen_BLL.getByType2();

            foreach (DataRow row in quyenTable.Rows)
            {
                bool select = false;
                bool grant  = false;
                foreach (DataRow row1 in quyenRoleOnTable.Rows)
                {
                    if (row1.ItemArray[0].ToString().ToUpper().Equals(cbTable.SelectedItem.ToString().ToUpper()))
                    {
                        if (row.ItemArray[0].ToString().ToUpper().Equals(row1.ItemArray[1].ToString().ToUpper()))
                        {
                            select = true;
                            if (row1.ItemArray[2].ToString().Equals("YES"))
                            {
                                grant = true;
                            }
                        }
                    }
                }
                dataGridView1.Rows.Add(row.ItemArray[0].ToString(), select, grant);
            }
        }
示例#3
0
        private void Quyen_Table_Load(object sender, EventArgs e)
        {
            DataGridViewTextBoxColumn dgvName = new DataGridViewTextBoxColumn();

            dgvName.HeaderText = "Name";
            DataGridViewCheckBoxColumn dgvSelect = new DataGridViewCheckBoxColumn();

            dgvSelect.HeaderText = "Select";
            DataGridViewCheckBoxColumn dgvGrant = new DataGridViewCheckBoxColumn();

            dgvGrant.HeaderText = "Grant";
            dataGridView1.Columns.Add(dgvName);
            dataGridView1.Columns.Add(dgvSelect);
            dataGridView1.Columns.Add(dgvGrant);
            BLL.Quyen_BLL quyen_BLL  = new BLL.Quyen_BLL();
            DataTable     quyenTable = quyen_BLL.getByType2();

            foreach (DataRow row in quyenTable.Rows)
            {
                dataGridView1.Rows.Add(row.ItemArray[0].ToString(), false, false);
            }
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.AllowUserToAddRows  = false;
            DataTable table = quyen_BLL.getTable();

            foreach (DataRow row in table.Rows)
            {
                cbTable.Items.Add(row.ItemArray[0].ToString());
            }
            cbTable.SelectedIndex = 0;
        }
示例#4
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     BLL.Quyen_BLL quyenBLL = new BLL.Quyen_BLL();
     quyenBLL.removeQuyenTable(cbTable.SelectedItem.ToString(), username);
     foreach (DataGridViewRow row in dataGridView1.Rows)
     {
         bool chk = (bool)row.Cells[1].Value;
         if (chk)
         {
             quyen quyen;
             quyen = new quyen(row.Cells[0].Value.ToString(), "-1");
             quyens.Add(quyen);
         }
     }
     foreach (quyen item in quyens)
     {
         quyenBLL.updateTable(username, item.name, item.grant, cbTable.SelectedItem.ToString());
     }
     MessageBox.Show("Thanh Cong");
 }
示例#5
0
文件: QUYEN_HT.cs 项目: radtek/BMCSDL
        private void QUYEN_HT_Load(object sender, EventArgs e)
        {
            DataGridViewTextBoxColumn dgvName = new DataGridViewTextBoxColumn();

            dgvName.HeaderText = "Name";
            DataGridViewCheckBoxColumn dgvSelect = new DataGridViewCheckBoxColumn();

            dgvSelect.HeaderText = "Select";
            DataGridViewCheckBoxColumn dgvGrant = new DataGridViewCheckBoxColumn();

            dgvGrant.HeaderText = "Grant";
            dataGridView1.Columns.Add(dgvName);
            dataGridView1.Columns.Add(dgvSelect);
            dataGridView1.Columns.Add(dgvGrant);
            BLL.Quyen_BLL quyen_BLL  = new BLL.Quyen_BLL();
            DataTable     role_quyen = quyen_BLL.getQuyenHT(role);
            DataTable     quyenTable = quyen_BLL.getByType1();

            foreach (DataRow row in quyenTable.Rows)
            {
                bool select = false;
                bool grant  = false;
                foreach (DataRow row1 in role_quyen.Rows)
                {
                    if (row.ItemArray[0].ToString().ToUpper().Equals(row1.ItemArray[0].ToString().ToUpper()))
                    {
                        select = true;
                        if (row1.ItemArray[1].ToString().Equals("YES"))
                        {
                            grant = true;
                        }
                        quyen quyen = new quyen(row.ItemArray[0].ToString(), grant ? "1" : "-1");
                        listQuyen.Add(quyen);
                    }
                }
                dataGridView1.Rows.Add(row.ItemArray[0].ToString(), select, grant);
            }
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.AllowUserToAddRows  = false;
        }