예제 #1
0
        private void btnCopyGrant_Click(object sender, EventArgs e)
        {
            if (this.cboProduct.SelectedItem == null)
            {
                return;
            }
            HdpProduct        hdpProduct = this.cboProduct.SelectedItem as HdpProduct;
            CopyRoleGrantForm form       = new CopyRoleGrantForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                List <HdpRoleGrant> lstHdpRoleGrant = form.lstHdpRoleGrant;
                foreach (HdpRoleGrant hdpRoleGrant in form.lstHdpRoleGrant)
                {
                    if (dicHdpRoleGrant.ContainsKey(hdpRoleGrant.RoleRightKey))
                    {
                        continue;
                    }
                    foreach (Control item in this.flpGrant.Controls)
                    {
                        CheckBox chk = item as CheckBox;
                        //if ((chk.Tag as RightPoint).RightKey == hdpRoleGrant.RoleRightKey)
                        //{
                        //    chk.Checked = true;
                        //    break;
                        //}
                    }
                }
            }
        }
예제 #2
0
        private void toolbtnCopyGrant_Click(object sender, EventArgs e)
        {
            if (this.toolcboProduct.SelectedItem == null)
            {
                return;
            }
            HdpProduct        hdpProduct = this.toolcboProduct.SelectedItem as HdpProduct;
            CopyRoleGrantForm form       = new CopyRoleGrantForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                List <HdpRoleGrant> lstHdpRoleGrant = form.lstHdpRoleGrant;
                foreach (HdpRoleGrant hdpRoleGrant in form.lstHdpRoleGrant)
                {
                    if (hdpProduct.NAME_SHORT != hdpRoleGrant.Product)
                    {
                        continue;
                    }
                    //判断是否已存在于列表中
                    if (this.CheckGrantRowData(hdpRoleGrant))
                    {
                        continue;
                    }
                    hdpRoleGrant.GrantID  = hdpRoleGrant.MakeGrantID();
                    hdpRoleGrant.RoleCode = this.RoleInfo.RoleCode;
                    int             rowIndex = this.dataGridView1.Rows.Add();
                    DataGridViewRow row      = this.dataGridView1.Rows[rowIndex];
                    row.Tag = hdpRoleGrant;
                    row.Cells[this.colRoleRightKey.Index].Value = hdpRoleGrant.RoleRightKey;

                    row.Cells[this.colRoleRightDesc.Index].Value    = hdpRoleGrant.RoleRightDesc;
                    row.Cells[this.colRoleRightCommand.Index].Value = hdpRoleGrant.RoleRightCommand;

                    this.dataGridView1.SetRowState(rowIndex, RowState.New);
                }
            }
        }