Ejemplo n.º 1
0
        /// <summary>
        /// 保存到数据库
        /// </summary>
        public void Save()
        {
            var data = GetAllData();
            var ass  = new OilDataAccess();

            OilBll.updateTables2(data);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int num = Convert.ToInt32(txbNum1.Text);
            int rep = Convert.ToInt32(txbRep1.Text);
            
            
            this.button1.Text = "Working";
            this.button1.Enabled = false;
            ThreadStart start2 = () =>
            {
                double[] r = new double[rep];
                for (int k = 0; k < rep; k++)
                {
                    var oo = new OilDataAccess();
                    DateTime dt = DateTime.Now;
                    var a = oo.Get("1=1", num, " id desc");
                    r[k] = (DateTime.Now - dt).TotalMilliseconds;
                }

                for (int k = 0; k < rep; k++)
                {
                    this.richTextBox1.AppendText(string.Format("读取 {0} 条, 第 {2} 次花费 {1} ms \n", num, r[k], k + 1));
                }
                this.button1.Text = "Run";
                this.button1.Enabled = true;
                this.richTextBox1.AppendText("\n");
            };
            this.Invoke(start2);
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OilDataAccess access = new OilDataAccess();

            int num = Convert.ToInt32(txbNum1.Text);
            int rep = Convert.ToInt32(txbRep1.Text);

            //先搞一条原油数据
            OilInfoAccess oc  = new OilInfoAccess();
            var           oil = new OilInfoEntity()
            {
                crudeIndex = DateTime.Now.ToString("yyyyMMddHHmmss"),
                crudeName  = DateTime.Now.ToString("yyyyMMddHHmmss")
            };

            oil.ID               = oc.Insert(oil);
            this.button1.Text    = "Working";
            this.button1.Enabled = false;
            ThreadStart start2 = () =>
            {
                double[] r = new double[rep];
                for (int k = 0; k < rep; k++)
                {
                    DateTime dt = DateTime.Now;
                    for (int i = 0; i < num; i++)
                    {
                        var item = new OilDataEntity()
                        {
                            calData       = i.ToString(),
                            labData       = i.ToString(),
                            oilInfoID     = oil.ID,
                            oilTableColID = i,
                            oilTableRowID = i
                        };
                        access.Insert(item);
                    }
                    r[k] = (DateTime.Now - dt).TotalMilliseconds;
                }

                for (int k = 0; k < rep; k++)
                {
                    this.richTextBox1.AppendText(string.Format("插入 {0} 条, 第 {2} 次花费 {1} ms \n", num, r[k], k + 1));
                }
                this.button1.Text    = "Run";
                this.button1.Enabled = true;
                this.richTextBox1.AppendText("\n");
            };

            this.Invoke(start2);
        }