Exemple #1
0
        private static object ExecListar(string comando)
        {
            string SubComandoListado = Lfx.Types.Strings.GetNextToken(ref comando, " ").Trim();

            Lfc.FormularioListado FormularioListado = null;

            Type TipoLbl = Lbl.Instanciador.InferirTipo(SubComandoListado);

            if (Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(TipoLbl, Lbl.Sys.Permisos.Operaciones.Listar))
            {
                Type TipoListado = Lfc.Instanciador.InferirFormularioListado(TipoLbl);
                if (TipoListado == null)
                {
                    throw new NotImplementedException("LISTAR " + SubComandoListado);
                }
                else
                {
                    FormularioListado = Lfc.Instanciador.InstanciarFormularioListado(TipoListado, comando.Length > 0 ? comando : null);
                }
            }
            else
            {
                return(new Lfx.Types.NoAccessOperationResult());
            }

            return(FormularioListado);
        }
Exemple #2
0
                public static Lfc.FormularioListado InstanciarFormularioListado(Type tipo, string args)
                {
                        object Res;
                        if (args == null || args == string.Empty)
                                Res = Activator.CreateInstance(tipo);
                        else
                                Res = Activator.CreateInstance(tipo, args);

                        if (Res is Lazaro.Pres.Listings.Listing) {
                                Lfc.FormularioListado NewForm = new Lfc.FormularioListado(Res as Lazaro.Pres.Listings.Listing);
                                return NewForm;
                        } else {
                                return Res as Lfc.FormularioListado;
                        }
                }
Exemple #3
0
        public static Lfc.FormularioListado InstanciarFormularioListado(Type tipo, string args)
        {
            object Res;

            if (args == null || args == string.Empty)
            {
                Res = Activator.CreateInstance(tipo);
            }
            else
            {
                Res = Activator.CreateInstance(tipo, args);
            }

            if (Res is Lazaro.Pres.Listings.Listing)
            {
                Lfc.FormularioListado NewForm = new Lfc.FormularioListado(Res as Lazaro.Pres.Listings.Listing);
                return(NewForm);
            }
            else
            {
                return(Res as Lfc.FormularioListado);
            }
        }
Exemple #4
0
        public static Lfc.FormularioListado InstanciarFormularioListado(Type tipo, string args)
        {
            Log.Info("Instanciando " + tipo.FullName);

            object Res;

            if (args == null || args == string.Empty)
            {
                Res = Activator.CreateInstance(tipo);
            }
            else
            {
                var ConstructorQueAceptaUnString = tipo.GetConstructor(new Type[] { typeof(string) });
                if (ConstructorQueAceptaUnString == null)
                {
                    // No tiene un constructor que acepta un parámetro string, llamo al constructor sin parámetros
                    Res = Activator.CreateInstance(tipo);
                }
                else
                {
                    // Sí tiene un constructor que acepta un parámetro string, le paso el parámetro
                    Res = Activator.CreateInstance(tipo, args);
                }
            }

            if (Res is Lazaro.Pres.Listings.Listing)
            {
                Log.Info("Devolvió Lazaro.Pres.Listings.Listing, creando un formulario para contenerlo");
                Lfc.FormularioListado NewForm = new Lfc.FormularioListado(Res as Lazaro.Pres.Listings.Listing);
                return(NewForm);
            }
            else
            {
                Log.Info("Devolvió " + Res.GetType().FullName + ", que deriva de " + Res.GetType().BaseType.FullName);
                return(Res as Lfc.FormularioListado);
            }
        }