//private decimal _messageid = 0;
 //private decimal messageid { get { return _messageid; } set { _messageid = value; } }
 //private static decimal messageid = 0;
 public mLocatingConvert()
 {
     localdb.CommandTimeout = 0;
     _ciType = new ciType(false);
     _imeiTypeClass = new imeiTypeClass(false);
     _uriType = new uriType();
     _portType = new portType();
     _responseType = new responseType();
     _protocolType = new protocolType();
     _ipType = new ipType();
     //--删除
     //alter   table   你的表   drop   constraint   主键名
 }
Пример #2
0
        private void BulkExcute()
        {
            if (!ls.bRegOK) return;

            try
            {
                using (DataClasses1DataContext mess = new DataClasses1DataContext(streamType.LocalConnString))
                {
                    minFileNum = mess.IP_stream.Min(e => e.FileNum).Value;
                    maxFileNum = mess.IP_stream.Max(e => e.FileNum).Value + 1;
                }
                // MessageBox.Show(minFileNum.ToString() + "  -   " + maxFileNum.ToString());
                //DualTests dt = new DualTests();
                //dt.Show(); dt.Focus();
                dualTests1.Location = new Point(this.Width / 10, this.Height / 3);
                dualTests1.Show();
                dualTests1.Focus();

                handleTable h = new handleTable();
                toolStripStatusLabel1.Text = h.AlterPrimaryKey();

                //case"InitImeiCiTypeTable":
                //toolStripStatusLabel1.Text = h.InitImeiCiTypeTable();

                //case"InitMlocationTable":
                //toolStripStatusLabel1.Text = h.InitMlocationTable();

                //case"InsertImeiType":
                toolStripStatusLabel2.Text = "imei......";
                Application.DoEvents();
                imeiTypeClass _imeiTypeClass = new imeiTypeClass(true);
                Parallel.For(minFileNum, maxFileNum, i => { _imeiTypeClass.InsertImeiType(_imeiTypeClass, i); });
                Thread.Sleep(1); GC.Collect(); GC.Collect(); Application.DoEvents();
                dualTests1.Focus();

                //case"InsertCiType":
                toolStripStatusLabel2.Text = "ci......";
                Application.DoEvents();
                ciType _ciType = new ciType(true);
                Parallel.For(minFileNum, maxFileNum, i => { _ciType.InsertCiType(_ciType, i); });
                Thread.Sleep(1); GC.Collect(); GC.Collect(); Application.DoEvents();
                dualTests1.Focus();

                //case"UpdateImeiType":
                toolStripStatusLabel2.Text = "imei update......";
                Application.DoEvents();
                imeiTypeClass _imeiTypeClass_false = new imeiTypeClass(false);
                Task t2 = new Task(() => { _imeiTypeClass_false.UpdateImeiType(); }); t2.Start();
                Thread.Sleep(1); GC.Collect(); GC.Collect(); Application.DoEvents();
                dualTests1.Focus();

                //case"InsertResultTable":
                toolStripStatusLabel2.Text = "locating......";
                Application.DoEvents();
                mLocatingConvert ml = new mLocatingConvert();
                Parallel.For(minFileNum, maxFileNum, i => { ml.SendOrders(ml, i); });
                Thread.Sleep(1); GC.Collect(); GC.Collect(); Application.DoEvents();
                dualTests1.Focus();

                dualTests1.Hide();
                //dualTests1.Dispose();
                using (DataClasses1DataContext mess = new DataClasses1DataContext(streamType.LocalConnString))
                {
                    mess.CommandTimeout = 0;
                    string a=mess.mLocatingType.Max(e => e.mLocatingType_id).ToString();
                    string b = mess.IP_stream.Sum(e => e.IPstream).Value.ToString();
                    toolStripStatusLabel2.Text = "complete......"+ a + "/" + b;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #3
0
 public void InsertCiType(ciType _ciType, int filenum)
 {
     //Stopwatch sw = new Stopwatch();
     //sw.Start();
     using (SqlConnection con = new SqlConnection(streamType.LocalConnString))
     {
         con.Open();
         using (SqlTransaction tran = con.BeginTransaction())
         {
             var newOrders = _ciType.GetCiTypeCollection(filenum);
             SqlBulkCopy bc = new SqlBulkCopy(con,
               //SqlBulkCopyOptions.CheckConstraints |
               //SqlBulkCopyOptions.FireTriggers |
               SqlBulkCopyOptions.KeepNulls, tran);
             bc.BulkCopyTimeout = 36000;
             bc.BatchSize = 1000;
             bc.DestinationTableName = "ciBVCI";
             bc.WriteToServer(newOrders.AsDataReader());
             tran.Commit();
         }
         con.Close();
     }
     //Thread.Sleep(1); GC.Collect(); GC.Collect(); Application.DoEvents();
     //sw.Stop();
     //MessageBox.Show(sw.Elapsed.TotalSeconds.ToString());
 }