TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
G Y
1.2k
229
43.8k
ASP.NET MVC using Angular JS
Dec 13 2016 12:41 AM
Consider against a Competition record, No. of Participants count is 5 & already 5 students are nominated.
Now login with Student & try to nominate the Student for above Competition. Observe that Student is nominated successfully.
Expected: Should get alert message as "Operation Conflict: Nominations are already reached to max limit."
the Above Validation message is getting when select a Competition. But After selecting the Competition click on Submit, oBserve that student is able to apply for that competition eventhough max limit has reached.
Expected: Provide the Validation message at the Time of Submission so that he cannot apply for that competition
//this is for save competition
$scope.SaveCompetition = function () {
var validated = true;
if ($scope.cmpid == "" || $scope.cmpid == null) {
ngNotify.set("Please select Category.");
validated = false;
return false;
}
else if ($scope.StudentSelection.length <= 0) {
ngNotify.set("Please select Competition.");
validated = false;
return false;
}
else if ($scope.SelectedCompetionstudents.length <= 0) {
ngNotify.set("Please select Competition.");
validated = false;
return false;
}
else {
var mydata = $scope.cmpdata;
var obj = mydata[0].Maxvalue;
var selectedlistcount = 0;
for (var i = 0; i < mydata.length; i++) {
if (mydata[i].Status1 == 'Checked') {
selectedlistcount = selectedlistcount + 1;
}
}
if (obj != null && obj != "") {
if ((($scope.SelectedCompetionstudents.length) + selectedlistcount) > mydata[0].Maxvalue) {
ngNotify.set("Operation Conflict: Already max limit of competitions are reached.");
validated = false;
return false;
}
}
if ($scope.GetNoofparticipants != null) {
if (($scope.GetNoofparticipants.NoOfParticipants) != null) {
if ($scope.SaveedListOfStudentIds.length > $scope.GetNoofparticipants.NoOfParticipants) {
ngNotify.set("Operation Conflict: Nominations are already reached to max limit."); //It is not
// working properly in some cases.
validated = false; //It is not restricting the values sometimes
return false;
}
}
}
}
if (validated) {
var ss = '';
angular.forEach($scope.SelectedCompetionstudents, function (value, key) {
if (ss.length <= 0)
ss = ss + value;
else
ss = ss + "," + value;
});
$http({
method: 'POST',
url: '/StudentCompetition/Save?cmpparticipant=' + ss + "",
data: null,
})
.success(function (data) {
$scope.isDirty = false;
$scope.$parent.spin(false);
$("#cModal1, .customModalCover").css("display", "none");
$scope.GetCompetitionLoadData();
$scope.StudentSelection = [];
$scope.SelectedCompetionstudents = [];
$scope.StudentCategory = 'Choose Category';
});
}
};
Attachment:
61.zip
Reply
Answers (
2
)
Can anyone tell me about node.js and angular.js?
Angular js Exception