private void BindTree() { BindTree mBindTree; ModuleBLL mModuleBLL = new ModuleBLL(); DataTable dtDataSouce = null; if (base.UserInfo == null) { TB_Module mTB_Module = new TB_Module(); mTB_Module.IsActive = 1; mTB_Module.SiteID = base.SystemAdminInfo.SiteID; dtDataSouce = mModuleBLL.GetAllModule(mTB_Module); } else { dtDataSouce = mModuleBLL.GetUserModule(base.UserInfo.ID); } mBindTree = new BindTree(this.treModule); mBindTree.NodeIDCol = "ID"; mBindTree.NodeParentCol = "PID"; mBindTree.NodeTitleCol = "Name"; mBindTree.NodeUrlCol = "URL"; mBindTree.DataSouce = dtDataSouce; mBindTree.Bind(); }
public void LoadTreeModule(TreeView tree, int intRoleID) { ExtendOpeTree mExtendOpeTree = new ExtendOpeTree(tree); DataSet ds = new DataSet(); TB_Module tb_Module = new TB_Module() { IsActive = 1, SiteID = SessionHelper.Get(HttpContext.Current, TypeManager.User) == null ? ((TB_SystemAdmin)SessionHelper.Get(HttpContext.Current, TypeManager.Admin)).SiteID : ((TB_User)SessionHelper.Get(HttpContext.Current, TypeManager.User)).SiteID, }; ds = _mTB_ModuleDAL.GetTable(tb_Module); //设定关键字段值 mExtendOpeTree.NodeIDCol = TB_Module.col_ID; mExtendOpeTree.NodeParentCol = TB_Module.col_PID; mExtendOpeTree.NodeTitleCol = TB_Module.col_Name; mExtendOpeTree.NodeUrlCol = TB_Module.col_URL; DataSet dsRoleOper = _mTB_ModuleDAL.GetModule(intRoleID); if (dsRoleOper != null && dsRoleOper.Tables[0].Rows.Count > 0) { mExtendOpeTree.DefaultCheckSource = dsRoleOper.Tables[0]; } if (ds != null && ds.Tables[0].Rows.Count > 0) { mExtendOpeTree.DataSouce = ds.Tables[0]; mExtendOpeTree.Bind(); } dsRoleOper.Dispose(); }
public DataSet GetTable(TB_Module tb_Module) { DbCommand dbCommandWrapper = null; try { string strSQL = @"SELECT * FROM [TB_Module] where 1=1"; StringBuilder strBuilder = new StringBuilder(strSQL); Database db = DBO.GetInstance(); dbCommandWrapper = db.DbProviderFactory.CreateCommand(); dbCommandWrapper.CommandType = CommandType.Text; strBuilder.AppendLine(" AND SiteID = @SiteID"); db.AddInParameter(dbCommandWrapper, "@SiteID", DbType.Int32, tb_Module.SiteID); strBuilder.AppendLine(" AND [IsActive] = @IsActive"); db.AddInParameter(dbCommandWrapper, "@IsActive", DbType.Int32, tb_Module.IsActive); dbCommandWrapper.CommandText = strBuilder.ToString(); return(db.ExecuteDataSet(dbCommandWrapper)); } catch (Exception ex) { throw ex; } finally { if (dbCommandWrapper != null) { dbCommandWrapper = null; } } }
/// <summary> /// 获取到所有模块 /// </summary> /// <param name="tb_Module"></param> /// <returns></returns> public DataTable GetAllModule(TB_Module tb_Module) { return(_mTB_ModuleDAL.GetTable(tb_Module).Tables[0]); }