static void Main(string[] args)
        {
            Workspace workspace = Northwind.Invoice.GetWorkspace();
            IDataList results   = workspace.GetQueryData("SalesByEmployeeCountry");

            DataList.Write(results, Console.Out);
        }
Ejemplo n.º 2
0
        public UseCaseUpdateTask(IAppConfig appConfig, IDataList<UseCase> useCases)
        {
            var url = new MongoUrl(appConfig.ProxyDbConnectionString);
            _db = new MongoClient(url).GetServer().GetDatabase(url.DatabaseName);

            _useCases = useCases;
        }
Ejemplo n.º 3
0
        // updates min and max values of the price range
        private void RefreshMinMaxUnitPriceRange()
        {
            if (workspace.GetTableData(Utils.OrderDetails.Name) == null)
            {
                return;
            }

            // aggregate min and max price in the OrderDetails table
            dynamic od  = workspace.table(Utils.OrderDetails.Name);
            dynamic qod = workspace.query("query_order_details", new
            {
                maxPrice = Op.Max(od.UnitPrice),
                minPrice = Op.Min(od.UnitPrice)
            });
            IDataList list = qod.Query.Execute();

            if (list == null || list.Size != 1)
            {
                return;
            }

            // read aggregated values
            var    item = list.GetItem(0);
            double max  = item.GetDouble(item.GetOrdinal(qod.maxPrice.Name));
            double min  = item.GetDouble(item.GetOrdinal(qod.minPrice.Name));

            // set bound values in the controls
            this.nudUnitPriceFrom.ValueChanged -= new System.EventHandler(this.nudUnitPriceFrom_ValueChanged);
            nudUnitPriceFrom.Minimum            = (decimal)min;
            nudUnitPriceFrom.Maximum            = (decimal)max;
            nudUnitPriceTo.Minimum              = (decimal)min;
            nudUnitPriceTo.Maximum              = (decimal)max;
            this.nudUnitPriceFrom.ValueChanged += new System.EventHandler(this.nudUnitPriceFrom_ValueChanged);
        }
Ejemplo n.º 4
0
        // executes the selected query
        private void ExecuteQuery()
        {
            tabControl1.SelectedIndex = 1;
            Application.DoEvents();
            DateTime  start = DateTime.Now;
            IDataList res   = null;

            if (cbQuery.SelectedIndex == 0)
            {
                res = QueryProductDiscount();
            }
            else if (cbQuery.SelectedIndex == 1)
            {
                res = QueryProductCustomDiscount();
            }
            else if (cbQuery.SelectedIndex == 2)
            {
                res = QueryBigOrders();
            }
            else if (cbQuery.SelectedIndex == 3)
            {
                res = QueryOrdersCount();
            }
            double sec = DateTime.Now.Subtract(start).TotalSeconds;

            lblTime.Text = string.Format("Time executing query: {0:n2} sec.", sec);
            FillGrid(dgvResult, res);
        }
        public async Task <JsonResult> OnGetAsync(string name, string sort)
        {
            JsonResult results = null;

            await Task.Run(() => {
                if (Program.Workspace.QueryExists(name))
                {
                    string className = name + DateTime.Now.Ticks.ToString();
                    IDataList test   = Program.Workspace.GetQueryData(name);
                    if (!string.IsNullOrEmpty(sort))
                    {
                        var sorts = sort.Split(',');
                        for (int i = 0; i < sorts.Length; i++)
                        {
                            string field   = sorts[i];
                            bool ascend    = field[0] == '+';
                            string[] parts = field.Substring(1).Split('.');
                            string prop    = parts[parts.Length - 1];
                            DataList.Sort(test, prop, ascend);
                        }
                    }
                    var list = ClassFactory.CreateFromDataList(test, className);
                    results  = new JsonResult(list);
                }
            });

            return(results ?? new JsonResult(null));
        }
        static void Main(string[] args)
        {
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
            Workspace workspace = Northwind.Invoice.GetWorkspace();
            IDataList results   = workspace.GetQueryData("SalesByEmployeeCountry");

            DataList.Write(results, Console.Out);
            Console.ReadKey();
        }
Ejemplo n.º 7
0
        public UseCaseUpdateTask(IConfig config, IDataList<UseCase> useCases)
        {
            var url = new MongoUrl(config.ProxyDbConnectionString);
            var db = new MongoClient(url)
                .GetServer()
                .GetDatabase(url.DatabaseName);

            _collection = db.GetCollection<UseCase>("UseCase");
            _useCases = useCases;
        }
        public Form1()
        {
            InitializeComponent();
            ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;

            Workspace workspace = Northwind.Invoice.GetWorkspace();
            IDataList results   = workspace.GetQueryData("SalesByEmployeeCountry");

            dataGridView1.DataSource = results;
        }
Ejemplo n.º 9
0
 public Articulation(
     ArticulationName articulationName,
     IDataList <IMidiMessage> midiNoteOns,
     IDataList <IMidiMessage> midiControlChanges,
     IDataList <IMidiMessage> midiProgramChanges,
     ExtraData extraData)
 {
     ArticulationName   = articulationName;
     MidiNoteOns        = midiNoteOns;
     MidiControlChanges = midiControlChanges;
     MidiProgramChanges = midiProgramChanges;
     ExtraData          = extraData;
 }
Ejemplo n.º 10
0
        public Form1()
        {
            InitializeComponent();

            DataGridView grid = new DataGridView();

            Controls.Add(grid);
            grid.Dock = DockStyle.Fill;

            Workspace workspace = Northwind.Invoice.GetWorkspace();
            IDataList results   = workspace.GetQueryData("SalesByEmployeeCountry");

            grid.DataSource = results;
        }
Ejemplo n.º 11
0
        // fills product list box with values from the Product table
        private void RefreshProductsList()
        {
            cbProduct.Items.Clear();
            IDataList col = workspace.GetTableData(Utils.Products.Name);

            if (col == null)
            {
                return;
            }

            for (long i = 0; i < col.Size; i++)
            {
                cbProduct.Items.Add(string.Format("Product #{0}", i));
            }
            cbProduct.SelectedIndex = 0;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Adds a single dimension array data to the cluster
        /// </summary>
        /// <param name="data">A 1-dimensional array containing data that will be added to the cluster</param>
        public virtual void Add(IDataList data)
        {
            this.List.Add(data);

            if (this.List.Count == 1)
            {
                this._clusterSum = new double[data.Data.Length];

                this._clusterMean = new double[data.Data.Length];
            }

            for (int count = 0; count < data.Data.Length; count++)
            {
                this._clusterSum[count] = this._clusterSum[count] + data.Data[count];
            }
        }
Ejemplo n.º 13
0
        // fills the grid with data
        private void FillGrid(C1.Win.C1FlexGrid.C1FlexGrid grid, IDataList source)
        {
            lblResultTotalRows.Text = "0";
            grid.DataSource         = source;
            long count = 0;

            if (source != null)
            {
                count = source.Size;
                // update column names and format using data schema
                var cols = source.GetSchemaTable().Rows;
                for (int i = 1; i < cols.Count; i++)
                {
                    grid.Cols[i + 1].Caption = (string)cols[i]["caption"];
                    Type type = System.Type.GetType((string)cols[i]["type"]);
                    if (IsFloat(type))
                    {
                        grid.Cols[i + 1].Style.Format = "n2";
                    }
                }
            }
            Label lbl = null;

            if (grid == dgvResult)
            {
                lbl = lblResultTotalRows;
            }
            else if (grid == dgvOrderDetails)
            {
                lbl = lblODRowsTotal;
            }
            else if (grid == dgvProducts)
            {
                lbl = lblProductsRowsTotal;
            }
            else if (grid == dgvOrders)
            {
                lbl = lblOrdersTotalRows;
            }
            if (lbl != null)
            {
                lbl.Text = string.Format("{0:n0}", count);
            }
        }
Ejemplo n.º 14
0
    private void InitScriptableObjects(TableProcessInfo _tableInfo)
    {
        if (asm == null)
        {
            asm = Assembly.Load("Assembly-CSharp");
        }

        //---
        ScriptableObject oTable
            = EditorHelper.CreateNewEditorProfile <ScriptableObject>(_tableInfo.ouput_asset_name + ".asset",
                                                                     mStrTableAssetFolder,
                                                                     _tableInfo.table_class_name);

        if (oTable == null)
        {
            return;
        }

        ////---
        System.Type tData = asm.GetType(_tableInfo.data_class_name);

        foreach (KeyValuePair <int, Dictionary <int, string> > pair in mDicExcelData)
        {
            System.Object oData = System.Activator.CreateInstance(tData);
            foreach (KeyValuePair <int, string> rowPair in pair.Value)
            {
                object    param = EditorHelper.GetTableValue(mDicExeclTitles[rowPair.Key].strArrValueType, rowPair.Value);
                FieldInfo mInfo = tData.GetField(mDicExeclTitles[rowPair.Key].strArrValueNamesEN, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
                if (mInfo != null)
                {
                    //Debug.Log(mDicExeclTitles[rowPair.Key].strArrValueNamesEN + " = " + param);
                    mInfo.SetValue(oData, param);
                }
            }

            IDataList lst = oTable as IDataList;
            if (lst != null)
            {
                lst.AddDataObj(oData);
            }
        }
        EditorUtility.SetDirty(oTable);
        AssetDatabase.SaveAssets();
    }
        public void OnGet()
        {
            IDataList species = Program.Workspace.GetQueryData("BySpecies");

            BySpecies = ClassFactory.CreateFromDataList(species, "BySpecies");

            IDataList years = Program.Workspace.GetQueryData("ByYear");

            ByYear = ClassFactory.CreateFromDataList(years, "ByYear");

            IDataList names = Program.Workspace.GetQueryData("DogNames", 10); // Limit results to 10 rows

            DataList.Sort(names, "Count", false);                             // Sort by Count in descending order
            DogNames = ClassFactory.CreateFromDataList(names);

            IDataList others = Program.Workspace.GetQueryData("OtherAnimals");

            OtherAnimals = ClassFactory.CreateFromDataList(others, "OtherAnimals");

            IDataList king = Program.Workspace.GetQueryData("KingCounty");

            KingCounty = ClassFactory.CreateFromDataList(king, "KingCounty");
        }
Ejemplo n.º 16
0
        // whether to require generating data
        private void CheckItemsCount()
        {
            IDataList colOd       = workspace.GetTableData(Utils.OrderDetails.Name);
            IDataList colProducts = workspace.GetTableData(Utils.Products.Name);
            IDataList colOrders   = workspace.GetTableData(Utils.Orders.Name);

            if (colOd != null && colProducts != null && colOrders != null)
            {
                lblItemsCount.Text = string.Format("{0:n0}", colOd.Size);
            }
            else
            {
                lblItemsCount.Text = "0";
                if (string.IsNullOrEmpty(cbItemsCount.Text))
                {
                    cbItemsCount.SelectedIndex = 0;
                }
            }
            bool hasItems = lblItemsCount.Text != "0";

            gbQuery.Enabled    = hasItems;
            lblWarning.Visible = !hasItems;
        }
Ejemplo n.º 17
0
 public KeySwitch(
     EntityGuid id,
     Author author,
     Description description,
     EntityDateTime created,
     EntityDateTime lastUpdated,
     DeveloperName developerName,
     ProductName productName,
     InstrumentName instrumentName,
     IDataList <Articulation> articulations,
     ExtraData extraData)
 {
     Id             = id;
     Author         = author;
     Description    = description;
     Created        = created;
     LastUpdated    = lastUpdated;
     DeveloperName  = developerName;
     ProductName    = productName;
     InstrumentName = instrumentName;
     Articulations  = articulations;
     ExtraData      = extraData;
 }
Ejemplo n.º 18
0
        // executes the selected query
        private void ExecuteQuery()
        {
            tabControl1.SelectedIndex = 3;
            Application.DoEvents();
            DateTime  start = DateTime.Now;
            IDataList res   = null;

            if (cbQuery.SelectedIndex == 0)
            {
                res = QueryJoin();
            }
            else if (cbQuery.SelectedIndex == 1)
            {
                res = QueryJoinWithFlexPivot();
            }
            else if (cbQuery.SelectedIndex == 2)
            {
                res = QueryProduct();
            }
            else if (cbQuery.SelectedIndex == 3)
            {
                res = QueryUnitPriceRange();
            }
            else if (cbQuery.SelectedIndex == 4)
            {
                res = QueryGroupRange();
            }
            else if (cbQuery.SelectedIndex == 5)
            {
                res = QueryMonth();
            }
            double sec = DateTime.Now.Subtract(start).TotalSeconds;

            lblTime.Text = string.Format("Time: {0:n2} sec.", sec);
            FillGrid(dgvResult, res);
        }
Ejemplo n.º 19
0
 public List(IDataList dataList)
 {
     _dataList = dataList;
 }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            // Create and initialize a new workspace folder relative to the project root
            Workspace workspace = new Workspace();

            workspace.KeepFiles = KeepFileType.Results;
            workspace.Init("workspace");

            // Uncomment the following line to clear the workspace before each run
            workspace.Clear();

            // Extract JSON data from a zip file, if not already done
            if (!File.Exists("seattle-pet-licenses.json") || !File.Exists("washington-zip-codes.json"))
            {
                ZipFile.ExtractToDirectory("data.zip", ".");
            }

            // Import the main license table
            if (!workspace.TableExists("PetLicenses"))
            {
                List <PetLicense>            collection = JsonConvert.DeserializeObject <List <PetLicense> >(File.ReadAllText("seattle-pet-licenses.json"));
                ObjectConnector <PetLicense> connector  = new ObjectConnector <PetLicense>(workspace, collection);
                connector.GetData("PetLicenses");
                workspace.Save();
                Console.WriteLine("{0:d} licenses imported.", collection.Count);
            }

            // Import the secondary location table
            if (!workspace.TableExists("Locations"))
            {
                List <Location>            collection = JsonConvert.DeserializeObject <List <Location> >(File.ReadAllText("washington-zip-codes.json"));
                ObjectConnector <Location> connector  = new ObjectConnector <Location>(workspace, collection);
                connector.GetData("Locations");
                workspace.Save();
                Console.WriteLine("{0:d} locations imported.", collection.Count);
            }

            // Retrieve the main table for use in constructing queries
            dynamic licenses = workspace.table("PetLicenses");

            // Number of licenses, by species
            if (!workspace.QueryExists("BySpecies"))
            {
                dynamic query = workspace.query("BySpecies", new {
                    licenses.Species,
                    Count = Op.Count(licenses.Species)
                });

                query.Query.Execute();
            }

            // Number of licenses, by calendar year
            if (!workspace.QueryExists("ByYear"))
            {
                // Create a query with all base table columns and add a Year field, extracted from the DateTime value
                dynamic parent = workspace.query(new {
                    _base = "*",
                    Year  = Op.DtPart(licenses.IssueDate, DateTimeParts.Year)
                });

                // Derive another query from the unnamed query above and perform the aggregation
                dynamic query = workspace.query("ByYear", new {
                    parent.Year,
                    Count = Op.Count(parent.Year)
                });

                query.Query.Execute();
            }

            // Most popular dog names (sort criteria and row limits are applied later)
            if (!workspace.QueryExists("DogNames"))
            {
                // Use the _range attribute to limit the results to dogs only
                dynamic query = workspace.query("DogNames", new {
                    _range  = licenses.Species.Eq("Dog"),
                    Species = licenses.Species,
                    DogName = licenses.AnimalName,
                    Count   = Op.Count(licenses.AnimalName)
                });

                query.Query.Execute();
            }

            // List names for all species except dogs and cats
            if (!workspace.QueryExists("OtherAnimals"))
            {
                // Create a query with specified base table columns and use the _filter attribute to limit the results
                // (_filter is used instead of _range because the latter does not support the Ne operator)
                dynamic parent = workspace.query(new {
                    _filter = licenses.Species.Ne("Dog").And().Ne("Cat"),
                    licenses.LicenseNumber,
                    licenses.Species,
                    licenses.AnimalName
                });

                // Derive another query from the unnamed query above and use First as the aggregation operator
                // (otherwise the query will not yield any results)
                dynamic query = workspace.query("OtherAnimals", new {
                    parent.LicenseNumber,
                    parent.Species,
                    AnimalName = Op.First(parent.AnimalName)
                });

                query.Query.Execute();
            }

            // Retrieve the secondary table for use in a join query
            dynamic locations = workspace.table("Locations");

            // Number of licenses in King County, by city
            if (!workspace.QueryExists("KingCounty"))
            {
                // Create a join from the main table (licenses) to the secondary table (locations)
                // * The addition expression to the left of the vertical bar denotes which secondary fields to include
                // * The equality expression to the right of the vertical bar specifies the join condition
                // * The assignment statement specifies a property of the anonymous type (its name is not significant)
                dynamic join = workspace.join(licenses, new {
                    locale = locations.County + locations.City | licenses.ZipCode == locations.Zip
                });

                // Derive another query from the join query above, specifying both a _range and an aggregation
                dynamic query = workspace.query("KingCounty", new {
                    _range = join.County.Eq("King"),
                    join.County,
                    join.City,
                    Count = Op.Count(join.LicenseNumber)
                });

                query.Query.Execute();
            }

            // Output query results in CSV format to the console
            IDataList species = workspace.GetQueryData("BySpecies");

            Console.WriteLine();
            Console.WriteLine("// Licenses issued, by species");
            DataList.Write(species, Console.Out);

            IDataList years = workspace.GetQueryData("ByYear");

            Console.WriteLine();
            Console.WriteLine("// Licenses issued, by year");
            DataList.Write(years, Console.Out);

            IDataList names = workspace.GetQueryData("DogNames", 10); // Limit results to 10 rows

            Console.WriteLine();
            Console.WriteLine("// Most popular dog names");
            DataList.Sort(names, "Count", false); // Sort by Count in descending order
            DataList.Write(names, Console.Out);

            IDataList others = workspace.GetQueryData("OtherAnimals");

            Console.WriteLine();
            Console.WriteLine("// Excluding dogs and cats");
            DataList.Write(others, Console.Out);

            IDataList cities = workspace.GetQueryData("KingCounty");

            Console.WriteLine();
            Console.WriteLine("// Licenses issued in King County, by city");
            DataList.Write(cities, Console.Out);
        }
Ejemplo n.º 21
0
    }                                                               // 0x008F8E10-0x008F9090

    public bool RenewalItemList(IDataList <IItem> list) => default; // 0x008F9160-0x008F98E0
Ejemplo n.º 22
0
    }                                 // 0x008F9C10-0x008F9C80

    // Methods
    public override void Init(GameObject objRoot, IDataList <IItem> list, int defaultItemIndex, bool bMultiSelect = true /* Metadata: 0x00612AFB */, List <IItem> ignoreList = null)
    {
    }                                                                                                                                                                                     // 0x008F89C0-0x008F8E00
Ejemplo n.º 23
0
    protected override bool _onYButton() => default;   // 0x008FE6F0-0x008FE720

    public void ReList(IDataList <IItem> list, int defaultItemIndex)
    {
    }                                                                      // 0x008F98E0-0x008F9940
Ejemplo n.º 24
0
    protected override bool _doRight() => default;    // 0x008FDF00-0x008FDF30

    public virtual void Init(GameObject objRoot, IDataList <IItem> list, int defaultItemIndex, bool bMultiSelect = true /* Metadata: 0x00612AFA */, List <IItem> ignoreList = null)
    {
    }                                                                                                                                                                                    // 0x008FDF30-0x008FE0E0
 public SearchStatistic(string key, IDataList <T> list)
 {
     this.list = list;
     Key       = key;
 }