Exemple #1
0
        // generates data
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            int cnt;

            if (int.TryParse(cbItemsCount.Text.Replace(",", ""), out cnt))
            {
                gbQuery.Enabled = false;

                // remove previously generated data
                workspace.Clear();

                // generate table
                Utils.Products.Generate(workspace, 77, 500, 500);
                Utils.OrderDetails.Generate(workspace, cnt, 0, (int)workspace.GetTableData(Utils.Products.Name).Size, 50, 100, 10);
                Utils.Orders.Generate(workspace, cnt, DateTime.Now.Subtract(new TimeSpan(170, 0, 0, 0)), DateTime.Now, 2, 14);

                // update controls
                RefreshControls();
                ExecuteQuery();
                gbQuery.Enabled = true;
            }
        }
Exemple #2
0
        // generate data
        private void Generate()
        {
            int cnt;

            if (int.TryParse(cbItemsCount.Text.Replace(",", ""), out cnt))
            {
                gbQuery.Enabled = false;

                // remove previously generated data
                workspace.Clear();

                // generate table
                DateTime start = DateTime.Now;
                Utils.Products.Generate(workspace, cbQuery.SelectedIndex > 1 ? 4 : 77, 500, 500);
                Utils.OrderDetails.Generate(workspace, cnt, 0, (int)workspace.GetTableData(Utils.Products.Name).Size, 50, 10000, 10);
                Utils.Orders.Generate(workspace, cnt, DateTime.Now.Subtract(new TimeSpan(170, 0, 0, 0)), DateTime.Now, 2, 14);
                double sec = DateTime.Now.Subtract(start).TotalSeconds;
                lblTimeGen.Text = string.Format("Time generating data: {0:n2} sec.", sec);

                // update controls
                RefreshControls();
                gbQuery.Enabled = true;
            }
        }