Exemplo n.º 1
0
        /// <summary>
        /// Finds the specified instance node by the <see cref="ns"/> and  <see cref="name"/> instance configuration of the<see cref="DataSourceConfiguration"/> type.
        /// </summary>
        /// <param name="nameSpace">The namespace.</param>
        /// <param name="name">The name of the node.</param>
        /// <returns>Instance of <see cref="InstanceConfiguration"/> that provides configuration of the instance node.</returns>
        public InstanceConfiguration Find(string nameSpace, string name)
        {
            string key = String.Format(m_KeyFormat, nameSpace, name);

            if (this.ContainsKey(key))
            {
                TraceEvent.Tracer.TraceVerbose(54, this.GetType().Name + ".Find", String.Format("Key: {0} is found", key));
                return(this[key]);
            }
            else
            {
                TraceEvent.Tracer.TraceInformation(59, this.GetType().Name + ".Find", String.Format("Key: {0} is not found - Simulator Source is used instead", key));
                DataSourceConfiguration defDataSourceConfiguration = new DataSourceConfiguration()
                {
                    Name           = key,
                    SelectedSource = DataSourceConfiguration.Source.None,
                    SelectedSourceConfigurationBrowse = new DefaultSimulatorSourceConfiguration()
                    {
                        Selected = true,
                        Name     = key
                    }
                };
                return(new InstanceConfiguration(new DataSourceConfiguration[] { defDataSourceConfiguration }, nameSpace, name));
            }
        }
Exemplo n.º 2
0
        static DayFollower InitializeDayFollower(IDataProviderBase dataProvider)
        {
            string folderName       = ConfigurationManager.AppSettings.Get("FileFolder");
            string dayFollowingFile = ConfigurationManager.AppSettings.Get("DayCoveredFileName");

            IDataSourceConfiguration dataSourceConfiguration = new DataSourceConfiguration(new DataSourceFileConfiguration($"{folderName}\\{dayFollowingFile}"));

            dataSourceConfiguration.getDayFollowd = true;

            IDataProividerResultDayBase dayFollowed = (IDataProividerResultDayBase)dataProvider.GetData(dataSourceConfiguration);

            return(new DayFollower(dayFollowed.data, dataProvider, dataSourceConfiguration));
        }
Exemplo n.º 3
0
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As<JsObject>()["ProductID"].As<JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false

                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As<JsObject>()["CategoryID"].As<JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = Categories.As<JsArray>(),
                dataTextField = new JsArray<JsString> { "CategoryName", "ProductName", "OrderID" }.As<JsString>()
            });
        }
Exemplo n.º 4
0
 public static string GetEnvironment(this DataSourceConfiguration configuration, IHostingEnvironment hostingEnvironment)
 {
     return(string.IsNullOrWhiteSpace(configuration.Environment)
         ? hostingEnvironment.EnvironmentName
         : configuration.Environment);
 }
Exemplo n.º 5
0
 public static string GetDataSourceName(this DataSourceConfiguration configuration, IHostingEnvironment hostingEnvironment)
 {
     return(string.IsNullOrWhiteSpace(configuration.DataSourceName)
         ? hostingEnvironment.ApplicationName
         : configuration.DataSourceName);
 }
Exemplo n.º 6
0
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As <JsObject>()["ProductID"].As <JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false
                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type   = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children          = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As <JsObject>()["CategoryID"].As <JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id       = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = Categories.As <JsArray>(),
                dataTextField = new JsArray <JsString> {
                    "CategoryName", "ProductName", "OrderID"
                }.As <JsString>()
            });
        }