public static List<CMenuServiceOrderAmount> sGetAmountsByOrder(decimal Key, IDatabaseProvider Provider)
        {
            List<CMenuServiceOrderAmount> R = new List<CMenuServiceOrderAmount>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY, Key);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT;
            SQL += " FROM " + CDBConst.CONST_TABLE_ORDERS_AMOUNTS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return R;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Amount = new CMenuServiceOrderAmount();
                Amount.OrderKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Amount.AmountKey = T.Rows[i][1].PostProcessDatabaseValue<decimal>();
                Amount.Amount = T.Rows[i][2].PostProcessDatabaseValue<int>();

                R.Add(Amount);
            }

            return R;
        }
Example #2
0
        public int SessionGetByKey(decimal Key, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_KEY, Key);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_ID + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_STATUS + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_TYPE;
            SQL += " FROM " + CDBConst.CONST_TABLE_SESSION;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this._userKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._deadLine = T.Rows[0][2].PostProcessDatabaseValue<DateTime>(DateTime.Now);
            this._key = T.Rows[0][3].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._id = Guid.Parse(T.Rows[0][4].PostProcessDatabaseValue<string>(""));
            this._status = T.Rows[0][5].PostProcessDatabaseValue<EnSessionStatus>(EnSessionStatus.EEnabled);
            this._type = T.Rows[0][7].PostProcessDatabaseValue<EnSessionType>(EnSessionType.EWeb);

            byte[] Data = T.Rows[0][6].PostProcessDatabaseValue<byte[]>(new byte[0]);
            this._variables = Data.ToDataStream().DeserializeBinaryStream<Hashtable>();

            return CErrors.ERR_SUC;
         }
Example #3
0
        public int LinkGet(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._sourceObjectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY, this._linkedObjectKey);

            string SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_VALUE;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_TYPE;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_LINKS + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this._sourceObjectKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._linkedObjectKey = T.Rows[0][1].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._linkValue = T.Rows[0][2].PostProcessDatabaseValue<int>(-1);
            this._linkType = T.Rows[0][3].PostProcessDatabaseValue<EnMetaobjectLinkType>();

            return CErrors.ERR_SUC;
        }
Example #4
0
        public static decimal sGetVersionKey(IDatabaseProvider Provider)
        {
            decimal Key = -1;
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SEQUENCE_VALUE, "1");
            string SQL = "begin INSERT INTO " + CDBConst.CONST_TABLE_SEQUENCE_VERSIONS + " (" + CDBConst.CONST_TABLE_FIELD_SEQUENCE_VALUE + ") VALUES (@p" + CDBConst.CONST_TABLE_FIELD_SEQUENCE_VALUE + "); SELECT MAX(" + CDBConst.CONST_TABLE_FIELD_SEQUENCE_ID + ") FROM " + CDBConst.CONST_TABLE_SEQUENCE_VERSIONS + "; end;";
            DataTable T = Provider.QueryGetData(SQL, true, Params);
            Key = (T != null ? (decimal)T.Rows[0][0] : -1);

            return Key;
        }
        public int LanguageGet(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, this._languageCode);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " FROM " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this._languageName = T.Rows[0][1].PostProcessDatabaseValue<string>();

            return CErrors.ERR_SUC;
        }
Example #6
0
        public int OrderGetByKey(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_KEY, this._key);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE;
            SQL += " FROM " + CDBConst.CONST_TABLE_ORDERS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this._key = T.Rows[0][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._id = Guid.Parse(T.Rows[0][1].PostProcessDatabaseValue<string>(""));
            this._sessionKey = T.Rows[0][2].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
            this._date = T.Rows[0][3].PostProcessDatabaseValue<DateTime>(DateTime.Now);
            this._deadline = T.Rows[0][4].PostProcessDatabaseValue<DateTime>(DateTime.Now);
            this._amounts = CMenuServiceOrderAmount.sGetAmountsByOrder(this._key, Provider);

            return CErrors.ERR_SUC;
        }
        public int RecordGet(IDatabaseProvider Provider, decimal UserKey, decimal MetaobjectKey)
        {
            CMetaobjectSecurityRecord R = new CMetaobjectSecurityRecord();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY, UserKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY, MetaobjectKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS + " FROM " + CDBConst.CONST_TABLE_METAOBJECT_SECURITY;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY + "= @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY + "= @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this.MetaobjectKey = MetaobjectKey;
            this.UserKey = UserKey;
            this.Rights = T.Rows[0][0].PostProcessDatabaseValue<int>(-3);

            return CErrors.ERR_SUC;

        }
        public static List<CMetaobjectAttributeValue> sGetValuesByObject(decimal ObjectKey, IDatabaseProvider Provider)
        {
            List<CMetaobjectAttributeValue> R = new List<CMetaobjectAttributeValue>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, ObjectKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_ATTR;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
            SQL += " ORDER BY " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return R;

            string PreviousID = "";
            string CurrentID = "";
            CMetaobjectAttributeValue Value = null;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                CurrentID = T.Rows[i][1].PostProcessDatabaseValue<string>("");
                if (PreviousID != CurrentID)
                {
                    if (Value != null)
                        R.Add(Value);

                    Value = new CMetaobjectAttributeValue(Provider);
                    Value.ObjectKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>(-1);
                    Value.AttributeID = T.Rows[i][1].PostProcessDatabaseValue<string>("");
                }

                byte[] Data = T.Rows[i][3].PostProcessDatabaseValue<byte[]>(new byte[0]);
                var Stream = Data.ToDataStream();
                var Obj = Stream.DeserializeBinaryStream<object>();

                Value.Values.Add(T.Rows[i][2].PostProcessDatabaseValue<int>(-1), Obj);
                PreviousID = CurrentID;
            }

            return R;
        }        
        public static CMetaobjectAttributeValue sGetValue(decimal ObjectKey, string AttributeID, IDatabaseProvider Provider)
        {
            CMetaobjectAttributeValue R = null;

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, ObjectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, AttributeID);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_ATTR;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return null;

            R = new CMetaobjectAttributeValue(Provider);
            R.ObjectKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>(-1);
            R.AttributeID = T.Rows[0][1].PostProcessDatabaseValue<string>("");

            for (int i = 0; i < T.Rows.Count; i++)
            {
                byte[] Data = T.Rows[i][3].PostProcessDatabaseValue<byte[]>(new byte[0]);
                var Stream = Data.ToDataStream();
                var Obj = Stream.DeserializeBinaryStream<object>();

                if (R.Values.ContainsKey(T.Rows[i][2].PostProcessDatabaseValue<int>(-1)))
                    continue;
                R.Values.Add(T.Rows[i][2].PostProcessDatabaseValue<int>(-1), Obj);
            }

            return R;
        }
        public static object sGetValue(decimal ObjectKey, string AttributeID, int Locale, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, ObjectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, AttributeID);
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE, Locale);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_ATTR;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return null;

            byte[] Data = T.Rows[0][3].PostProcessDatabaseValue<byte[]>(new byte[0]);
            var Stream = Data.ToDataStream();
            var Obj = Stream.DeserializeBinaryStream<object>();

            return Obj;
        }
Example #11
0
        public List<CSystemPolicy> sGetAllPolicies(IDatabaseProvider Provider)
        {
            List<CSystemPolicy> R = new List<CSystemPolicy>();

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

            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 Policy = new CSystemPolicy(Provider);
                Policy.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Policy.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                Policy.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Policy.Class = T.Rows[i][3].PostProcessDatabaseValue<EnMetaobjectClass>();
                Policy.System = ((T.Rows[i][4]).PostProcessDatabaseValue<int>() == 1);
                Policy.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>();
                Policy.Status = T.Rows[0][6].PostProcessDatabaseValue<EnMetaobjectStatus>();
                Policy.Attributes.ObjectKey = Policy.Key;
                R.Add(Policy);
            }

            return R;
        }        
Example #12
0
        public static List<CMenuServiceOrder> sGetOrdersByDates(DateTime StartDate, DateTime EndDate, IDatabaseProvider Provider)
        {
            List<CMenuServiceOrder> R = new List<CMenuServiceOrder>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DT + "_START", StartDate);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DT + "_END", EndDate);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE;
            SQL += " FROM " + CDBConst.CONST_TABLE_ORDERS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + " >= " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + "_START";
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + " <= " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + "_END";

            var T = Provider.QueryGetData(SQL, false, null);
            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Order = new CMenuServiceOrder();
                Order.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Order.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                Order.SessionKey = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Order.Date = T.Rows[i][3].PostProcessDatabaseValue<DateTime>();
                Order.Deadline = T.Rows[i][4].PostProcessDatabaseValue<DateTime>();
                R.Add(Order);
            }

            return R;
        }
Example #13
0
        public static int sElementsChildrenDelete(decimal ElementKey, decimal DictionaryKey, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT, ElementKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY, DictionaryKey);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ELEM_DATA + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + " IN (";
            SQL += "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + " FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY;
            SQL += ")";
            var R = Provider.QueryExecute(SQL, false, Params);
            if (!R)
                return -3;

            SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + " FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null)
                return -2;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Key = (decimal)T.Rows[i][0];
                CRdsElement.sElementsChildrenDelete(Key, DictionaryKey, Provider);
            }
            SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY;
            R = Provider.QueryExecute(SQL, false, Params);

            return (R ? -1 : -4);
        }
Example #14
0
        public bool ElementExists(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION, this._version);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY, this._key);

            var SQL = "SELECT Count(*) FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY;
            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null)
                return false;
            var RecordsCount = (int)T.Rows[0][0];
            return (RecordsCount > 0);
        }
        public static List<CMetaobjectSecurityRecord> sGetRecordsByUser(decimal UserKey, IDatabaseProvider Provider)
        {
            List<CMetaobjectSecurityRecord> R = new List<CMetaobjectSecurityRecord>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY, UserKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY + ", " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS;
            SQL += " FROM " + CDBConst.CONST_TABLE_METAOBJECT_SECURITY + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T != null)
                for (int i = 0; i < T.Rows.Count; i++)
                {
                    var Record = new CMetaobjectSecurityRecord();
                    Record.MetaobjectKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                    Record.UserKey = T.Rows[i][1].PostProcessDatabaseValue<decimal>();
                    Record.Rights = T.Rows[i][2].PostProcessDatabaseValue<int>();
                    R.Add(Record);
                }

            return R;
        }
Example #16
0
        public static List<CSystemUserGroup> sGetAllGroups(IDatabaseProvider Provider)
        {
            List<CSystemUserGroup> R = new List<CSystemUserGroup>();

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

            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 Group = new CSystemUserGroup(Provider);
                Group.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Group.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                Group.Parent = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Group.Class = (EnMetaobjectClass)T.Rows[i][3].PostProcessDatabaseValue<int>();
                Group.System = (T.Rows[i][4].PostProcessDatabaseValue<int>() == 1);
                Group.ModificatonDate = T.Rows[0][5].PostProcessDatabaseValue<DateTime>();
                Group.Status = (EnMetaobjectStatus)T.Rows[0][6].PostProcessDatabaseValue<int>();
                Group.ExternalLinks = CMetaobjectLink.sGetExternalLinks(Group.Key, Provider);
                Group.InternalLinks = CMetaobjectLink.sGetInternalLinks(Group.Key, Provider);
                Group.Attributes.ObjectKey = Group.Key;
                R.Add(Group);
            }

            return R;
        }
Example #17
0
        public static bool sExistsByID(decimal Key, Guid ID, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ID, ID.ToString().ToUpper());
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, Key);

            var SQL = "SELECT Count(*) FROM " + CDBConst.CONST_TABLE_OBJECTS + " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ID;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " <> @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;

            DataTable T = Provider.QueryGetData(SQL, false, Params);

            int R = (T != null ? T.Rows[0][0].PostProcessDatabaseValue<int>() : 1);
            return (R > 0);
        }
Example #18
0
        public static CMetaobjectLanguage sGetLanguage(int LanguageCode, IDatabaseProvider Provider)
        {
            CMetaobjectLanguage R = new CMetaobjectLanguage();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, LanguageCode);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " FROM " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return null;

            R.LanguageName = T.Rows[0][1].PostProcessDatabaseValue<string>("");
            R.LanguageCode = T.Rows[0][0].PostProcessDatabaseValue<int>(-1);

            return R;
        }
Example #19
0
        public static List<CMetaobjectLanguage> sGetAllLanguages(IDatabaseProvider Provider)
        {
            List<CMetaobjectLanguage> R = new List<CMetaobjectLanguage>();

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " FROM " + CDBConst.CONST_TABLE_LANGUAGES;

            var T = Provider.QueryGetData(SQL, false, null);
            if (T == null || T.Rows.Count == 0)
                return R;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Language = new CMetaobjectLanguage()
                {
                    LanguageCode = T.Rows[i][0].PostProcessDatabaseValue<int>(),
                    LanguageName = T.Rows[i][1].PostProcessDatabaseValue<string>()
                };
                R.Add(Language);
            }

            return R;
        }
Example #20
0
        public static List<CRdsAttributeLink> sGetLinksByAttribute(decimal AttributeKey, IDatabaseProvider Provider)
        {
            List<CRdsAttributeLink> R = new List<CRdsAttributeLink>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY, AttributeKey);

            var SQL = "SELECT ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY;
            SQL += " FROM " + CDBConst.CONST_TABLE_RDS_LINKS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return R;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                CRdsAttributeLink Link = new CRdsAttributeLink()
                {
                    Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>(),
                    ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>()),
                    Name = T.Rows[i][2].PostProcessDatabaseValue<string>(),
                    AttributeKey = T.Rows[i][3].PostProcessDatabaseValue<decimal>(),
                    LinkedAttributeKey = T.Rows[i][4].PostProcessDatabaseValue<decimal>()
                };
                R.Add(Link);
            }

            return R;
        }
Example #21
0
        public int LinkGetByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID, this._key);

            var SQL = "SELECT ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY;
            SQL += " FROM " + CDBConst.CONST_TABLE_RDS_LINKS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return -2;

            this._key = T.Rows[0][0].PostProcessDatabaseValue<decimal>();
            this._id = Guid.Parse(T.Rows[0][1].PostProcessDatabaseValue<string>());
            this._name = T.Rows[0][2].PostProcessDatabaseValue<string>();
            this._attributeKey = T.Rows[0][3].PostProcessDatabaseValue<decimal>();
            this._linkedAttributeKey = T.Rows[0][4].PostProcessDatabaseValue<decimal>();

            return -1;
        }
        public int ValueGet(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._objectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, this._attributeID);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
            SQL += " FROM " + CDBConst.CONST_TABLE_OBJECTS_ATTR;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return CErrors.ERR_DB_GET_OBJECT;

            this._values.Clear();

            for (int i = 0; i < T.Rows.Count; i++)
            {    
                byte[] Data = T.Rows[i][3].PostProcessDatabaseValue<byte[]>(new byte[0]);
                var Stream = Data.ToDataStream();
                var Obj = Stream.DeserializeBinaryStream<object>();

                this._values.Add(T.Rows[i][2].PostProcessDatabaseValue<int>(-1), Obj);
            }
            
            return CErrors.ERR_SUC;
        }
Example #23
0
        public int ElementGet(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();

            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION, this._version);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT;
            SQL += " FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return -2;

            this._key = T.Rows[0][0].PostProcessDatabaseValue<decimal>();
            this._version = T.Rows[0][1].PostProcessDatabaseValue<decimal>();
            this._dictionaryKey = T.Rows[0][2].PostProcessDatabaseValue<decimal>();
            this._parent = T.Rows[0][3].PostProcessDatabaseValue<decimal>();

            this.Version = this.Version;

            return -1;
        }
Example #24
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;
        }
Example #25
0
        public static List<CRdsElement> sElementsGetByDictionary(decimal DictionaryKey, IDatabaseProvider Provider)
        {
            Hashtable DelayedElements = new Hashtable();
            List<CRdsElement> R = new List<CRdsElement>();
            Hashtable Params = new Hashtable();
            CRdsElement TempElement = null;

            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY, DictionaryKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT;
            SQL += " FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null)
                return R;
            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Element = new CRdsElement(Provider);
                Element.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Element.Version = T.Rows[i][1].PostProcessDatabaseValue<decimal>();
                Element.DictionaryKey = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Element.Parent = T.Rows[i][3].PostProcessDatabaseValue<decimal>();

                if (DelayedElements.ContainsKey(Element.Key))
                {
                    List<CRdsElement> ChildElements = (List<CRdsElement>)DelayedElements[Element.Parent];
                    Element.Children.AddRange(ChildElements);
                    DelayedElements.Remove(Element.Parent);
                }

                if (Element.Parent == CRDSConst.CONST_RDS_ROOT_PARENT)
                {
                    R.Add(Element);
                    continue;
                }

                TempElement = CRdsElement.sFindElementByKey(R, Element.Parent);
                if (TempElement == null)
                {
                    List<CRdsElement> Elements = null;
                    if (DelayedElements.ContainsKey(Element.Parent))
                    {
                        Elements = (List<CRdsElement>)DelayedElements[Element.Parent];
                        Elements.Add(Element);
                        DelayedElements[Element.Parent] = Elements;
                    }
                    else
                    {
                        Elements = new List<CRdsElement>();
                        Elements.Add(Element);
                        DelayedElements.Add(Element.Parent, Element);
                    }
                }
                else
                    TempElement.Children.Add(Element);

            }

            return R;
        }
Example #26
0
        public int AttributeGetByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID, this._id.ToString().ToUpper());

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T != null)
            {
                this._dictionaryKey = T.Rows[0][0].PostProcessDatabaseValue<decimal>();
                this._id = Guid.Parse(T.Rows[0][1].PostProcessDatabaseValue<string>());
                this._isHidden = (T.Rows[0][2].PostProcessDatabaseValue<int>() == 1);
                this._key = T.Rows[0][3].PostProcessDatabaseValue<int>();
                this._name = T.Rows[0][4].PostProcessDatabaseValue<string>();
                this._type = T.Rows[0][5].PostProcessDatabaseValue<DbType>();
            }

            return -1;
        }
Example #27
0
        public static List<CMenuServiceOrder> sGetAllOrders(IDatabaseProvider Provider)
        {
            List<CMenuServiceOrder> R = new List<CMenuServiceOrder>();

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE;
            SQL += " FROM " + CDBConst.CONST_TABLE_ORDERS;

            var T = Provider.QueryGetData(SQL, false, null);
            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Order = new CMenuServiceOrder();
                Order.Key = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                Order.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                Order.SessionKey = T.Rows[i][2].PostProcessDatabaseValue<decimal>();
                Order.Date = T.Rows[i][3].PostProcessDatabaseValue<DateTime>();
                Order.Deadline = T.Rows[i][4].PostProcessDatabaseValue<DateTime>();
                R.Add(Order);
            }
            
            return R;
        }
Example #28
0
        public bool AttributeExists(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY, this._key);

            var SQL = "SELECT COUNT(*) FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return false;

            return (T.Rows.Count.PostProcessDatabaseValue<int>() > 0);
        }
Example #29
0
        public static List<CRdsAttribute> sAttributesGetByDictionary(decimal DictKey, IDatabaseProvider Provider)
        {
            List<CRdsAttribute> R = new List<CRdsAttribute>();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY, DictKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE;
            SQL += " FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY;

            var T = Provider.QueryGetData(SQL, false, Params);
            CRdsAttribute Attr = null;
            if (T != null)
            {
                for (int i = 0; i < T.Rows.Count; i++)
                {
                    Attr = new CRdsAttribute();
                    Attr.DictionaryKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>();
                    Attr.ID = Guid.Parse(T.Rows[i][1].PostProcessDatabaseValue<string>());
                    Attr.IsHidden = ((T.Rows[i][2]).PostProcessDatabaseValue<int>() == 1);
                    Attr.Key = T.Rows[i][3].PostProcessDatabaseValue<decimal>();
                    Attr.Name = T.Rows[i][4].PostProcessDatabaseValue<string>();
                    Attr.Type = T.Rows[i][5].PostProcessDatabaseValue<DbType>();
                    R.Add(Attr);
                }                    
            }

            return R;
        }
Example #30
0
        public static List<CSystemUserSession> sGetSessionsByUser(decimal UserKey, IDatabaseProvider Provider)
        {
            List<CSystemUserSession> R = new List<CSystemUserSession>();
            
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_USER, UserKey);

            var SQL = "SELECT " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_ID + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_STATUS + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_TYPE;
            SQL += " FROM " + CDBConst.CONST_TABLE_SESSION;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_USER;

            var T = Provider.QueryGetData(SQL, false, Params);
            if (T == null || T.Rows.Count == 0)
                return R;

            for (int i = 0; i < T.Rows.Count; i++)
            {
                var Session = new CSystemUserSession();
                Session.UserKey = T.Rows[i][0].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
                Session.DeadLine = T.Rows[i][1].PostProcessDatabaseValue<DateTime>(DateTime.Now);
                Session.Key = T.Rows[i][3].PostProcessDatabaseValue<decimal>(CDBConst.CONST_OBJECT_EMPTY_KEY);
                Session.ID = Guid.Parse(T.Rows[i][4].PostProcessDatabaseValue<string>(""));
                Session.Status = T.Rows[i][5].PostProcessDatabaseValue<EnSessionStatus>(EnSessionStatus.EEnabled);
                Session.Type = T.Rows[i][7].PostProcessDatabaseValue<EnSessionType>(EnSessionType.EWeb);

                byte[] Data = T.Rows[0][6].PostProcessDatabaseValue<byte[]>(new byte[0]);
                Session.Variables = Data.ToDataStream().DeserializeBinaryStream<Hashtable>();
                R.Add(Session);
            }
            
            return R;

        }