git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C15
This commit is contained in:
parent
0abfc22356
commit
34ff497ffc
1 changed files with 86 additions and 53 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val();
|
var CatalogosWCF = $("#hiddenSinortCatalogosWCF").val();
|
||||||
var SinortWCF = $("#hiddenSinortWCF").val();
|
var SinortWCF = $("#hiddenSinortWCF").val();
|
||||||
var server = "http://" + location.host + "/AYA.SlnSynor.WCF/";
|
var server = "http://" + location.host + "/AYA.SlnSynor.WCF/";
|
||||||
|
var TipoRespuesta = { EXITOSO: "1", FALLIDO: "0" };
|
||||||
|
var LoadMessageThreadCounter = 0;
|
||||||
|
|
||||||
function Mensajes(mensaje) {
|
function Mensajes(mensaje) {
|
||||||
if (mensaje.CodigoRespuesta === "1") {
|
if (mensaje.CodigoRespuesta === "1") {
|
||||||
|
|
@ -25,7 +27,7 @@ function Mensajes(mensaje) {
|
||||||
toastr["success"]("Operación procesada exitosamente", "SINORT");
|
toastr["success"]("Operación procesada exitosamente", "SINORT");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mensaje.CodigoRespuesta === "0") {
|
if (mensaje.CodigoRespuesta === "0") {
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
"closeButton": true,
|
"closeButton": true,
|
||||||
"debug": false,
|
"debug": false,
|
||||||
|
|
@ -46,61 +48,30 @@ function Mensajes(mensaje) {
|
||||||
|
|
||||||
toastr["warning"]("Error al procesar la operación", "SINORT");
|
toastr["warning"]("Error al procesar la operación", "SINORT");
|
||||||
}
|
}
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
"closeButton": true,
|
"closeButton": true,
|
||||||
"debug": false,
|
"debug": false,
|
||||||
"newestOnTop": false,
|
"newestOnTop": false,
|
||||||
"progressBar": false,
|
"progressBar": false,
|
||||||
"positionClass": "toast-bottom-full-width",
|
"positionClass": "toast-bottom-full-width",
|
||||||
"preventDuplicates": true,
|
"preventDuplicates": true,
|
||||||
"onclick": null,
|
"onclick": null,
|
||||||
"showDuration": "300",
|
"showDuration": "300",
|
||||||
"hideDuration": "1000",
|
"hideDuration": "1000",
|
||||||
"timeOut": "5000",
|
"timeOut": "5000",
|
||||||
"extendedTimeOut": "1000",
|
"extendedTimeOut": "1000",
|
||||||
"showEasing": "swing",
|
"showEasing": "swing",
|
||||||
"hideEasing": "linear",
|
"hideEasing": "linear",
|
||||||
"showMethod": "fadeIn",
|
"showMethod": "fadeIn",
|
||||||
"hideMethod": "fadeOut"
|
"hideMethod": "fadeOut"
|
||||||
};
|
};
|
||||||
|
|
||||||
toastr["error"](mensaje.DescripcionRespuesta, "SINORT");
|
toastr["error"](mensaje.DescripcionRespuesta, "SINORT");
|
||||||
}
|
}
|
||||||
|
|
||||||
function pagerFilter(data) {
|
function STARTREQUEST(Message) {
|
||||||
if (typeof data.length === 'number' && typeof data.splice === 'function') { // is array
|
|
||||||
data = {
|
|
||||||
total: data.length,
|
|
||||||
rows: data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var dg = $(this);
|
|
||||||
var opts = dg.datagrid('options');
|
|
||||||
var pager = dg.datagrid('getPager');
|
|
||||||
pager.pagination({
|
|
||||||
onSelectPage: function (pageNum, pageSize) {
|
|
||||||
opts.pageNumber = pageNum;
|
|
||||||
opts.pageSize = pageSize;
|
|
||||||
pager.pagination('refresh', {
|
|
||||||
pageNumber: pageNum,
|
|
||||||
pageSize: pageSize
|
|
||||||
});
|
|
||||||
dg.datagrid('loadData', data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!data.originalRows) {
|
|
||||||
data.originalRows = data.rows;
|
|
||||||
}
|
|
||||||
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
|
|
||||||
var end = start + parseInt(opts.pageSize);
|
|
||||||
data.rows = data.originalRows.slice(start, end);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
function STARTREQUEST (Message) {
|
|
||||||
|
|
||||||
if (Message == null) {
|
|
||||||
|
|
||||||
|
if (IsNullOrEmpty(Message)) {
|
||||||
Message = "Cargando Datos, Espere por favor!";
|
Message = "Cargando Datos, Espere por favor!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +196,6 @@ $.fn.TableInit = function (columnOrder, order, bPaginate, bFilter, bInfo, column
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$.fn.EnableValidationToolTip = function () {
|
$.fn.EnableValidationToolTip = function () {
|
||||||
|
|
||||||
this.validate({
|
this.validate({
|
||||||
|
|
@ -281,3 +251,66 @@ $.fn.EnableValidationToolTip = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IsNullOrEmpty = function (value) {
|
||||||
|
|
||||||
|
if (value == null || $.trim(value) == "") return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.AjaxPostData = function (n, t, i, r, u, f, e) {
|
||||||
|
var o = null;
|
||||||
|
return LoadMessage(),
|
||||||
|
LoadMessageThreadCounter++,
|
||||||
|
$.ajax({
|
||||||
|
url: n,
|
||||||
|
async: i,
|
||||||
|
type: 'POST',
|
||||||
|
data: JSON.stringify(t),
|
||||||
|
cache: !1,
|
||||||
|
contentType: 'application/json; charset=utf-8',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (n) {
|
||||||
|
o = AjaxResponse(n, r, u, f, e)
|
||||||
|
}
|
||||||
|
}).fail(function (t, i, r) {
|
||||||
|
(LoadMessageThreadCounter--, typeof AjaxFailEvent == 'undefined' || !$.isFunction(AjaxFailEvent) || AjaxFailEvent(t, i, r)) && (ENDREQUEST(), f != 'ERROR' && toastr.error('Error al ejecutar la petición al WebAPI\n' + r + '\n Url:' + n, Message_Error))
|
||||||
|
}).then(function () {
|
||||||
|
u == null && ENDREQUEST()
|
||||||
|
}),
|
||||||
|
o
|
||||||
|
};
|
||||||
|
|
||||||
|
this.AjaxResponse = function (n, t, i, r, u) {
|
||||||
|
LoadMessageThreadCounter--;
|
||||||
|
u = IsNullOrEmpty(u) ? 'Acción completada con exito.' : u;
|
||||||
|
t == !0 && (n != null && n.CodigoRespuesta == 'EXITOSO' ? toastr.success(u, Message_Success) : n != null && n.CodigoRespuesta == 'ADVERTENCIA' ? toastr.warning(n.DescripcionRespuesta, Message_Warning) : toastr.error('Error verifique los Logs del WebAPI', Message_Error));
|
||||||
|
var f = r == 'ERROR' || n != null && IsNullOrEmpty(n.CodigoRespuesta) ? !0 : n != null && $.inArray(n.CodigoRespuesta, [
|
||||||
|
'EXITOSO',
|
||||||
|
'ADVERTENCIA'
|
||||||
|
]) != -1 && r == 'ADVERTENCIA' ? !0 : n != null && n.CodigoRespuesta == 'EXITOSO' ? !0 : !1;
|
||||||
|
return i != null && f ? i(n) : ENDREQUEST(),
|
||||||
|
n
|
||||||
|
};
|
||||||
|
|
||||||
|
this.AjaxGetData = function (n, t, i, r, u, f) {
|
||||||
|
var e = null;
|
||||||
|
return LoadMessage(),
|
||||||
|
LoadMessageThreadCounter++,
|
||||||
|
$.ajax({
|
||||||
|
url: n,
|
||||||
|
dataType: 'json',
|
||||||
|
data: null,
|
||||||
|
cache: !1,
|
||||||
|
async: t,
|
||||||
|
success: function (n) {
|
||||||
|
e = AjaxResponse(n, i, r, u, f)
|
||||||
|
}
|
||||||
|
}).fail(function (t, i, r) {
|
||||||
|
(LoadMessageThreadCounter--, typeof AjaxFailEvent == 'undefined' || !$.isFunction(AjaxFailEvent) || AjaxFailEvent(t, i, r)) && (ENDREQUEST(), u != 'ERROR' && toastr.error('Error al ejecutar la petición al WebAPI\n' + r + '\n Url:' + n, Message_Error))
|
||||||
|
}).then(function () {
|
||||||
|
r == null && ENDREQUEST()
|
||||||
|
}),
|
||||||
|
e
|
||||||
|
};
|
||||||
Loading…
Add table
Reference in a new issue