Click here to Skip to main content
15,845,436 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
$(document).ready(function () {
BindCreateSizePopup();
BindSizeGridsEvents();
});


var sizeNameAlreadyExist = false;
var sizeCodeAlreadyExist = false;


function BindCreateSizePopup() {
$('#AddNewSize').click(function () {
showLoader(true);
$.get("/Size/_Create", function (data) {
showLoader(false);
bootbox.dialog({
message: data,
title: "Size"
});
});
});
}

function BindSizeGridsEvents() {

$('#CountryPagination div ul li a').click(function () {
var URL = $(this).attr('href');
if (URL.trim() != "") {
showLoader(true);
$.get(URL, function (data) {
$('#SizeGridPlaceHolder').html(data);
showLoader(false);
BindSizeGridsEvents();
});
}
return false;
});

$('.EditSize').click(function () {
var URL = $(this).attr('href');
showLoader(true);
$.get(URL, function (data) {
showLoader(false);
bootbox.dialog({
message: data,
title: "Size"
});

});
return false;
});

$('.DeleteSize').click(function () {
var URL = $(this).attr('href');
bootbox.dialog({
message: "Are you sure you want to delete this Country?",
title: "Confirm",
buttons: {
ok: {
label: "Ok",
className: "btn btn-primary",
callback: function () {
showLoader(true);
$.post(URL, function (data) {
LoadCountryGrid();
$(".bootbox").modal("hide");
showLoader(false);
successBox("Size deleted successfully.", "Success");
}).fail(function () {
showLoader(false);
dangerBox("Cannot remove this record as this might be referenced in some other data.", "Error");
});
}
},
cancel: {
label: "Cancel",
className: "btn btn-light-grey",
callback: function () {
$(".bootbox").modal("hide");
showLoader(false);
}
}
}
});
$('.modal-content').attr('class', 'modal-content alert-danger');
return false;
});

}

function LoadSizeGrid() {
$.get("/Size/_Index", function (data) {
$('#SizeGridPlaceHolder').html(data);
BindCountryGridsEvents();
});
}










function ChecksizeAlreadExist() {

if ($('#size').val().trim() == '')
return;

showLoader(true);
$.ajax({
url: "/size/issizeExist",
type: "POST",
data: { id: $('#ID').val(), name: $('#countryName').val().trim() },
traditional: true,
success: function (html) {

if (html.trim() == 'True') {
countryNameAlreadyExist = true;
$('#countryNameAlreadyExistError').show();
}
else {
countryNameAlreadyExist = false;
$('#countryNameAlreadyExistError').hide();
}
showLoader(false);
}
});
}

function CheckcountryCodeAlreadExist() {

if ($('#countryCode').val().trim() == '')
return;

showLoader(true);
$.ajax({
url: "/country/iscountryCodeExist",
type: "POST",
data: { id: $('#ID').val(), code: $('#countryCode').val().trim() },
traditional: true,
success: function (html) {
if (html.trim() == 'True') {
countryCodeAlreadyExist = true;
$('#countryCodeAlreadyExistError').show();
}
else {
countryCodeAlreadyExist = false;
$('#countryCodeAlreadyExistError').hide();
}
showLoader(false);
}
});
}



function BindcountryNameEvent() {
$("#countryName").focusout(function () {
CheckcountryNameAlreadExist();
});
}


function bindLnaguageCodeEvent() {
$("#CountryCode").focusout(function () {
CheckcountryCodeAlreadExist();
});
}


function validateCountryForm() {
if (countryCodeAlreadyExist == false && countryNameAlreadyExist == false)
return true;
else
return false;
}
Posted
Updated 25-Feb-15 1:50am
v2
Comments
Sergey Alexandrovich Kryukov 25-Feb-15 6:50am    
Not clear. This is not a question.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900