/// <summary> /// 定义操作类型 /// </summary> /// <param name="opType">操作类型序号</param> /// <param name="optypeName">操作类型名</param> /// <param name="optypeCode">操作类型代码</param> /// <param name="auxFactTBLName">一般属性表</param> /// <param name="auxTranTBLName">辅助交易表</param> /// <param name="oltpTempFactTBLName">临时业务流水表</param> /// <param name="oltpFixedFactTBLName">固化业务流水表</param> /// <param name="isValid">是否有效</param> /// <returns></returns> public IRAPError DefineOptypes(short opType, string optypeName, string optypeCode, string auxFactTBLName, string auxTranTBLName, string oltpTempFactTBLName, string oltpFixedFactTBLName, bool isValid) { GenAttr_T4 genAttr = GetGenAttr(); IRAPTreeSet t18Set = new IRAPTreeSet(_db, 0, 18); // var t4RowSet = _t4treeBase.GetRSAttr<RowSet_T4R1>().Cast<RowSet_T4R1>(); var t4RowSet = _db.Set <RowSet_T4R1>().Where(c => c.PartitioningKey == 4 && c.EntityID == _opID); var nameSpaces = IRAPNamespaceSetFactory.CreatInstance(Enums.NamespaceType.Sys); var optypeEntity = t4RowSet.FirstOrDefault(c => c.Ordinal == opType); if (optypeEntity == null) { //新增 int nameID = nameSpaces.GetNameID(0, optypeName); var res = t18Set.NewTreeNode(4, 1018, optypeName, optypeCode, "Admin"); if (res.ErrCode != 0) { return(new IRAPError { ErrCode = res.ErrCode, ErrText = res.ErrText }); } int t18leafEntity = res.NewEntityID; RowSet_T4R1 row = new RowSet_T4R1() { EntityID = _opID, OpType = opType, Ordinal = opType, AuxFactTBLName = auxFactTBLName, T18LeafID = t18leafEntity, IsValid = isValid, PartitioningKey = 4, StateExclCtrlStr = "", VersionLE = 2147483647, AuthorizingCondition = "", ComplementaryRule = "", BusinessDateIsValid = false }; _db.Set <RowSet_T4R1>().Add(row); } else { //修改 optypeEntity.AuxFactTBLName = auxFactTBLName; optypeEntity.IsValid = isValid; IRAPTreeBase tree18 = new IRAPTreeBase(_db, 0, 18, optypeEntity.T18LeafID); if (tree18.Leaf.NodeName != optypeName) { tree18.Leaf.NodeName = optypeName; tree18.Leaf.Code = optypeCode; } } _db.SaveChanges(); return(new IRAPError(0, "定义操作类型成功!")); }
/// <summary> /// 获取可用系统(带权限) /// </summary> /// <param name="access_token"></param> /// <param name="progLangID"></param> /// <returns></returns> public List <SystemDTO> GetAvailableSystems(string access_token, short progLangID) { IRAPLog log = new IRAPLog(); LoginEntity logEntity = log.GetLogIDByToken(access_token); int communityID = (int)(logEntity.PartitioningKey / 10000L); var list = GetSystemList(progLangID); IRAPTreeSet treeSet = new IRAPTreeSet(communityID, 3); List <SystemDTO> resList = new List <SystemDTO>(); foreach (var r in list) { List <TreeViewDTO> accessList = treeSet.AccessibleTreeView(r.SystemID, logEntity.AgencyLeaf, logEntity.RoleLeaf); if (accessList.Count < 2) { continue; } resList.Add(r); } return(resList); }
/// <summary> /// 获取操作类型清单 /// </summary> /// <returns></returns> public List <OpTypeDTO> GetOptypes() { GenAttr_T4 genAttr = GetGenAttr(); IRAPTreeSet t18Set = new IRAPTreeSet(_db, 0, 18); var t4RowSet = _t4treeBase.GetRSAttr <RowSet_T4R1>().Cast <RowSet_T4R1>(); var list = from a in t4RowSet join b in t18Set.LeafEntities on a.T18LeafID equals b.LeafID select new OpTypeDTO { AuxFactTBLName = genAttr.AuxTranTBLName, AuxTranTBLName = genAttr.AuxTranTBLName, AuthorizingCondition = a.AuthorizingCondition, OLTPFixedFactTBLName = genAttr.OLTPFixedFactTBLName, OLTPTempFactTBLName = genAttr.OLTPTempFactTBLName, OpType = (byte)a.OpType, OpTypeCode = b.Code, OpTypeName = b.NodeName, Ordinal = a.Ordinal }; return(list.ToList()); }