$scope.SaveFixedFee = function () { $scope.validate = false; if ($scope.AddFixedfeeForm.$valid) { angular.forEach($scope.lsteComfixedfeelist, function (value, key) { if (value.ChannelId == $scope.channelid) { if (value.Condition.indexOf("=") != -1) { if (($scope.frmamt >= value.FromAmount && $scope.frmamt <= value.ToAmount) || ($scope.toamt >= value.FromAmount && $scope.toamt <= value.ToAmount)) { alert("Please check the from and to amount"); $scope.validate = true; } } else { if (($scope.frmamt > value.FromAmount && $scope.frmamt < value.ToAmount) || ($scope.toamt > value.FromAmount && $scope.toamt <= value.ToAmount)) { alert("Please check the from and to amount"); $scope.validate = true; } } if (value.Condition.indexOf(">") != -1) { if ((parseInt($scope.frmamt) - 1) != parseInt(value.ToAmount)) { $scope.validate1 = true; } } else { if (parseInt($scope.frmamt) != parseInt(value.ToAmount)) { $scope.validate2 = true; } } } }) if ($scope.validate) { alert("false"); return false; } if ($scope.validate1) { alert("false1"); return false; } if ($scope.validate2) { alert("false2"); return false; } if ((parseInt($scope.frmamt) > parseInt($scope.toamt)) || (parseInt($scope.frmamt) >= parseInt($scope.toamt))) { alert("from amount should less than the to amount"); return false; } //if ($scope.validate()) { // return false; //} var Requestboy = { 'ChannelId': $scope.channelid, 'FromAmount': $scope.frmamt, 'ToAmount': $scope.toamt, 'FixedFee': $scope.feeamt, 'Condition': $scope.condition, 'CreatedBy': $scope.LoginRoleId } $http.post(serviceBasePath + '/api/Product/addFixedFee', Requestboy).then(function (response) { if (response.data.indexOf("Successfully") != -1) { alert("Successfully Updated"); $state.reload(); } else { alert(response.data); return false; } }, function (error) { alert("Something Went Wrong"); return false; }) } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)