dojo.provide("parus.designerTableModelIndexDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("dijit.form.ValidationTextBox");dojo.require("dijit.form.SimpleTextarea");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.require("parus.dictEdit");dojo.require("parus.controlActions");dojo.require("parus.editableDictionaryDialog");dojo.require("parus.editDictionaryDialog");dojo.require("parus.designerIndexDialog");dojo.require("parus.designerIndexFormulaDialog");dojo.declare("parus.designerTableModelIndexDialog",[parus.editDictionaryDialog],{onLoadParams:function(d,c,b){this.inherited(arguments);if(!this.prn&&this.parentDialog&&this.parentDialog.dictionary&&this.parentDialog.dictionary.code=="DesignerBalanceTablesNotIncludedIndexes"){this.prn=this.getParentDialogCondition("MODEL_PRN")}if(d&&c){this.indexEdit.attr("value",d.getValue(c,"BALANCEINDEX"));this.priorityEdit.attr("value",d.getValue(c,"PRIORITY"));this.agrFuncSelect.attr("value",d.getValue(c,"AGR_FUNC"));if(this.editMode){var a=d.getValue(c,"BITYPE")=="1";parus.controlActions.setDisabled(this.agrFuncSelect,!a)}}this.indexEdit.onApplyDictionary=dojo.hitch(this,this.indexChanged)},indexChanged:function(b){if(b){var a=b.getFieldValue("BITYPE")=="1";parus.controlActions.setDisabled(this.agrFuncSelect,!a)}else{if(!this.indexEdit.showingDictionary&&!this.indexEdit.attr("value")){parus.controlActions.setDisabled(this.agrFuncSelect,true)}}},executeInsert:function(b){var a=parus.database.execute("designer.BalanceTableModels.Indexes.Insert",{PRN:this.prn,BALANCEINDEX:this.indexEdit.attr("value"),PRIORITY:this.priorityEdit.attr("value"),AGR_FUNC:this.agrFuncSelect.attr("value")});if(a){return parus.parus8.nodeField(parus.parus8.rowNodes(a)[0],"NRN")}},executeUpdate:function(){var a=parus.database.execute("designer.BalanceTableModels.Indexes.Update",{RN:this.rn,BALANCEINDEX:this.indexEdit.attr("value"),PRIORITY:this.priorityEdit.attr("value"),AGR_FUNC:this.agrFuncSelect.attr("value")});return !!a},executeDelete:function(c,b){var a=parus.database.execute("designer.BalanceTableModels.Indexes.Delete",{RN:c.getValue(b,"RN")});return !!a},executeInsertList:function(b,a){var c=parus.database.execute("designer.BalanceTableModels.Indexes.InsertList",{PRN:b,RN:a});return c},executeInsertGroup:function(c,b){var a=parus.database.execute("designer.BalanceTableModels.Indexes.InsertGroup",{PRN:c,GROUP:b});return a},executeChangePriority:function(c,b){var a=parus.database.execute("designer.BalanceTableModels.Indexes.ChangePriority",{PRN:c,PRIORITY:b});return !!a}});