Exemplo n.º 1
0
        private void FrmUserRight_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“dsPSAP.BS_Menu”中。您可以根据需要移动或删除它。
            this.bS_MenuTableAdapter.Fill(this.dsPSAP.BS_Menu);
            // TODO: 这行代码将数据加载到表“dsPSAP.BS_Role”中。您可以根据需要移动或删除它。
            this.bS_RoleTableAdapter.Fill(this.dsPSAP.BS_Role);
            // TODO: 这行代码将数据加载到表“dsPSAP.BS_Department”中。您可以根据需要移动或删除它。
            this.bS_DepartmentTableAdapter.Fill(this.dsPSAP.BS_Department);

            dtblTmp = BSCommon.getUserInfoList("", "", "");
            dgvUserList.DataSource                  = dtblTmp;
            dgvUserList.ColumnHeadersHeight         = 32;
            dgvUserList.Columns[0].Width            = 40;
            dgvUserList.Columns[1].Width            = 60;
            dgvUserList.Columns[2].Width            = 60;
            dgvUserList.Columns[3].Width            = 90;
            dgvUserList.Columns[4].Width            = 90;
            dgvUserList.Columns[5].Width            = 60;
            dgvUserList.Columns[0].DataPropertyName = dtblTmp.Columns["AutoId"].ToString();
            dgvUserList.Columns[1].DataPropertyName = dtblTmp.Columns["LoginID"].ToString();
            dgvUserList.Columns[2].DataPropertyName = dtblTmp.Columns["EmpName"].ToString();
            dgvUserList.Columns[3].DataPropertyName = dtblTmp.Columns["DepartmentName"].ToString();
            dgvUserList.Columns[4].DataPropertyName = dtblTmp.Columns["RoleName"].ToString();
            dgvUserList.Columns[5].DataPropertyName = dtblTmp.Columns["RoleNo"].ToString();
            dgvUserList.Columns[0].HeaderText       = "员工编号";
            dgvUserList.Columns[1].HeaderText       = "用户编号";
            dgvUserList.Columns[2].HeaderText       = "用户姓名";
            dgvUserList.Columns[3].HeaderText       = "部门";
            dgvUserList.Columns[4].HeaderText       = "角色";
            dgvUserList.Columns[5].HeaderText       = "角色编号";
            dgvUserList.Columns[0].Visible          = false;
            dgvUserList.Columns[5].Visible          = false;

            dtblTmp1 = BSCommon.getDepartmentList();
            cboDepartmentName.DataSource    = dtblTmp1;
            cboDepartmentName.DisplayMember = "DepartmentName";

            //角色combo
            dtblTmp1 = BSCommon.getRoleList();
            cboRoleName.DataSource    = dtblTmp1;
            cboRoleName.DisplayMember = "RoleName";
            cboRoleName.ValueMember   = "RoleNo";

            //初始化【菜单管理page】
            mnsMainMenu.Items.Clear();
            FrmMainBLL.InitMenuItem(mnsMainMenu);//初始化主菜单
            FrmRightBLL.TreeGetNodeForMns(tvwMainMenu, mnsMainMenu);
            tvwMainMenu.ExpandAll();
            FrmRightBLL.InitDataGridViewComboFormName(dataGridViewComboFormName); //初始化窗口名下拉列表
            FrmRightBLL.TraverseFormControlToTable();                             // 遍历所有DockContent窗口及其中控件,并将结果加至数据库表中(系统完成后可停用)

            //初始化【角色管理page】
            InitEnableState();//初始化控件按钮状态
        }
Exemplo n.º 2
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            //createDateDateTimePicker.Value = DateTime.Now;//建立日期设定为保存时间
            //founderTextBox.Text = BSCheckUser.user.EmpName;//获取当前登录用户姓名
            if (string.IsNullOrEmpty(roleNoTextBox.Text))
            {
                MessageBox.Show("【角色编码】为必填项!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                roleNoTextBox.Focus();
                return;
            }
            if (string.IsNullOrEmpty(roleNameTextBox.Text))
            {
                MessageBox.Show("【角色名称】为必填项!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                roleNameTextBox.Focus();
                return;
            }

            try
            {
                this.Validate();
                this.bS_RoleBindingSource.EndEdit();
                this.tableAdapterManager.UpdateAll(this.dsPSAP);
                ChangeEnabledState();//保存后更新控件状态

                //刷新角色combo
                dtblTmp1 = BSCommon.getRoleList();
                cboRoleName.DataSource    = dtblTmp1;
                cboRoleName.DisplayMember = "RoleName";
                cboRoleName.ValueMember   = "RoleNo";
            }
            catch (System.Data.ConstraintException)//关键字字段值重复
            {
                MessageBox.Show("此角色【部门编码】已经存在!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                roleNoTextBox.Focus();
            }

            catch (System.Data.SqlClient.SqlException)//外键约束
            {
                MessageBox.Show("此角色【部门编码】已经被分配权限,不允许修改!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //执行一遍取消操作
            }

            FrmRightBLL.SaveRoleRightFromTree(tvwRoleRight, dgvRoleList); //遍历树保存权限
            FrmRightDAO.GiveRoleAllButtonRight();
            dgvRoleList.Enabled = true;                                   //保存后数据表控件可用
        }
Exemplo n.º 3
0
        private void InitControl()
        {
            try
            {
                lookUpReqDep.Properties.DataSource = commonDAO.QueryDepartment_AllNode(true);
                lookUpReqDep.ItemIndex             = 0;

                gridControlUserList.DataSource = BSCommon.getUserInfoList("", "", "");
                //dgvUserList.Columns[0].Width = 40;
                //dgvUserList.Columns[1].Width = 60;
                //dgvUserList.Columns[2].Width = 60;
                //dgvUserList.Columns[3].Width = 90;
                //dgvUserList.Columns[4].Width = 90;
                //dgvUserList.Columns[5].Width = 60;
                //dgvUserList.Columns[0].FieldName = dtblTmp.Columns["AutoId"].ToString();
                //dgvUserList.Columns[1].FieldName = dtblTmp.Columns["LoginID"].ToString();
                //dgvUserList.Columns[2].FieldName = dtblTmp.Columns["EmpName"].ToString();
                //dgvUserList.Columns[3].FieldName = dtblTmp.Columns["DepartmentName"].ToString();
                //dgvUserList.Columns[4].FieldName = dtblTmp.Columns["RoleName"].ToString();
                //dgvUserList.Columns[5].FieldName = dtblTmp.Columns["RoleNo"].ToString();
                //dgvUserList.Columns[0].Caption = "员工编号";
                //dgvUserList.Columns[1].Caption = "用户编号";
                //dgvUserList.Columns[2].Caption = "用户姓名";
                //dgvUserList.Columns[3].Caption = "部门";
                //dgvUserList.Columns[4].Caption = "角色";
                //dgvUserList.Columns[5].Caption = "角色编号";
                //dgvUserList.Columns[0].Visible = false;
                //dgvUserList.Columns[5].Visible = false;

                //角色combo
                cboRoleName.Properties.DataSource = BSCommon.getRoleList();
                //cboRoleName.Properties.DisplayMember = "RoleName";
                //cboRoleName.Properties.ValueMember = "RoleNo";
            }
            catch (Exception ex)
            {
                //ExceptionHandler.HandleException(this.Text + "--窗体加载事件错误。", ex);
                ExceptionHandler.HandleException(this.Text + "--" + f.tsmiCtjzsjcw.Text, ex);
            }
        }