Exemplo n.º 1
0
 public static CMetaobject sFindObjectByKey(decimal Key, CMetaobject Root)
 {
     if (Root.Key == Key)
         return Root;
     foreach (CMetaobject Object in Root.Children)
     {
         var R = sFindObjectByKey(Key, Object);
         if (R != null)
             return R;
     }
     return null;
 }
Exemplo n.º 2
0
        public decimal GetRightsForMetaobject(CMetaobject Metaobject)
        {
            var UserRecords = this._securityRecords.Where(R => R.MetaobjectKey == Metaobject.Key && R.UserKey == this._key).ToList();
            var GroupRecords = this._securityRecords.Where(R => R.MetaobjectKey == Metaobject.Key && R.UserKey != this._key).ToList();

            if (UserRecords.Count == 0 && GroupRecords.Count == 0)
                return 0;
            if (UserRecords.Count != 0)
                return UserRecords[0].Rights;
            if (GroupRecords.Count != 0)
                return GroupRecords[0].Rights;

            return 0;
        }
Exemplo n.º 3
0
        public static List<CMetaobject> sGetObjectsByClass(EnMetaobjectClass Class, IDatabaseProvider Provider)
        {
            List<CMetaobject> R = new List<CMetaobject>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_CLASS, Class);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ID + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_OBJ_PARENT + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_SYSTEM + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_MOD + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_STATUS;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS + " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_CLASS;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null)
                return R;
            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Object = new CMetaobject(Provider);
                Object.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
                Object.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>(""));
                Object.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>(-3);
                Object.Class = T.Rows[i][3].PostProcessDatabaseValue<EnMetaobjectClass>();
                Object.System = (T.Rows[i][4].PostProcessDatabaseValue<int>(0) == 1);
                Object.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>(DateTime.Now);
                Object.Status = T.Rows[0][6].PostProcessDatabaseValue<EnMetaobjectStatus>();
                Object.Attributes.ObjectKey = Object.Key;
                R.Add(Object);
            }

            return R;
        }
Exemplo n.º 4
0
 public static CMetaobject sGetObjectByID(Guid ID, IDatabaseProvider Provider)
 {
     CMetaobject R = new CMetaobject(Provider);
     R.ID = ID;
     R.ObjectGetByID(Provider);
     return (R.Key == CDBConst.CONST_OBJECT_EMPTY_KEY ? null : R);
 }
Exemplo n.º 5
0
 public static CMetaobject sGetObjectByKey(decimal Key, IDatabaseProvider Provider)
 {
     CMetaobject R = new CMetaobject(Provider);
     R.Key = Key;
     R.ObjectGetByKey(Provider);
     return (R.ID == Guid.Empty ? null : R);
 }
Exemplo n.º 6
0
 public CMetaobject GetLinkedObject(IDatabaseProvider Provider)
 {
     CMetaobject R = new CMetaobject(Provider);
     R.Key = this.LinkedObjectKey;
     R.ObjectGetByKey(Provider);
     return (R.ID == Guid.Empty ? null : R);
 }