Пример #1
0
        public ClienteMunicipio()
        {
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
            this.Datos = de.GetDataTableModelEmpty(this);
        }
Пример #2
0
        private static async Task <int> OutputRows(string baseUrl, string dataViewName, string username, string password, string systemName, string queryFilePath, List <string> variableNames)
        {
            using (LoggingHandler loggingHandler = new LoggingHandler())
            {
                ILogger <Program> logger = loggingHandler.CreateLogger <Program>();

                ApiConnectorFactory connectorFactory = new ApiConnectorFactory(baseUrl);
                LoginService        loginService     = new LoginService(connectorFactory, dataViewName);

                SessionDetails sessionDetails = await loginService.Login(username, password);

                if (sessionDetails == null)
                {
                    logger.LogError($"Couldn't log in to data view {dataViewName} as user {username}");
                    return(-1);
                }

                try
                {
                    DataExplorer dataExplorer = new DataExplorer(connectorFactory, dataViewName, loggingHandler.CreateLogger <DataExplorer>());
                    bool         success      = await dataExplorer.TryShowRowsForQuery(sessionDetails, systemName, queryFilePath, variableNames, 100, System.Console.Out);

                    return(success ? 0 : -1);
                }
                finally
                {
                    await loginService.Logout(sessionDetails);
                }
            }
        }
Пример #3
0
        public Persona(Usuario User)
        {
            base.User = User;
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
        }
Пример #4
0
 public Camiones(Usuario Usr)
 {
     base.User = Usr;
     DataExplorer de = new DataExplorer();
     this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
     this.Datos = de.GetDataTableModelEmpty(this);
 }
Пример #5
0
        public Usuario()
        {
            Rol = new Rol(this);
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
        }
        public void can_generate_widget()
        {
            var data = new[]
            {
                new { Name = "Q", IsValid = false, Cost = 10.0 },
                new { Name = "U", IsValid = false, Cost = 5.0 },
                new { Name = "E", IsValid = true, Cost = 10.0 },
                new { Name = "S", IsValid = false, Cost = 10.0 },
                new { Name = "T", IsValid = false, Cost = 10.0 }
            };

            var explorer = new DataExplorer(data);

            var formatted = explorer.ToDisplayString(HtmlFormatter.MimeType);

            var htmlDoc = new HtmlDocument();

            htmlDoc.LoadHtml(formatted);

            var scripts = htmlDoc.DocumentNode.SelectNodes("//div/script").Single();

            using var _ = new AssertionScope();
            scripts.InnerText.Should().Contain(data.ToTabularData().ToString());

            scripts.InnerText.Should().Contain("getExtensionRequire('nteract','1.0.0')(['nteract/lib'], (nteract) => {");
        }
Пример #7
0
        ///// <summary>
        ///// Nombre del elemento. (Ej.: ModuloEnrolamientoEmpleado, SubirDocumento,
        ///// EliminarUsuario, etc.)
        ///// </summary>
        //public string Nombre;
        ///// <summary>
        ///// Descripción del elemento
        ///// </summary>
        //public string Descripcion;

        public SecAccion(Usuario usr)
        {
            base.User = usr;
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
        }
Пример #8
0
        public FleetUpRecordVehPasoGeoCerca(Usuario Usr)
        {
            base.User = Usr;
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
            this.Datos = de.GetDataTableModelEmpty(this);
        }
Пример #9
0
        public void when_there_is_single_DataExplorer_return_it_as_default()
        {
            DataExplorer <string> .Register <StringDataExplorer>();

            var dataExplorer = DataExplorer.CreateDefault("hello world");

            dataExplorer.Should().BeOfType <StringDataExplorer>();
        }
Пример #10
0
        public Usuario(Usuario User)
        {
            base.User = User;
            Rol       = new Rol(this);
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
        }
Пример #11
0
        public void can_create_specific_DataExplorer_for_a_data_type()
        {
            DataExplorer <string> .Register <StringDataExplorer>();

            DataExplorer <string> .Register <AdvancedStringDataExplorer>();

            var dataExplorer = DataExplorer.Create("AdvancedStringDataExplorer", "hello world");

            dataExplorer.Should().BeOfType <AdvancedStringDataExplorer>();
        }
Пример #12
0
        public void can_specify_default_DataExplorer_for_a_data_type()
        {
            DataExplorer <string> .Register <StringDataExplorer>();

            DataExplorer <string> .Register <AdvancedStringDataExplorer>();

            DataExplorer.SetDefault <string, AdvancedStringDataExplorer>();
            var dataExplorer = DataExplorer.CreateDefault("hello world");

            dataExplorer.Should().BeOfType <AdvancedStringDataExplorer>();
        }
Пример #13
0
        private async void ORMTestClick(object sender, EventArgs e)
        {
            var list = new DataExplorer();

            dock.Put(list);

            await Task.Run(() =>
            {
                var schema        = DBSchema.Generate(typeof(User).Assembly, "common_data");
                schema.Connection = new DBConnection
                {
                    Name     = "test.common",
                    System   = DBSystem.SQLite,
                    DataBase = "test.common.sqlite"
                };
                schema.DropDatabase();
                schema.CreateDatabase();
            }).ConfigureAwait(false);
        }
        public void it_emits_html_fragment()
        {
            SandDanceExtensions.RegisterFormatters();
            var explorer = new DataExplorer(() => new[] {
                new { a = 12, b = new DateTime(1977, 2, 12) },
                new { a = 14, b = new DateTime(1977, 2, 13) },
                new { a = 16, b = new DateTime(1977, 2, 14) }
            });

            var formatted = explorer.ToDisplayString(HtmlFormatter.MimeType);

            var htmlDoc = new HtmlDocument();

            htmlDoc.LoadHtml(formatted);

            var scripts = htmlDoc.DocumentNode.SelectNodes("//div/script");

            scripts.Count.Should().Be(1);
        }
        private static string GenerateHtml(DataExplorer explorer)
        {
            var divId = Guid.NewGuid().ToString("N");
            var data  = explorer.GetData().SerializeToJson();
            var code  = new StringBuilder();

            code.AppendLine("<div>");
            code.AppendLine($"<div id=\"{divId}\" style=\"height: 100ch ;margin: 2px;\">");
            code.AppendLine("</div>");
            code.AppendLine(@"<script type=""text/javascript"">
dotnetInteractiveExtensionsRequire('dotnet-interactive-extensions/sanddance/lib', (interactiveSandDance) => {");
            code.AppendLine($@" let viewer = interactiveSandDance.createSandDance(document.getElementById(""{divId}""), ""explorer"");");
            code.AppendLine($@" viewer.loadData({data});
}});");
            code.AppendLine(" </script>");

            code.AppendLine("</div>");


            return(code.ToString());
        }
Пример #16
0
        internal static HtmlString GenerateHtml(this DataExplorer dataExplorer)
        {
            var divId = Guid.NewGuid().ToString("N");
            var data  = dataExplorer.Data.ToTabularData().ToString();
            var code  = new StringBuilder();

            code.AppendLine("<div>");
            code.AppendLine($"<div id=\"{divId}\" style=\"height: 100ch ;margin: 2px;\">");
            code.AppendLine("</div>");
            code.AppendLine(@"<script type=""text/javascript"">
getExtensionRequire('nteract','1.0.0')(['nteract/lib'], (nteract) => {");
            code.AppendLine($@" let data = {data};");
            code.AppendLine($@" let viewer = nteract.createDataExplorer({{
        data: data,
        container: document.getElementById(""{divId}"")
    }});
}},
(error) => {{ 
    console.log(error); 
}});");
            code.AppendLine(" </script>");
            code.AppendLine("</div>");
            return(new HtmlString(code.ToString()));
        }
 public void Dispose()
 {
     DataExplorer.ResetToDefault();
     Formatter.ResetToDefault();
 }
Пример #18
0
 /// <summary>
 /// Display the formatted DataExplorer.
 /// </summary>
 /// <param name="explorer">The DataExplorer to display.</param>
 /// <returns>An instance of <see cref="DisplayedValue"/> that can be used to later update the display.</returns>
 public static DisplayedValue Display<TData>(this DataExplorer<TData> explorer)
 {
     return explorer.Display(HtmlFormatter.MimeType);
 }
Пример #19
0
        public Persona()
        {
            DataExplorer de = new DataExplorer();

            this.DREntity.ItemArray = de.InitDataRow(this).ItemArray;
        }