//public IList<IndivadualSuiteInfoEntity> GetSuiteList() //{ // DataTable dt = dac.GetSuiteList(); // string str = JsonConvert.SerializeObject(dt); // IList<IndivadualSuiteInfoEntity> suites = Newtonsoft.Json.JsonConvert.DeserializeObject<IList<IndivadualSuiteInfoEntity>>(str); // return suites; //} public IList <SuiteInfoEntity> GetSuiteList() { List <SuiteInfoEntity> list = new List <SuiteInfoEntity>(); //取套件权限 //DataTable suitrightdt = rigthService.GetSuitRight(NG3.AppInfoBase.OCode, NG3.AppInfoBase.LoginID); //DataTable dt = rigthService.ReadProductInfo().Tables["SuitInfo"]; DataTable dt = dac.GetSuiteList(); //取套件权限 Enterprise3.Rights.AnalyticEngine.FuncRightControl cpcmInterface = new FuncRightControl(); DataTable suitrightdt = new DataTable(); for (int i = 0; i < 3; i++) { suitrightdt = cpcmInterface.GetSuitRight(NG3.AppInfoBase.OrgID, NG3.AppInfoBase.UserID); if (suitrightdt == null || suitrightdt.Rows.Count == 0) { System.Threading.Thread.Sleep(500); } else { break; } } //获取所有套件 //string currentCultureName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; //DataTable dt = MainFrameUIP.GetSuitList(i6Culture.GetProductXmlFilePath(MainCommonUIP.GetPath(), currentCultureName)).Tables[1]; foreach (DataRow dr in dt.Rows) { string module = dr["suite"].ToString(); //普通用户和非DMC模块要判断套件权限 if ((NG3.AppInfoBase.UserType == SUP.Common.Base.UserType.OrgUser && "PUB" != module.ToUpper())) { DataRow[] drs = suitrightdt.Select(string.Format("suit='{0}' and ishas=true", module)); if (drs.Length == 0) { continue;//无权限 } } SuiteInfoEntity entity = new SuiteInfoEntity(); entity.Code = dr["suite"].ToString(); entity.Name = dr["Name"].ToString(); list.Add(entity); } return(list); }
public IList <SuiteInfoEntity> GetSuiteList(bool rightFlag, string treeFilter)// { try { string logId = LogHelper <MainTreeRule> .StartMethodLog("getSuiteRigthService"); List <SuiteInfoEntity> list = new List <SuiteInfoEntity>(); //取套件权限 //DataTable suitrightdt = rigthService.GetSuitRight(NG3.AppInfoBase.OCode, NG3.AppInfoBase.LoginID); DataTable dtInCache = rigthService.ReadProductInfo().Tables["SuitInfo"]; //把缓存里的套件表拷贝出来进行操作,不能直接操作缓存里表的引用,否则会修改了缓存里的表 DataTable dt = dtInCache.Copy(); //取套件权限 //i6.Biz.DMC.CPCM_Interface cpcmInterface = new i6.Biz.DMC.CPCM_Interface(NG3.AppInfoBase.UserConnectString); Enterprise3.Rights.AnalyticEngine.FuncRightControl cpcmInterface = new FuncRightControl(); DataTable suitrightdt = new DataTable(); for (int i = 0; i < 3; i++) { suitrightdt = cpcmInterface.GetSuitRight(NG3.AppInfoBase.OrgID, NG3.AppInfoBase.UserID); if (suitrightdt == null || suitrightdt.Rows.Count == 0) { System.Threading.Thread.Sleep(500); } else { break; } } LogHelper <MainTreeRule> .EndMethodLog(logId, 0); if (treeFilter != "" && treeFilter != null) { DataTable filterDt = dac.FilterTable(treeFilter); for (int i = dt.Rows.Count - 1; i >= 0; i--) { DataRow dr = dt.Rows[i]; DataRow[] drs = filterDt.Select(string.Format("suite='{0}'", dr["Code"])); if (drs.Length == 0) { dr.Delete(); } } } dt.AcceptChanges(); //获取所有套件 //string currentCultureName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; //DataTable dt = MainFrameUIP.GetSuitList(i6Culture.GetProductXmlFilePath(MainCommonUIP.GetPath(), currentCultureName)).Tables[1]; if (String.Compare(NG3.AppInfoBase.UserType, "SYSTEM", true) == 0 && rightFlag) { dt.DefaultView.RowFilter = "Code = 'DMC'"; dt = dt.DefaultView.ToTable(); } foreach (DataRow dr in dt.Rows) { string module = dr["Code"].ToString(); //普通用户和非DMC模块要判断套件权限 if ((NG3.AppInfoBase.UserType == SUP.Common.Base.UserType.OrgUser && "PUB" != module.ToUpper())) { DataRow[] drs = suitrightdt.Select(string.Format("suit='{0}' and ishas=true", module)); if (drs.Length == 0 && rightFlag) { continue;//无权限 } } SuiteInfoEntity entity = new SuiteInfoEntity(); entity.Code = dr["Code"].ToString(); entity.Name = dr["Name"].ToString(); list.Add(entity); } return(list); } catch (Exception ex) { Logger.Error(ex.StackTrace); return(null); } }