private void navBarItem27_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
        {
            string msfc_msg = "BSSGP.FLOW-CONTROL-MS";
            string fc_msg = "BSSGP.FLOW-CONTROL-BVC";
            //分组
            FlowControlOneBvc fcob = new FlowControlOneBvc();

               var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell != null).AsParallel().ToList();

            //var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell != null).AsParallel().AsEnumerable();

            var query = from p in fcobmongo
                        group p by p.lac_cell into ttt
                        select new FlowControlMapBvc
                        {
                            _id = GenerateId(),
                            lac_cell = ttt.Key,
                            //lac_cell = ttt.Key.lac_cell,
                            //bvci=ttt.Key.bvci,
                            fcb_cnt = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Count(),
                            packet_cnt = ttt.Count(),
                            tlli_cnt = ttt.Select(e => e.tlli).Distinct().Count(),

                            bssgp_R_default_ms = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_R_default_ms),
                            bssgp_ms_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_ms_bucket_size),
                            //bssgp_bvc_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bvc_bucket_size),
                            //bssgp_bucket_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bucket_leak_rate),
                            bssgp_bucket_full_ratio = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bucket_full_ratio),
                            bssgp_bmax_default_ms = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bmax_default_ms),

                            //用户级别
                            ms_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == msfc_msg).Where(e => e.bssgp_ms_bucket_size > 0).Average(e => e.bssgp_ms_bucket_size),
                            ms_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == msfc_msg).Where(e => e.bssgp_bucket_leak_rate > 0).Average(e => e.bssgp_bucket_leak_rate),

                            fcb_delay_aggre = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).OrderBy(e => e._id)
                                                .Select(e => new { fd = (e.Flow_Control_time - ttt.Min(f => f.Flow_Control_time)).TotalMilliseconds })
                                                .Select(e => (e.fd / 1000).ToString("f1"))
                                                .Aggregate((a, b) => a + "," + b),

                            bssgp_bucket_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == fc_msg)
                            .OrderBy(e => e._id)
                                            .Select(e => (e.bssgp_bucket_leak_rate).ToString("f1"))
                                            .Aggregate((a, b) => a + "," + b),

                            bssgp_bvc_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg)
                            .OrderBy(e => e._id)
                                             .Select(e => (e.bssgp_bvc_bucket_size).ToString("f1"))
                                             .Aggregate((a, b) => a + "," + b),

                            ////用扩展方法实现, 在fc消息之间进行ip.len的累加
                            tlli_distinct_aggre = ttt.Select(e => e.tlli).Distinct().Aggregate((a, b) => a + "," + b),

                            msg_distinct_aggre = ttt.Select(e => e.Flow_Control_MsgType).Distinct().Aggregate((a, b) => a + "," + b),

                            down_total_len = ttt.OrderBy(e => e._id)
                            .AggregateSum(e => (int)e.ip_len, e => e.Flow_Control_MsgType, fc_msg),

                            down_packet_rate = ttt.OrderBy(e => e._id)
                            .AggregatePacketRate(e => (int)e.ip_len, e => e.Flow_Control_time, e => e.Flow_Control_MsgType, fc_msg),

                            fcb_time_aggre = ttt.OrderBy(e => e._id)
                            .AggregatePacketTime(e => e.Flow_Control_time, e => e.Flow_Control_MsgType, fc_msg),
                        };

            FlowControlMapBvc fcmb = new FlowControlMapBvc();
            fcmb.BulkMongo(query.ToList());
            MessageBox.Show("OK");
        }
 private void navBarItem29_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
 {
     clearColumns();
     FlowControlOneBvc fcob = new FlowControlOneBvc();
     var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell == textBox8.Text).AsParallel().ToList();
     var query = from p in fcobmongo
                 group p by p.Flow_Control_MsgType into ttt
                 select new
                 {
                     ttt.Key,
                     cnt = ttt.Count(),
                 };
     gridControl1.DataSource = query.OrderByDescending(e => e.cnt).AsParallel().ToList();
     gridView1.OptionsView.ColumnAutoWidth = true;
 }
        private void navBarItem25_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
        {
            FlowControlOneBvc fcob = new FlowControlOneBvc();
            var query = from p in fcob.QueryMongo()
                        select new
                            {
                                p._id,
                                p.Flow_Control_time,
                                p.lac_cell,
                                p.Flow_Control_MsgType,
                                p.bssgp_direction,
                                p.ip_len,
                                p.bssgp_bmax_default_ms,
                                p.bssgp_bucket_full_ratio,
                                p.bssgp_bucket_leak_rate,
                                p.bssgp_bvc_bucket_size,
                                p.bssgp_ms_bucket_size,
                                p.bssgp_R_default_ms,

                            };

            clearColumns();
            var dborder = query.Take(1000);
            gridControl1.DataSource = dborder.AsParallel().ToList();
            gridView1.OptionsView.ColumnAutoWidth = true;
        }