validar nombre proyecto
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C463
This commit is contained in:
parent
ccba57a38c
commit
cccbd685db
4 changed files with 39 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
var model = {};
|
var model = {};
|
||||||
var IdPropuestaNormativa;
|
var IdPropuestaNormativa;
|
||||||
|
var existeNombre = false;
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -349,7 +350,21 @@ this.LimpiarUsuario = function () {
|
||||||
$('#hiddenUsuario').val('');
|
$('#hiddenUsuario').val('');
|
||||||
$('#txtUsuario').val('');
|
$('#txtUsuario').val('');
|
||||||
}
|
}
|
||||||
|
this.BuscarNombre = function () {
|
||||||
|
model = {
|
||||||
|
nombreProyecto: $("#txtNombreProyecto").val(),
|
||||||
|
tipoProyecto: Proyectos.Foro.Codigo
|
||||||
|
}
|
||||||
|
var uri = SinortWCF + '/api/BuscarNombreProyecto';
|
||||||
|
AjaxPostData(uri, model, false, false, ExisteNombre, null, null);
|
||||||
|
}
|
||||||
|
this.ExisteNombre = function (data) {
|
||||||
|
if (data != null) {
|
||||||
|
if (parseInt(data) > 0) {
|
||||||
|
existeNombre = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this.GuardarForo = function () {
|
this.GuardarForo = function () {
|
||||||
|
|
||||||
if (!$("#formForo").valid()) {
|
if (!$("#formForo").valid()) {
|
||||||
|
|
@ -361,6 +376,15 @@ this.GuardarForo = function () {
|
||||||
toastr.warning("Todos los campos que son requeridos.");
|
toastr.warning("Todos los campos que son requeridos.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BuscarNombre();
|
||||||
|
|
||||||
|
if (existeNombre) {
|
||||||
|
toastr.warning("El nombre del foro ya existe");
|
||||||
|
return false;
|
||||||
|
ENDREQUEST();
|
||||||
|
}
|
||||||
|
|
||||||
if (!confirm("Va a ingresar un nuevo foro .\n ¿Desea continuar?"))
|
if (!confirm("Va a ingresar un nuevo foro .\n ¿Desea continuar?"))
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
var model = {};
|
var model = {};
|
||||||
var Nombre;
|
var Nombre;
|
||||||
var IdPropuestaNormativa;
|
var IdPropuestaNormativa;
|
||||||
|
var existeNombre = false;
|
||||||
|
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
|
|
||||||
|
|
@ -450,7 +451,8 @@ $('#tableUsuarios').on('click', 'button', function () {
|
||||||
});
|
});
|
||||||
this.BuscarNombre = function () {
|
this.BuscarNombre = function () {
|
||||||
model = {
|
model = {
|
||||||
nombreProyecto: $("#txtNombreProyecto").val()
|
nombreProyecto: $("#txtNombreProyecto").val(),
|
||||||
|
tipoProyecto: Proyectos.PropuestaNormativa.Codigo
|
||||||
}
|
}
|
||||||
var uri = SinortWCF + '/api/BuscarNombreProyecto';
|
var uri = SinortWCF + '/api/BuscarNombreProyecto';
|
||||||
AjaxPostData(uri, model, false, false, ExisteNombre, null, null);
|
AjaxPostData(uri, model, false, false, ExisteNombre, null, null);
|
||||||
|
|
@ -458,8 +460,7 @@ this.BuscarNombre = function () {
|
||||||
this.ExisteNombre = function (data) {
|
this.ExisteNombre = function (data) {
|
||||||
if(data!= null){
|
if(data!= null){
|
||||||
if (parseInt(data) > 0) {
|
if (parseInt(data) > 0) {
|
||||||
toastr.warning("El nombre de la propuesta ya existe");
|
existeNombre = true;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -477,6 +478,13 @@ this.GuardarPropuesta = function () {
|
||||||
|
|
||||||
BuscarNombre();
|
BuscarNombre();
|
||||||
|
|
||||||
|
if (existeNombre)
|
||||||
|
{
|
||||||
|
toastr.warning("El nombre de la propuesta ya existe");
|
||||||
|
return false;
|
||||||
|
ENDREQUEST();
|
||||||
|
}
|
||||||
|
|
||||||
if (!confirm("Va a ingresar una nueva propuesta normativa .\n ¿Desea continuar?"))
|
if (!confirm("Va a ingresar una nueva propuesta normativa .\n ¿Desea continuar?"))
|
||||||
{ return; }
|
{ return; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
nombre = db.ProyectoNormativo.Where(r => r.NombreProyectoNormativo.ToString() == model.nombreProyecto.ToLower()).Count().ToString();
|
nombre = db.ProyectoNormativo.Where(r => r.NombreProyectoNormativo.ToString() == model.nombreProyecto.ToLower() && r.IdTipoProyecto == model.tipoProyecto).Count().ToString();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ namespace AYA.SlnSinortModel.Entidades
|
||||||
public List<TareasPendientes> ListaTareasPendientes { get; set; }
|
public List<TareasPendientes> ListaTareasPendientes { get; set; }
|
||||||
|
|
||||||
public string nombreProyecto { get; set; }
|
public string nombreProyecto { get; set; }
|
||||||
|
|
||||||
|
public int tipoProyecto { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ficha tecnica
|
//Ficha tecnica
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue