private void LoadRole() { Maticsoft.BLL.tRole bll = new Maticsoft.BLL.tRole(); DataTable table = bll.GetAllList().Tables[0]; ddlfatherId.DataTextField = "rName"; ddlfatherId.DataValueField = "rCode"; ddlfatherId.DataSource = table; ddlfatherId.DataBind(); }
protected void LoadData() { Maticsoft.BLL.tRole BLL = new Maticsoft.BLL.tRole(); string sortField = GridDpt.SortField; string sortDirection = GridDpt.SortDirection; GridDpt.RecordCount = BLL.GetRecordCount(""); DataView view = BLL.GetListByPage("", "", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView; view.Sort = String.Format("{0} {1}", sortField, sortDirection); GridDpt.DataSource = view.ToTable(); GridDpt.DataBind(); }
protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e) { int roleID = GetSelectedDataKeyID(GridDpt); if (e.CommandName == "Delete") { if (roleID == 10) { Alert.ShowInTop("超级管理员不可删除!"); return; } BLL.tRole BLL = new Maticsoft.BLL.tRole(); bool isTrue = BLL.Delete(roleID); if (!isTrue) { Alert.ShowInTop("删除失败!"); return; } else { LoadData(); } } else if (e.CommandName == "Edit") { Window1.Title = "编辑角色"; string openUrl = String.Format("./RoleEdit.aspx?roleId={0}", HttpUtility.UrlEncode(roleID.ToString())); PageContext.RegisterStartupScript(Window1.GetSaveStateReference(roleID.ToString()) + Window1.GetShowReference(openUrl)); } else { Window1.Title = "编辑角色"; string openUrl = String.Format("./roleMenu.aspx?rCode={0}", HttpUtility.UrlEncode(roleID.ToString())); PageContext.RegisterStartupScript(Window1.GetSaveStateReference(roleID.ToString()) + Window1.GetShowReference(openUrl)); } }
protected string GetRoleName(string Rid) { Maticsoft.BLL.tRole bll = new Maticsoft.BLL.tRole(); Maticsoft.Model.tRole model = bll.GetModel(int.Parse(Rid)); return(model.rName); }