﻿


function CommonShowList(module, pageNumber, fromCache) {
	UpdateNavigation("Show" + module + "s()");	
	
	if(pageNumber==null) pageNumber = 1;
	if(fromCache==null) glbIsSearchResult = false;

	if(fromCache == 1 && glbListCacheXml!=null && glbListCachePage!=null && glbListCachePage==pageNumber) {
		glbContent.innerHTML = TransformXML(glbListCacheXml, module + ".xsl");
	}
	else {
		var paging = new Paging();
		paging.pageNumber = pageNumber;
		paging.fromCache = fromCache;
		
		var soapData = SoapDataBuilder("Show" + module + "s", null, paging);
		glbListCacheXml = AjaxRequest(module + ".asmx",soapData,module + ".xsl");
		glbListCachePage = pageNumber;
	}
	
	if(glbIsSearchResult) {
		var searchTitle = document.getElementById("searchTitle");
		if(searchTitle) {
			searchTitle.style.display = "";
		}
	}
}

function CommonShowListUserfilter() {
	var soapData = SoapDataBuilder("ShowUsersFilter",parseForm('userSendVerification'));
    glbListCacheXml = AjaxRequest("User.asmx",soapData,"user.xsl");
}

function CommonShowGetAllUsers() {
	var soapData = SoapDataBuilder("GetAllUsers");
    glbListCacheXml = AjaxRequest("User.asmx",soapData,"user.xsl");
}

function CommonAdd(module) {
	UpdateNavigation("Add" + module + "()");
	var soapData = SoapDataBuilder("Add" + module);
	AjaxRequest(module + ".asmx",soapData,module + ".xsl");
}

function CommonAdd1(module) {
	UpdateNavigation("Add" + module + "()");
	var soapData = SoapDataBuilder("Add" + module);
	AjaxRequest(module + ".asmx",soapData,module + ".xsl");
}


function CommonShow(module, idValue) {
	
	
	var params = CustomParamBuilder("lng" + module + "ID", idValue);
	var soapData = SoapDataBuilder("Show" + module, params);
	
	AjaxRequest(module + ".asmx", soapData, module + ".xsl");
}

function CommonShowByIndex(module, index) {
	var paging = new Paging();
	paging.recordIndex = index;
	
    var soapData = SoapDataBuilder("Show" + module,null,paging);

    AjaxRequest(module + ".asmx", soapData, module + ".xsl");
}

function CommonDelete(module, idValue) {
	var params = CustomParamBuilder("lng" + module + "ID", idValue);
    var soapData = SoapDataBuilder("Delete" + module, params);
    AjaxRequest(module + ".asmx", soapData, module + ".xsl");
    glbListCacheXml = null;
}