示例#1
0
 private void tsbAdd_Click(object sender, EventArgs e)
 {
     if (tsbtxtRoleName.Text == "")
     {
         MessageBox.Show("请输入要添加的角色名称!");
     }
     else
     {
         if (RoleBll.GetRole(tsbtxtRoleName.Text))
         {
             try
             {
                 RoleBll.AddRole(tsbtxtRoleName.Text);
                 dataGridView1.DataSource = RoleBll.RoleFillDs().Tables[0];
                 MessageBox.Show("添加成功!");
             }
             catch (Exception ee)
             {
                 MessageBox.Show("添加失败!" + ee);
                 throw;
             }
         }
         else
         {
             MessageBox.Show("角色已存在!");
         }
     }
 }
示例#2
0
 /// <summary>
 /// 绑定ComboBox的函数
 /// </summary>
 private void FillCob()
 {
     cobRole.ValueMember   = "RoleID";
     cobRole.DisplayMember = "RoleName";
     cobRole.DataSource    = RoleBll.RoleFillDs("").Tables[0];
     if (AddSave == 1)
     {
         btnOK.Text = "修改";
         UserInfo User = UserBll.UserRead(UserID);
         txtID.Text            = User.UserID;
         txtName.Text          = User.UserName;
         txtPwd.Text           = User.UserPwd;
         cobRole.SelectedValue = User.RoleId;
     }
 }
示例#3
0
 private void tsbDel_Click(object sender, EventArgs e)
 {
     if (dataGridView1.CurrentCell != null)
     {
         if (MessageBox.Show("是否删除记录?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             try
             {
                 RoleBll.DelRole(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                 dataGridView1.DataSource = RoleBll.RoleFillDs().Tables[0];
                 getcolumn();
                 MessageBox.Show("删除成功!");
             }
             catch (Exception ee)
             {
                 MessageBox.Show("删除失败!" + ee);
                 throw;
             }
         }
     }
 }
示例#4
0
 private void frmSetRights_Load(object sender, EventArgs e)
 {
     ds = RoleBll.RoleFillDs(RoleID);
     dataGridView1.DataSource = ds.Tables[0];
     getcolumn();
 }
示例#5
0
 private void frmRoleManage_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource = RoleBll.RoleFillDs().Tables[0];
     getcolumn();
 }