コード例 #1
0
        public int LinkInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID, this._id.ToString().ToUpper());
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME, this._name);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY, this._attributeKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY, this._linkedAttributeKey);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_RDS_LINKS;
            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 += " VALUES ";
            SQL += " (@p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + ")";

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? -1 : -2);
        }
コード例 #2
0
ファイル: CMetaobjectLink.cs プロジェクト: cMenu/cMenu.Server
        public int LinkDelete(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 = "DELETE FROM " + CDBConst.CONST_TABLE_OBJECTS_LINKS + " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + " AND ";
            SQL += CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_LINK_OBJ_KEY;

            var R = Provider.QueryExecute(SQL, false, Params);

            return (R ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #3
0
        public int RecordDelete(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY, this.UserKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY, this.MetaobjectKey);

            var SQL = "DELETE 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.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);

        }
コード例 #4
0
        public int LanguageInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, this._languageCode);
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME, this._languageName);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += "(" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME + ")";
            SQL += " VALUES ";
            SQL += "(@p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + ", @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME + ")";

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_INSERT_OBJECT);
        }
コード例 #5
0
        public int AmountInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY, this._orderKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT_KEY, this._amountKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT, this._amount);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_ORDERS_AMOUNTS;
            SQL += "(" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT + ")";
            SQL += " VALUES ";
            SQL += "(@p" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_ORDER_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_AMOUNTS_AMOUNT + ")";

            var T = Provider.QueryExecute(SQL, false, Params);
            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_INSERT_OBJECT);
        }
コード例 #6
0
        public int LanguageUpdate(IDatabaseProvider Provider)
        {
            var ExistingLanguge = CMetaobjectLanguage.sGetLanguage(this._languageCode, Provider);
            if (ExistingLanguge != null)
            {
                this.LanguageInsert(Provider);
                return -1;
            }

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, this._languageCode);
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME, this._languageName);

            var SQL = "UPDATE " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += "SET ";
            SQL += CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_NAME;
            SQL += " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_UPDATE_OBJECT);
        }
コード例 #7
0
ファイル: CRdsAttribute.cs プロジェクト: cMenu/cMenu.Server
        public int AttributeUpdateByID(IDatabaseProvider Provider)
        {
            var Exists = this.AttributeExists(Provider);
            if (!Exists)
                return this.AttributeInsert(Provider);

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY, this._dictionaryKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN, (this._isHidden ? 1 : 0));
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME, this._name);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE, this._type);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID, this._id.ToString().ToUpper());

            var SQL = "UPDATE " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " SET ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + ", ";
           
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE + " = @p" + 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 R = Provider.QueryExecute(SQL, false, Params);
            return (R ? -1 : -2);
        }
コード例 #8
0
ファイル: CRdsAttribute.cs プロジェクト: cMenu/cMenu.Server
        public int AttributeDeleteByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID, this._id.ToString().ToUpper());

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID;
            var R = Provider.QueryExecute(SQL, false, Params);

            if (!R)
                return -3;

            var RR = CRdsAttributeLink.sDeleteLinksByAttribute(this._key, Provider);
            if (RR != -1)
                return RR;

            RR = CRdsAttributeValue.sAttributeValuesDeleteByAttribute(this._key, Provider);
            if (RR != -1)
                return RR;

            RR = CRdsAttributeLink.sDeleteLinksByLinkedAttribute(this._key, Provider);

            return RR;
        }
コード例 #9
0
        public static int sDeleteSessionsByUser(decimal UserKey, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_USER, UserKey);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_SESSION;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_USER;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #10
0
ファイル: CRdsElement.cs プロジェクト: cMenu/cMenu.Server
        public int ElementDelete(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY, this._key);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY;
            var R = Provider.QueryExecute(SQL, false, Params);
            
            var RR = CRdsElement.sElementsChildrenDelete(this._key, this._dictionaryKey, Provider);
            if (RR != -1)
                return RR;

            RR = this._values.AttributeValuesDelete(Provider);
            if (RR != -1)
                return RR;

            return (R ? -1 : -2);
        }
コード例 #11
0
ファイル: CRdsElement.cs プロジェクト: cMenu/cMenu.Server
        public int ElementInsert(IDatabaseProvider Provider)
        {
            this._key = CDatabaseSequence.sGetRdsKey(Provider);
            this._version = CDatabaseSequence.sGetVersionKey(Provider);

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY, this._dictionaryKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION, this._version);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT, this._parent);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_RDS_ELEM + " (";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + ", " + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + ")";
            SQL += " VALUES (";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY + ", ";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION + ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT + ")";

            var R = Provider.QueryExecute(SQL, false, Params);
            if (R)
            {
                this.Version = this.Version;
                this._values.AttributeValuesInsert(Provider);
            }
            return (R ? -1 : -2);
        }
コード例 #12
0
        public int ValueInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            var SQL = "";
            
            var Keys = new int[this._values.Keys.Count];
            this._values.Keys.CopyTo(Keys, 0);

            foreach (int Key in Keys)
            {
                var Stream = this._values[Key].SerializeBinaryStream();
                var Data = Stream.ToDataByteArray();
                var ExistingValue = CMetaobjectAttributeValue.sGetValue(this._objectKey, this._attributeID, Key, Provider);

                if (ExistingValue != null)
                {
                    Params.Clear();
                    Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._objectKey);
                    Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, this._attributeID);
                    Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE, Key);
                    Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE, Data);

                    SQL = "UPDATE " + CDBConst.CONST_TABLE_OBJECTS_ATTR + " SET ";
                    SQL += CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE + " = @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
                    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 R = Provider.QueryExecute(SQL, false, Params);
                    if (!R)
                        return CErrors.ERR_DB_INSERT_OBJECT;
                    continue;
                }

                Params.Clear();
                Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_KEY, this._objectKey);
                Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID, this._attributeID);
                Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE, Key);
                Params.Add(CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE, Data);

                SQL = "INSERT INTO " + CDBConst.CONST_TABLE_OBJECTS_ATTR + " (";
                SQL += CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", ";
                SQL += CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", " + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE;
                SQL += ") VALUES (";
                SQL += "@p" + CDBConst.CONST_TABLE_FIELD_OBJ_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_ID + ", @p";
                SQL += CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_LOCALE + ", @p" + CDBConst.CONST_TABLE_FIELD_OBJ_ATTR_VALUE + ")";

                var RR = Provider.QueryExecute(SQL, false, Params);
                if (!RR)
                    return CErrors.ERR_DB_INSERT_OBJECT;
            }

            return CErrors.ERR_SUC;
        }
コード例 #13
0
        public int LinkUpdateByKey(IDatabaseProvider Provider)
        {
            bool Exists = this.LinkExists(Provider);
            if (!Exists)
                return this.LinkInsert(Provider);

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME, this._name);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY, this._attributeKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY, this._linkedAttributeKey);

            var SQL = "UPDATE " + CDBConst.CONST_TABLE_RDS_LINKS + " SET ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_NAME + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY + ", ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + ", ";
            SQL += " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? -1 : -2);
        }
コード例 #14
0
        public int SessionDeleteByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_ID, this._id.ToString().ToUpper());

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_SESSION;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_SESSION_USER + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_USER;
            SQL += " AND " + CDBConst.CONST_TABLE_FIELD_SESSION_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_SESSION_ID;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #15
0
        public static int sDeleteLinksByLinkedAttribute(decimal LinkedAttributeKey, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY, LinkedAttributeKey);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_LINKS;
            SQL += " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_LINKED_ATTR_KEY;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? -1 : -2);
        }
コード例 #16
0
        public int LinkDeleteByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_LINK_KEY, this._key);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_LINKS;
            SQL += " WHERE ";
            SQL += CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ID;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? -1 : -2);
        }
コード例 #17
0
ファイル: CRdsAttribute.cs プロジェクト: cMenu/cMenu.Server
        public int AttributeInsert(IDatabaseProvider Provider)
        {
            this._key = CDatabaseSequence.sGetRdsKey(Provider);

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY, this._dictionaryKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID, this._id.ToString());
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN, (this._isHidden ? 1 : 0));
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME, this._name);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE, this._type);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY, this._key);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " (";
            SQL += 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 += " VALUES (";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_ID + ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_IS_HIDDEN + ", ";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + ", ";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_NAME + ", @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_TYPE + ")";

            var R = Provider.QueryExecute(SQL, false, Params);
            return (R ? -1 : -2);
        }
コード例 #18
0
        public int LanguageDelete(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE, this._languageCode);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_LANGUAGES;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE + " = @p" + CDBConst.CONST_TABLE_FIELD_LANGUAGES_CODE;

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #19
0
ファイル: CRdsAttribute.cs プロジェクト: cMenu/cMenu.Server
        public static int sAttributesDeleteByDictionary(decimal DictionaryKey, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY, DictionaryKey);

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_LINKS + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_LINK_ATTR_KEY + " IN (";
            SQL += "SELECT DISTINCT " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + " FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY;
            SQL += ")";
            var R = Provider.QueryExecute(SQL, false, Params);
            if (!R)
                return -3;

            SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ELEM_DATA + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + " IN (";
            SQL += "SELECT " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_KEY + " FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY;
            SQL += ")";
            R = Provider.QueryExecute(SQL, false, Params);
            if (!R)
                return -4;
     
            SQL = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ATTRIBUTES + " WHERE " + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_RDS_ATTR_DICT_KEY;
            R = Provider.QueryExecute(SQL, false, Params);
            return (R ? -1 : -2);
        }
コード例 #20
0
        public static int sDeleteRecordsByUser(decimal UserKey, IDatabaseProvider Provider)
        {

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

            var SQL = "DELETE 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.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #21
0
        public static int sDeleteValues(decimal ObjectKey, string AttributeID, 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);

            var SQL = "DELETE 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.QueryExecute(SQL, false, Params);               

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_DELETE_OBJECT);
        }
コード例 #22
0
ファイル: CRdsElement.cs プロジェクト: cMenu/cMenu.Server
        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);
        }
コード例 #23
0
ファイル: CRdsElement.cs プロジェクト: cMenu/cMenu.Server
        public int ElementUpdate(IDatabaseProvider Provider)
        {
            var Exists = this.ElementExists(Provider);
            if (!Exists)
                return this.ElementInsert(Provider);

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_VERSION, this._version);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_DICT_KEY, this._dictionaryKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_RDS_ELEM_PARENT, this._parent);

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

            this._values.AttributeValuesUpdate(Provider);

            var R = Provider.QueryExecute(SQL, false, Params);
            return (R ? -1 : -2);
        }
コード例 #24
0
        public int OrderUpdateByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_ID, this._id.ToString().ToUpper());
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DT, this._date);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE, this._deadline);

            var SQL = "UPDATE " + CDBConst.CONST_TABLE_ORDERS;
            SQL += " SET " + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_DT;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_ID;

            var T = Provider.QueryExecute(SQL, false, Params);
            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_UPDATE_OBJECT);
        }
コード例 #25
0
ファイル: CRdsElement.cs プロジェクト: cMenu/cMenu.Server
        public static int sElementsDeleteByDictionary(decimal DictionaryKey, IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            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 " + 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 = "DELETE FROM " + CDBConst.CONST_TABLE_RDS_ELEM + " WHERE " + 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 : -3);
        }
コード例 #26
0
        public int SessionInsert(IDatabaseProvider Provider)
        {
            this._key = CDatabaseSequence.sGetObjectKey(Provider);
            byte[] Data = this._variables.SerializeBinaryStream().ToDataByteArray();

            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_USER, this._userKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE, this._deadLine);
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_ID, this._id.ToString().ToUpper());
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_STATUS, this._status);
            Params.Add(CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES, Data);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_SESSION;
            SQL += "(";
            SQL += CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_USER;
            SQL += ", " + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_ID + ", " + CDBConst.CONST_TABLE_FIELD_SESSION_STATUS;
            SQL += ") VALUES (";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_SESSION_DEADLINE + ", @p" + CDBConst.CONST_TABLE_FIELD_SESSION_VARIABLES + ", @p" + CDBConst.CONST_TABLE_FIELD_SESSION_USER;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_SESSION_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_SESSION_ID + ", @p" + CDBConst.CONST_TABLE_FIELD_SESSION_STATUS;
            SQL += ")";


            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_INSERT_OBJECT);
        }
コード例 #27
0
        public int OrderDeleteByID(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_ID, this._id.ToString().ToUpper());

            var SQL = "DELETE FROM " + CDBConst.CONST_TABLE_ORDERS;
            SQL += " WHERE " + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + " = @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_ID;

            var T = Provider.QueryExecute(SQL, false, Params);
            if (!T)
                return CErrors.ERR_DB_DELETE_OBJECT;
            return CMenuServiceOrderAmount.sDeleteAmountsByOrder(this._key, Provider);
        }
コード例 #28
0
        public int RecordUpdate(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY, this.UserKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY, this.MetaobjectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS, this.Rights);

            var SQL = "UPDATE " + CDBConst.CONST_TABLE_METAOBJECT_SECURITY + " SET ";
            SQL += CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS + " = @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS;
            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.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_UPDATE_OBJECT);

        }
コード例 #29
0
        public int OrderInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_KEY, this._key);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_ID, this._id.ToString().ToUpper());
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY, this._sessionKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DT, this._date);
            Params.Add(CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE, this._deadline);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_ORDERS;
            SQL += "(" + 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_DT + ", " + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE + ")";
            SQL += " VALUES ";
            SQL += "(@p" + CDBConst.CONST_TABLE_FIELD_ORDERS_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_ID + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_SESSION_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_DT;
            SQL += ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_DT + ", @p" + CDBConst.CONST_TABLE_FIELD_ORDERS_DEADLINE + ")";

            var T = Provider.QueryExecute(SQL, false, Params);
            if (!T)
                return CErrors.ERR_DB_INSERT_OBJECT;

            foreach (CMenuServiceOrderAmount Amount in this._amounts)
            {
                Amount.OrderKey = this._key;
                var R = Amount.AmountInsert(Provider);
                if (R != CErrors.ERR_SUC)
                    return CErrors.ERR_DB_INSERT_OBJECT;
            }

            return CErrors.ERR_SUC;
        }
コード例 #30
0
        public int RecordInsert(IDatabaseProvider Provider)
        {
            Hashtable Params = new Hashtable();
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY, this.UserKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY, this.MetaobjectKey);
            Params.Add(CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS, this.Rights);

            var SQL = "INSERT INTO " + CDBConst.CONST_TABLE_METAOBJECT_SECURITY;
            SQL += "(";
            SQL += CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY + ", " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY + ", " + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS;
            SQL += ") VALUES (";
            SQL += "@p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_USER_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_METAOBJECT_KEY + ", @p" + CDBConst.CONST_TABLE_FIELD_METAOBJSEC_RIGHTS;
            SQL += ")";

            var T = Provider.QueryExecute(SQL, false, Params);

            return (T ? CErrors.ERR_SUC : CErrors.ERR_DB_INSERT_OBJECT);
        }