⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 microsoftajaxtemplates.debug.js

📁 ajax
💻 JS
📖 第 1 页 / 共 5 页
字号:
        this._saveParameters = value;
    }
    function Sys$Data$DataContext$get_saveChangesTimeout() {
        /// <value type="Number" integer="true" locid="P:J#Sys.Data.DataContext.saveChangesTimeout"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._saveTimeout;
    }
    function Sys$Data$DataContext$set_saveChangesTimeout(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: Number, integer: true}]);
        if (e) throw e;
        this._saveTimeout = value;
    }
    function Sys$Data$DataContext$get_isSaving() {
        /// <value type="Boolean" locid="P:J#Sys.Data.DataContext.isSaving"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._saving;
    }
    function Sys$Data$DataContext$get_serviceUri() {
        /// <value type="String" mayBeNull="true" locid="P:J#Sys.Data.DataContext.serviceUri"></value>
        if (arguments.length !== 0) throw Error.parameterCount();
        return this._serviceUri || "";
    }
    function Sys$Data$DataContext$set_serviceUri(value) {
        var e = Function._validateParams(arguments, [{name: "value", type: String, mayBeNull: true}]);
        if (e) throw e;
        this._serviceUri = value;
    }
    function Sys$Data$DataContext$addLink(sourceEntity, sourcePropertyName, targetEntity) {
        /// <summary locid="M:J#Sys.Data.DataContext.addLink" />
        /// <param name="sourceEntity" type="Object"></param>
        /// <param name="sourcePropertyName" type="String"></param>
        /// <param name="targetEntity" type="Object"></param>
        var e = Function._validateParams(arguments, [
            {name: "sourceEntity", type: Object},
            {name: "sourcePropertyName", type: String},
            {name: "targetEntity", type: Object}
        ]);
        if (e) throw e;
        var toggled = this._toggleLink(sourceEntity, sourcePropertyName, targetEntity),
            valueSet = this._setLinkField(true, sourceEntity, sourcePropertyName, targetEntity);
        if (!toggled || (toggled.action !== Sys.Data.ChangeOperationType.remove)) {
            if (valueSet || (toggled && (toggled.action === Sys.Data.ChangeOperationType.insert))) {
                this._registerChange(new Sys.Data.ChangeOperation(Sys.Data.ChangeOperationType.insert,
                    null, sourceEntity, sourcePropertyName, targetEntity));
            }
        }
    }
    function Sys$Data$DataContext$removeLink(sourceEntity, sourcePropertyName, targetEntity) {
        /// <summary locid="M:J#Sys.Data.DataContext.removeLink" />
        /// <param name="sourceEntity" type="Object"></param>
        /// <param name="sourcePropertyName" type="String"></param>
        /// <param name="targetEntity" type="Object"></param>
        var e = Function._validateParams(arguments, [
            {name: "sourceEntity", type: Object},
            {name: "sourcePropertyName", type: String},
            {name: "targetEntity", type: Object}
        ]);
        if (e) throw e;
        var toggled = this._toggleLink(sourceEntity, sourcePropertyName, targetEntity),
            valueSet = this._setLinkField(true, sourceEntity, sourcePropertyName, targetEntity, true);
            
        if (!toggled || (toggled.action !== Sys.Data.ChangeOperationType.insert)) {
            if (valueSet || (toggled && (toggled.action === Sys.Data.ChangeOperationType.remove))) {
                this._registerChange(new Sys.Data.ChangeOperation(Sys.Data.ChangeOperationType.remove,
                    null, sourceEntity, sourcePropertyName, targetEntity));
            }
        }
    }
    function Sys$Data$DataContext$setLink(sourceEntity, sourcePropertyName, targetEntity) {
        /// <summary locid="M:J#Sys.Data.DataContext.setLink" />
        /// <param name="sourceEntity" type="Object"></param>
        /// <param name="sourcePropertyName" type="String"></param>
        /// <param name="targetEntity" type="Object" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "sourceEntity", type: Object},
            {name: "sourcePropertyName", type: String},
            {name: "targetEntity", type: Object, mayBeNull: true}
        ]);
        if (e) throw e;
        this._toggleLink(sourceEntity, sourcePropertyName, targetEntity);
        this._setLinkField(false, sourceEntity, sourcePropertyName, targetEntity);
        this._registerChange(new Sys.Data.ChangeOperation(Sys.Data.ChangeOperationType.update,
            null, sourceEntity, sourcePropertyName, targetEntity));
    }
    function Sys$Data$DataContext$abortSave() {
        /// <summary locid="M:J#Sys.Data.DataContext.abortSave" />
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this._saverequest) {
            this._saverequest.get_executor().abort();
            this._saverequest = null;
        }
        if (this._saving) {
            this._saving = false;
            this.raisePropertyChanged("isSaving");
        }
    }
    function Sys$Data$DataContext$clearChanges() {
        /// <summary locid="M:J#Sys.Data.DataContext.clearChanges" />
        if (arguments.length !== 0) throw Error.parameterCount();
        this._edits = this._deletes = this._inserts = null;
        if (this._changelist) {
            Sys.Observer.clear(this._changelist);
        }
        if (this._hasChanges) {
            this._hasChanges = false;
            this.raisePropertyChanged("hasChanges");
        }
    }
    function Sys$Data$DataContext$clearData() {
        /// <summary locid="M:J#Sys.Data.DataContext.clearData" />
        if (arguments.length !== 0) throw Error.parameterCount();
        this._clearData();
    }
    function Sys$Data$DataContext$createEntity(entitySetName) {
        /// <summary locid="M:J#Sys.Data.DataContext.createEntity" />
        /// <param name="entitySetName" type="String" optional="true" mayBeNull="true"></param>
        /// <returns type="Object"></returns>
        var e = Function._validateParams(arguments, [
            {name: "entitySetName", type: String, mayBeNull: true, optional: true}
        ]);
        if (e) throw e;
        var getter = this.get_createEntityMethod();
        if (!getter) {
            throw Error.invalidOperation(String.format(Sys.UI.TemplatesRes.requiredMethodProperty, "createEntityMethod", "createEntity"));
        }
        return getter(this, entitySetName);
    }
    function Sys$Data$DataContext$dispose() {
        /// <summary locid="M:J#Sys.Data.DataContext.dispose" />
        if (arguments.length !== 0) throw Error.parameterCount();
        if (this._disposed) return;
        this._disposed = true;
        if (this.get_isSaving()) {
            this.abortSave();
        }
        this.clearData();
        this._lastResults = null;
        this._saverequest = null;
        this._methods = {};        
        Sys.Data.DataContext.callBaseMethod(this, "dispose");
    }
    function Sys$Data$DataContext$initialize() {
        /// <summary locid="M:J#Sys.Data.DataContext.initialize" />
        if (arguments.length !== 0) throw Error.parameterCount();
        this.updated();
        Sys.Data.DataContext.callBaseMethod(this, "initialize");
    }
    function Sys$Data$DataContext$fetchDeferredProperty(entity, propertyName, mergeOption, succeededCallback, failedCallback, timeout, userContext) {
        /// <summary locid="M:J#Sys.Data.DataContext.fetchDeferredProperty" />
        /// <param name="entity" type="Object"></param>
        /// <param name="propertyName" type="String"></param>
        /// <param name="mergeOption" type="Sys.Data.MergeOption" optional="true" mayBeNull="true"></param>
        /// <param name="succeededCallback" type="Function" mayBeNull="true" optional="true"></param>
        /// <param name="failedCallback" type="Function" mayBeNull="true" optional="true"></param>
        /// <param name="timeout" type="Number" integer="true" mayBeNull="true" optional="true"></param>
        /// <param name="userContext" mayBeNull="true" optional="true"></param>
        /// <returns type="Sys.Net.WebRequest"></returns>
        var e = Function._validateParams(arguments, [
            {name: "entity", type: Object},
            {name: "propertyName", type: String},
            {name: "mergeOption", type: Sys.Data.MergeOption, mayBeNull: true, optional: true},
            {name: "succeededCallback", type: Function, mayBeNull: true, optional: true},
            {name: "failedCallback", type: Function, mayBeNull: true, optional: true},
            {name: "timeout", type: Number, mayBeNull: true, integer: true, optional: true},
            {name: "userContext", mayBeNull: true, optional: true}
        ]);
        if (e) throw e;
        var getter = this.get_getDeferredPropertyFetchOperationMethod();
        if (!getter) {
            throw Error.invalidOperation(String.format(Sys.UI.TemplatesRes.requiredMethodProperty, "getDeferredPropertyFetchOperationMethod", "fetchDeferredProperty"));
        }
        var _this = this, query = getter(this, entity, propertyName, userContext);
        if (query && query.operation) {
            function done(result) {
                _this._setField(entity, propertyName, null, result, null, true);
                if (succeededCallback) {
                    succeededCallback(result, userContext, propertyName);
                }
            }
            function fail(error) {
                if (failedCallback) {
                    failedCallback(error, userContext, propertyName);
                }
            }
            if (typeof(userContext) === "undefined") {
                userContext = null;
            }
            if ((typeof(mergeOption) === "undefined") || (mergeOption === null)) {
                mergeOption = this.get_mergeOption();
            }
            return this.fetchData(query.operation, query.parameters || null, mergeOption, query.httpVerb || "POST", done, fail, timeout || 0, userContext);
        }
    }
    function Sys$Data$DataContext$getNewIdentity(entity, entitySetName) {
        /// <summary locid="M:J#fail" />
        /// <param name="entity"></param>
        /// <param name="entitySetName" type="String" mayBeNull="true"></param>
        /// <returns mayBeNull="true"></returns>
        var e = Function._validateParams(arguments, [
            {name: "entity"},
            {name: "entitySetName", type: String, mayBeNull: true}
        ]);
        if (e) throw e;
        var getter = this.get_getNewIdentityMethod();
        return getter ? (getter(this, entity, entitySetName) || null) : null;
    }
    function Sys$Data$DataContext$insertEntity(entity, entitySetName) {
        /// <summary locid="M:J#fail" />
        /// <param name="entity"></param>
        /// <param name="entitySetName" type="String" optional="true" mayBeNull="true"></param>
        var e = Function._validateParams(arguments, [
            {name: "entity"},
            {name: "entitySetName", type: String, mayBeNull: true, optional: true}
        ]);
        if (e) throw e;
        var identity = null;
        if (this._useIdentity) {
            identity = this.getIdentity(entity);
            if (identity === null) {
                identity = this.getNewIdentity(entity, entitySetName || null);
            }
            if (!identity) {
                throw Error.invalidOperation(Sys.UI.TemplatesRes.requiredIdentity);
            }
            if (this._items[identity]) {
                throw Error.invalidOperation(String.format(Sys.UI.TemplatesRes.entityAlreadyExists, identity));
            }
            this._storeEntity(identity, entity);
        }
        else {
            this._captureEntity(entity);
        }
        this._inserts = this._pushChange(this._inserts, entity, identity);
        this._registerChange(new Sys.Data.ChangeOperation(Sys.Data.ChangeOperationType.insert, entity));
    }
    function Sys$Data$DataContext$removeEntity(entity) {
        /// <summary locid="M:J#fail" />
        /// <param name="entity"></param>
        var e = Function._validateParams(arguments, [
            {name: "entity"}
        ]);
        if (e) throw e;
        if (this._ignoreChange) return;
        var identity = this.getIdentity(entity);
        if (identity !== null) {
            entity = this._items[identity];
            if (typeof (entity) === "undefined") {
                return;
            }
            delete this._items[identity];
        }
        this._releaseEntity(entity);
        var _this = this,
            changelist = this.get_changes(),
            hadChange = this._hasChanges;
        function unregister() {
            for (var i = 0, l = changelist.length; i < l; i++) {
                if (changelist[i].item === entity) {
                    Sys.Observer.removeAt(changelist, i);
                    _this._hasChanges = !!changelist.length;
                    return;
                }
            }
        }
        if (this._peekChange(this._inserts, entity, identity, true)) {
            unregister();
        }
        else {
            this._deletes = this._pushChange(this._deletes, entity, identity);
            if (this._peekChange(this._edits, entity, identity, true)) {
                unregister();
            }
            Sys.Observer.add(changelist, new Sys.Data.ChangeOperation(Sys.Data.ChangeOperationType.remove, entity));
            this._hasChanges = true;
        }
        if (this._hasChanges !== hadChange) {
            this._raiseChanged("hasChanges");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -