1 2 3sgAppControllers.controller('ExportConfigurationController', function ($scope, $http, $filter, $modalInstance, featureAreaType) { 4 5 /* 6 * Models: 7 */ 8 9 function ExportConfigurationItem() { 10 11 12 this.ParentExportConfigurationItemID = 0; 13 this.DataSourceKey = null; 14 this.DisplayName = ''; 15 16 this.Value = ''; 17 this.Order = 0; 18 19 this.DataSourceName = ''; 20 21 this.IsCustom = false; 22 }; 23 24 25 26 $scope.exportConfig = {}; 27 $scope.featureAreaType = featureAreaType; 28 29 30 $scope.reseedOrders = function () { 31 ValidationHelper.setServerError($scope.parentForm, ''); // clear server error 32 angular.forEach($scope.exportConfig.ConfigurationItems, function (entry, index) { 33 entry.Order = index + 1; 34 }); 35 }; 36 37 $scope.updateOrders = function (entry) { 38 var index = $scope.exportConfig.ConfigurationItems.indexOf(entry); 39 if (index > -1) { 40 41 if (entry.Order > index) { 42 entry.Order = entry.Order + 0.5; 43 } 44 else { 45 entry.Order = entry.Order - 0.5; 46 } 47 } 48 49 $scope.exportConfig.ConfigurationItems = $filter('orderBy')($scope.exportConfig.ConfigurationItems, 'Order'); 50 $scope.reseedOrders(); 51 52 }; 53 54 55 $scope.addCustomEntry = function () { 56 $scope.exportConfig.ConfigurationItems.push(new ExportConfigurationItem()); 57 $scope.reseedOrders(); 58 }; 59 60 $scope.removeCustomEntry = function (entry) { 61 var index = $scope.exportConfig.ConfigurationItems.indexOf(entry); 62 if (index > -1) { 63 $scope.exportConfig.ConfigurationItems.splice(index, 1); 64 $scope.reseedOrders(); 65 } 66 }; 67 68 69 70 71 $scope.submit = function () { 72 ValidationHelper.setServerError($scope.parentForm, ''); // clear server error 73 74 75 //Activate validation for submitted items 76 $scope.exportConfig.ConfigurationItems.forEach(function (item) { 77 item.isSubmitted = true; 78 }); 79 80 if ($scope.parentForm.$valid) { 81 $http({ 82 url: '/Stahlgruber/WS/BusinessAssociateService.svc/SubmitExportConfiguration', 83 method: 'POST', 84 data: { exportConfig: $scope.exportConfig } 85 }). 86 success(function (data, status, headers, config) { 87 88 var status = data.Status; 89 90 if (status.localeCompare(jsonResultStatus.OK) === 0) { 91 92 //close dialog 93 $modalInstance.close(); 94 95 } 96 else if (status.localeCompare(jsonResultStatus.EXCEPTION) === 0) { 97 ValidationHelper.setServerError($scope.parentForm, data.ExceptionMessage); 98 } 99 else if (status.localeCompare(jsonResultStatus.VALIDATION_FAILED) === 0) { 100 ValidationHelper.setServerError($scope.parentForm, data.ErrorMessage); 101 angular.forEach(data.ErrorData, function (value, index) { 102 if (index < $scope.exportConfig.ConfigurationItems.length) { 103 ValidationHelper.handleServerError($scope.exportConfig.ConfigurationItems[index].form, value); 104 } 105 }); 106 } 107 }). 108 error(function (data, status, headers, config) { 109 ValidationHelper.setDefaultError($scope.parentForm); 110 }); 111 } 112 }; 113 114 115 116 // Start webservice request to retrieve a list of customer ledger. 117 $http({ method: 'GET', url: '/Stahlgruber/WS/BusinessAssociateService.svc/GetExportConfiguration', params: { featureAreaType: $scope.featureAreaType, 'ie8TimeStamp': new Date().getTime() } }). 118 success(function (data, status, headers, config) { 119 // this callback will be called asynchronously 120 // when the response is available. 121 122 // Check json response status. 123 switch (data.Status) { 124 case 'EXCEPTION': 125 ValidationHelper.setServerError($scope.parentForm, data.ExceptionMessage); 126 return; 127 128 case 'VALIDATION_FAILED': 129 ValidationHelper.setServerError($scope.parentForm, data.ErrorMessage); 130 return; 131 } 132
133 $scope.exportConfig = data.Data; 134 }). 135 error(function (data, status) { 136 ValidationHelper.setDefaultError($scope.parentForm); 137 }); 138 139 140});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.