Пример #1
0
        public void Insert()
        {
            for (int i = 1; i <= this.TotalBatch; i++)
            {
                currencyService.BatchSave_Info(this.Value);

                this.RealInsertCurrencyCount += this.BatchCount;

                DataCounter.AddCurrency(this.BatchCount);
            }
        }
Пример #2
0
        private void btnInit_Click(object sender, EventArgs e)
        {
            this.btnInit.Enabled        = false;
            this.btnStartInsert.Enabled = true;

            this.txtClientCount.Enabled        = false;
            this.txtCurrencyCount.Enabled      = false;
            this.txtDay.Enabled                = false;
            this.txtBatchCount.Enabled         = false;
            this.cbInsertCurrencyImage.Enabled = false;

            int  clientCount           = this.txtClientCount.Text.Trim().ToInt();
            int  currencyCount         = this.txtCurrencyCount.Text.Trim().ToInt();
            int  day                   = this.txtDay.Text.Trim().ToInt();
            int  batchCount            = this.txtBatchCount.Text.Trim().ToInt();
            bool isInsertCurrencyImage = this.cbInsertCurrencyImage.Checked;

            this.TargetCurrencyCount = clientCount * currencyCount * day;

            SourceData.Create(isInsertCurrencyImage);
            DataCounter.Reset();

            this.LastSecondCount = 0;
            this.MaxSecondCount  = 0;

            this.BatcherList = new List <Batcher>();

            Task.Factory.StartNew(() =>
            {
                for (int i = 0; i < clientCount; i++)
                {
                    Batcher client = new Batcher(batchCount, currencyCount * day);

                    this.BatcherList.Add(client);

                    this.BeginInvoke(new EventHandler((a, b) =>
                                                      { this.lblRealClientCount.Text = this.BatcherList.Count.ToString(); })).AsyncWaitHandle.WaitOne(10);
                }
            });
        }
Пример #3
0
        public void Insert()
        {
            this.CurrentBatch = 1;

            for (; this.CurrentBatch <= this.TotalBatch; this.CurrentBatch += 1)
            {
                if (this.CurrentBatch == this.HourBatch * 0 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 1 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 2 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 10, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 3 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 4 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 12, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 5 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 6 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 14, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 7 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 15, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 8 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 9 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 10 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 18, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                if (this.CurrentBatch == this.HourBatch * 11 + 1)
                {
                    DateTime nowTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, DateTime.Now.Minute, DateTime.Now.Second);

                    this.UpdateInesrtData(nowTime);
                }

                currencyService.BatchSave_Info(this.Value);

                this.RealInsertCurrencyCount += this.BatchCount;

                DataCounter.AddCurrency(this.BatchCount);
            }
        }
Пример #4
0
 static DataCounter()
 {
     DataCounter.Reset();
 }