public bool ActualizarDescripcionesMenu(int IDMenu, String NombreMenu, String UrlMenu)
        {
            try
            {
                using (AccesoDatosDataContext ctx = new AccesoDatosDataContext(ConfigurationManager.ConnectionStrings["UniandesConnectionString"].ConnectionString))
                {
                    var oldentity = (from d in ctx.OPERACION
                                     where d.ID_OPERACION == IDMenu
                                     select d).FirstOrDefault();

                    if (oldentity != null)
                    {
                        oldentity.NOMBRE = NombreMenu;
                        oldentity.URL = UrlMenu;

                        ctx.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, oldentity);
                        ctx.SubmitChanges();
                    }

                }
                return true;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        public bool ActualizarPerfil(string Nombre, String Descripcion, int idPerfil)
        {
            using (AccesoDatosDataContext ctx = new AccesoDatosDataContext(ConfigurationManager.ConnectionStrings["UniandesConnectionString"].ConnectionString))
            {
                var oldentity = (from d in ctx.PERFIL
                                 where d.ID_PERFIL == idPerfil
                                 select d);

                if (oldentity.Any())
                {
                    oldentity.First().NOMBRE_PERFIL = Nombre;
                    oldentity.First().DESCRIPCION = Descripcion;
                    ctx.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, oldentity);
                    ctx.SubmitChanges();
                }

            }

            return true;
        }
        //Para desactivar cualquier menu o item de menu
        public bool DesactivarMenuCabeceraOHijo(Boolean Activar, int idMenu)
        {
            try
            {
                using (AccesoDatosDataContext ctx = new AccesoDatosDataContext(ConfigurationManager.ConnectionStrings["UniandesConnectionString"].ConnectionString))
                {
                    var oldentity = (from d in ctx.OPERACION
                                     where d.ID_OPERACION == idMenu
                                     select d).FirstOrDefault();

                    if (oldentity != null)
                    {
                        oldentity.VISIBLE_MENU = Activar == true ? "S" : "N";
                        ctx.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, oldentity);
                        ctx.SubmitChanges();
                    }

                }
                return true;
            }
            catch (Exception ex)
            {
                throw;
            }
        }