private void BindRole()
    {
        DataSet ds = new DataSet();
        PRoleBB roleBB = new PRoleBB();
        try
        {
            ds = roleBB.GetList("");

            this.role.DataTextField = "roleName";
            this.role.DataValueField = "id";
            this.role.DataSource = ds;
            this.role.DataBind();
            this.role.Items.Insert(0, new ListItem("-��ѡ��-", ""));

            this.departRole.DataTextField = "roleName";
            this.departRole.DataValueField = "id";
            this.departRole.DataSource = ds;
            this.departRole.DataBind();
            this.departRole.Items.Insert(0, new ListItem("-��ѡ��-", ""));
        }
        finally
        {
            roleBB.Dispose();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// ��Grid
    /// </summary>
    protected void BindGrid()
    {
        PRoleBB roleBB = new PRoleBB();
        DataSet ds = new DataSet();

        try
        {
            string strWhere = "";

            strWhere = this.StrWhere;

            if (this.txtRoleName.Text.Trim() != "")
            {
                strWhere += " and roleName like '%" + this.txtRoleName.Text.Trim() + "%'";
            }

            ds = roleBB.GetVList(strWhere);

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //��ֵ��¼������ҳ������
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            roleBB.Dispose();
        }
    }
Exemplo n.º 3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        PRoleData model = new PRoleData();
        PRoleBB roleBB = new PRoleBB();
        if (this.roleName.Text == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"��λ���Ʊ�����д!\");", true);
        }
        else
        {
            try
            {
                if (this.State == "1")
                {
                    this.SetModel(ref model);
                    //model.isrtEmpId = this.currentUser.empId;
                    //model.isrtDt = DateTime.Now.ToString();
                    this.IdValue = roleBB.AddRecord(model);
                }
                else if (this.State == "2")
                {
                    model = roleBB.GetModel(this.IdValue);
                    this.SetModel(ref model);
                    if (model.isSys)
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"����λΪϵͳ��λ�����޷��޸ġ�\");", true);
                        return;
                    }
                    roleBB.ModifyRecord(model);
                }
            }
            catch (Exception ex)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
                return;
            }
            finally
            {
                roleBB.Dispose();
            }

            Response.Redirect("PRoleList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false);
        }
    }
 //邦定角色名称
 private void BindRole()
 {
     PRoleData roleData = new PRoleData();
     PRoleBB roleBB = new PRoleBB();
     try
     {
         roleData = roleBB.GetModel(this.RoleId);
         this.roleNm.Text = "当前角色:" + roleData.roleName;
     }
     finally
     {
         roleBB.Dispose();
     }
 }
Exemplo n.º 5
0
 private void ShowInfo(int id)
 {
     PRoleBB roleBB = new PRoleBB();
     PRoleData model = new PRoleData();
     try
     {
         model = roleBB.GetModel(id);
         this.roleName.Text = model.roleName;
         this.isSys.Checked = model.isSys;
         this.mark.Text = model.mark;
     }
     finally
     {
         roleBB.Dispose();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// ɾ��
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnDel_Click(object sender, EventArgs e)
 {
     PRoleBB roleBB = new PRoleBB();
     PUserRoleBB userRoleBB = new PUserRoleBB();
     PRolePermissionsBB rolePermissionsBB = new PRolePermissionsBB();
     //��ȡѡ�е�����Id
     try
     {
         foreach (GridViewRow gvrow in this.grid.Rows)
         {
             CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
             int id = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["id"]);
             if (chkId.Checked == true)
             {
                 PRoleData roleData = new PRoleData();
                 roleData = roleBB.GetModel(id);
                 if (roleData.isSys)
                 {
                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"����λΪϵͳ��λ�����޷�ɾ����\");", true);
                     return;
                 }
                 else
                 {
                     //ɾ����ɫ��ͬʱ��ɾ����Ա��ɫ����ɫȨ��
                     roleBB.DeleteRecord(id);
                     userRoleBB.DeleteRecordByRole(id);
                     rolePermissionsBB.DeleteRecordByRole(id, 2);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
         return;
     }
     finally
     {
         roleBB.Dispose();
         userRoleBB.Dispose();
         rolePermissionsBB.Dispose();
     }
     this.BindGrid();
 }
Exemplo n.º 7
0
 /// <summary>
 /// �޸�
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     //��ȡѡ�е�����Id
     foreach (GridViewRow gvrow in this.grid.Rows)
     {
         CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
         int id = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["id"]);
         if (chkId.Checked == true)
         {
             using (PRoleBB roleBB = new PRoleBB())
             {
                 PRoleData roleData = new PRoleData();
                 roleData = roleBB.GetModel(id);
                 if (roleData.isSys)
                 {
                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"����λΪϵͳ��λ�����޷��޸ġ�\");", true);
                     return;
                 }
                 else
                 {
                     Response.Redirect("PRole.aspx?state=2&itemNo=" + this.itemNo + "&pTypeNo=edit" + "&id=" + id, false);
                 }
             }
         }
     }
     this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"��ѡ��һ����¼!\");", true);
 }