private async void AutorizaIngresoTrasladoLoad(object parametro)
        {
            try
            {
                Traslados = await StaticSourcesViewModel.CargarDatosAsync <ObservableCollection <EXT_TRASLADO_DETALLE> >(() => {
                    return(new ObservableCollection <EXT_TRASLADO_DETALLE>(new cTrasladoDetalle().ObtenerTodosDestino(GlobalVar.gCentro, new List <string> {
                        "AC"
                    })
                                                                           .Select(s => new EXT_TRASLADO_DETALLE {
                        TRASLADO_DETALLE = s, SELECCIONADO = true
                    })));
                });

                if (Traslados.Count() > 0)
                {
                    var permisos = new cProcesoUsuario().Obtener(enumProcesos.TRASLADOMASIVO.ToString(), StaticSourcesViewModel.UsuarioLogin.Username);
                    if (permisos.Any(w => w.INSERTAR == 1))
                    {
                        MenuAutorizarEnabled = true;
                    }
                    StaticSourcesViewModel.SourceChanged = true;
                }

                else
                {
                    StaticSourcesViewModel.SourceChanged = false;
                    MenuAutorizarEnabled = false;
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar los traslados pendientes", ex);
            }
        }
        private async void Autorizar()
        {
            try
            {
                var id_area_traslado = Parametro.ID_AREA_TRASLADO;
                if (await StaticSourcesViewModel.OperacionesAsync <bool>("Autorizando traslados", () =>
                {
                    var traslados_detalle = new List <TRASLADO_DETALLE>();
                    var fecha = Fechas.GetFechaDateServer;
                    foreach (var item in Traslados)
                    {
                        var _traslado = item.TRASLADO_DETALLE.TRASLADO;
                        if (item.SELECCIONADO)
                        {
                            traslados_detalle.Add(new TRASLADO_DETALLE {
                                ID_ESTATUS_ADMINISTRATIVO = item.TRASLADO_DETALLE.ID_ESTATUS_ADMINISTRATIVO,
                                ID_ANIO = item.TRASLADO_DETALLE.ID_ANIO,
                                ID_CENTRO = item.TRASLADO_DETALLE.ID_CENTRO,
                                ID_ESTATUS = "FI",
                                ID_IMPUTADO = item.TRASLADO_DETALLE.ID_IMPUTADO,
                                ID_INGRESO = item.TRASLADO_DETALLE.ID_INGRESO,
                                ID_TRASLADO = item.TRASLADO_DETALLE.ID_TRASLADO
                            });
                        }
                    }
                    new cTrasladoDetalle().AutorizarTraslado(traslados_detalle, fecha, id_area_traslado, Parametro.UB_RECEPCION_TRASLADO, (short)enumAtencionTipo.CONSULTA_MEDICA,
                                                             (short)enumAtencionTipo.CONSULTA_DENTAL, GlobalVar.gUsr, "PE");
                    return(true);
                }))
                {
                    new Dialogos().ConfirmacionDialogo("EXITO!", "Se autorizaron los traslados");
                    Traslados = await StaticSourcesViewModel.CargarDatosAsync <ObservableCollection <EXT_TRASLADO_DETALLE> >(() =>
                    {
                        return(new ObservableCollection <EXT_TRASLADO_DETALLE>(new cTrasladoDetalle().ObtenerTodosDestino(GlobalVar.gCentro, new List <string> {
                            "AC"
                        })
                                                                               .Select(s => new EXT_TRASLADO_DETALLE {
                            TRASLADO_DETALLE = s, SELECCIONADO = true
                        })));
                    });

                    if (Traslados.Count() > 0)
                    {
                        StaticSourcesViewModel.SourceChanged = true;
                    }
                    else
                    {
                        MenuAutorizarEnabled = false;
                        StaticSourcesViewModel.SourceChanged = false;
                    }
                    ImagenIngreso = null;
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al autorizar los traslados pendientes", ex);
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Traslados traslados = await db.Traslados.FindAsync(id);

            db.Traslados.Remove(traslados);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit([Bind(Include = "IdTraslado,Clave,Descripcion")] Traslados traslados)
        {
            if (ModelState.IsValid)
            {
                traslados.Clave           = Seguridad.Encrypt(traslados.Clave);
                traslados.Descripcion     = Seguridad.Encrypt(traslados.Descripcion);
                db.Entry(traslados).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(traslados));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Traslados traslados = await db.Traslados.FindAsync(id);

            if (traslados == null)
            {
                return(HttpNotFound());
            }
            return(View(traslados));
        }
 private void ClickSwitch(object parametro)
 {
     if (parametro != null)
     {
         switch (parametro.ToString())
         {
         case "autorizar_menu":
             if (Traslados.Any(w => w.SELECCIONADO == true))
             {
                 Autorizar();
             }
             else
             {
                 new Dialogos().ConfirmacionDialogo("Validación", "Debe de haber por lo menos un traslado seleccionado para autorizar");
             }
             break;
         }
     }
 }
Exemplo n.º 7
0
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Traslados traslados = await db.Traslados.FindAsync(id);

            if (traslados == null)
            {
                return(HttpNotFound());
            }
            else
            {
                traslados.Clave       = Seguridad.Decrypt(traslados.Clave);
                traslados.Descripcion = Seguridad.Decrypt(traslados.Descripcion);
            }
            return(View(traslados));
        }