// create the controller and inject Angular's $scope //scotchApp.registerCtrl('ENDR001Controller', // create a message to display in our view function ENDR100Controller($scope ,$log ,$location ,commonFactory) { init(); // function init(); function init(){ $scope.systemLst = [ {codeId:'WF',systemName:'Work Flow'}, {codeId:'ED',systemName:'EDAS'} ]; $scope.processTypeLst = [ {processTypeCode:'Q',processTypeName:'Search'}, {processTypeCode:'E',processTypeName:'Insert,Update,Delete'}, {processTypeCode:'U',processTypeName:'Execute'} ]; $scope.columnLst = []; $scope.dataLst = []; $scope.$apply(); $scope.systemCode = 'WF'; $scope.processTypeCode = 'Q'; $scope.txtSql = ''; $scope.msgErrorSch = 0; $scope.$apply(); //page $scope.perPages = 50; $scope.maxSize = 10; // end page //////////////////////////////////////////////////////////////////// try{ var actLoadData = $.ajax(doGetPath('/json/ENDR100LoadData.json'), { ajax: true, dataType: 'json', type: "POST" }).error( function (data) { alert("Session Time Out!!!"); $location.path("/"); $scope.$apply(); }); actLoadData.success( function (data) { var dbError = data[0]; if(dbError.errorFlag == 1){ }else{ } $scope.$apply(); } ); }catch(e){ // } } $scope.doSearch = function(form) { //alert("sch"); $scope.msgErrorSch = 0; $scope.$apply(); try{ if(form.$valid){ searchData(); }else{ $scope.msgErrorSch = 1; $scope.$apply(); } }catch(e){ $scope.msgErrorSch = 1; $scope.$apply(); } }; function searchData(){ try{ var actLoadData = $.ajax(doGetPath('/json/ENDR100Process.json'), { ajax: true, dataType: 'json', type: "POST", data:{ processTypeCodeParam : $scope.processTypeCode, txtSqlParam : $scope.txtSql, systemParam : $scope.systemCode } }).error( function (data) { alert("Session Time Out!!!"); $location.path("/"); $scope.$apply(); }); actLoadData.success( function (data) { var dbError = data[0]; // alert(dbError.errorFlag); if(dbError.errorFlag == 1){ }else{ $scope.columnLst = data[1]; $scope.dataLst = data[2]; // alert($scope.columnLst.length); // alert($scope.dataLst.length); setPaging($scope.dataLst); } $scope.$apply(); } ); }catch(e){ // } } function setPaging(dataLst){ $scope.totalItems1 = dataLst.length; $scope.currentPage1 = 1; $scope.numPages1 = Math.ceil($scope.totalItems1 / $scope.perPages); $scope.$apply(); } $scope.setType = function(){ if($scope.systemCode=='ED'){ $scope.processTypeLst = [ {processTypeCode:'Q',processTypeName:'Search'} ]; $scope.processTypeCode = 'Q'; $scope.$apply(); }else{ $scope.processTypeLst = [ {processTypeCode:'Q',processTypeName:'Search'}, {processTypeCode:'E',processTypeName:'Insert,Update,Delete'}, {processTypeCode:'U',processTypeName:'Execute'} ]; } }; } //) //;