Пример #1
1
        /// <summary>
        /// 初始化(获取mongodb信息)
        /// </summary>
        public void Init()
        {
            this.treeView1.Nodes.Clear();
            connectionString = this.textBox_MongoUrl.Text;
            service = new MongoService(new MongoConnectionString(connectionString));
            //所有数据库
            var listDatabase = service.client.ListDatabases().ToList();
            foreach(BsonDocument dbDoc in listDatabase)
            {
                var dbName = dbDoc["name"].ToString();
                TreeNode dbNode = new TreeNode(dbName, 0, 0);
                dbNode.Tag = "database";

                var db = service.client.GetDatabase(dbName);
                //所有集合(可以理解为表)
                var listCollection = db.ListCollections().ToList();
                foreach (BsonDocument collDoc in listCollection)
                {
                    var collName = collDoc["name"].ToString();
                    TreeNode collNode = new TreeNode(collName,1,1);
                    collNode.Tag = "collection";
                    dbNode.Nodes.Add(collNode);
                }
                this.treeView1.Nodes.Add(dbNode);
            }
        }
Пример #2
0
 /// <summary>
 /// 测试
 /// </summary>
 public void Test()
 {
     try
     {
         MongoService mongo = new MongoService("Mongodb");
         Hashtable hs = new Hashtable();
         //插入单条
         ErrorLog log = new ErrorLog { Code = "2016001", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" };
         //mongo.Insert(log);
         //插入批量
         List<ErrorLog> insertData = new List<ErrorLog>();
         insertData.Add(new ErrorLog { Code = "2016002", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016003", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016004", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016005", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016006", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016007", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016008", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016009", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         insertData.Add(new ErrorLog { Code = "2016010", CreateTime = DateTime.Now.ToString(), Module = "ErrorLog", RequestData = "", ResponseData = "" });
         //mongo.Insert(insertData);
         //获取数据
         List<ErrorLog> list1 = mongo.List<ErrorLog>();
         //获取指定条件数据
         hs.Clear();
         hs.Add("Code", "2016009");
         List<ErrorLog> list2 = mongo.List<ErrorLog>(hs);
         //分布获取数据
         hs.Clear();
         PagingList<ErrorLog> list3 = mongo.PageList<ErrorLog>(hs, 1, 8, "CreateTime", true);
         //删除数据
         //mongo.Delete();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
 public ReportClienteController()
 {
     _mongoService = new MongoService();
 }
Пример #4
0
 public void Update()
 {
     MongoService <DriftBottleAnalyzeRecord> .Update(this);
 }
Пример #5
0
        private static KanColeGirlVoice GetRandVoiceInfo(string name)
        {
            var query = MongoService <KanColeGirlVoice> .Get(p => p.Name.Contains(name));

            return(query.IsNullOrEmpty() ? null : query.RandElement());
        }
Пример #6
0
        public static long RecentCmdsCount(int hour)
        {
            var startTime = DateTime.Now.AddHours(-hour);

            return(MongoService <CmdRec> .Count(p => p.Time >= startTime));
        }
Пример #7
0
 public void Insert()
 {
     MongoService <CmdRec> .Insert(this);
 }
Пример #8
0
 public void Delete()
 {
     MongoService <AliveStateCache> .Delete(this);
 }
Пример #9
0
 public void Insert()
 {
     MongoService <SoldierGroup> .Insert(this);
 }
Пример #10
0
 /// <summary>
 /// 移除一个群组信息
 /// </summary>
 /// <param name="GroupNum"></param>
 public static void Delete(long GroupNum)
 {
     MongoService <GroupSettings> .DeleteMany(p => p.GroupNum == GroupNum);
 }
Пример #11
0
 /// <summary>
 /// 获取指定的群组信息
 /// </summary>
 /// <param name="GroupNum"></param>
 public GroupSettings this[long GroupNum] => MongoService <GroupSettings> .GetOnly(g => g.GroupNum == GroupNum);
Пример #12
0
 public HomeController()
 {
     _mongoService = new MongoService();
 }
Пример #13
0
 public BreweryController()
 {
     this.mongoService = new MongoService();
 }
Пример #14
0
        public void Construct_Success()
        {
            MongoService repo = new MongoService(_mongoFixture.MongoClient, _mongoFixture.Logger, new Dictionary <string, HashSet <string> >());

            Assert.True(true);
        }
Пример #15
0
 public void Update()
 {
     MongoService <ArchCollection> .Update(this);
 }
Пример #16
0
 public TicketController(IGraphClient graphClient,
                         MongoService mongoService)
 {
     _neoContext   = graphClient;
     _mongoService = mongoService;
 }
Пример #17
0
 public void Update()
 {
     MongoService <BindAiRestrict> .Update(this);
 }
Пример #18
0
 public void Update()
 {
     MongoService <GlobalVarRecord> .Update(this);
 }
Пример #19
0
 public CountersController(MongoService mongoService)
 {
     this.mongoService = mongoService;
 }
Пример #20
0
 public void Update()
 {
     MongoService <DailySellItemRareRecord> .Update(this);
 }
Пример #21
0
 public void Insert()
 {
     MongoService <AliveStateCache> .Insert(this);
 }
Пример #22
0
 public InlineUrlKey GetUrlInlineUrlKey(string botId)
 {
     return(_inlineUrlKeys.Find(x => x.Id == MongoService.TryCreateObjectId(botId)).FirstOrDefault());
 }
Пример #23
0
        public static IEnumerable <CmdRec> RecentCmds(int hour)
        {
            var startTime = DateTime.Now.AddHours(-hour);

            return(MongoService <CmdRec> .Get(p => p.Time >= startTime));
        }
Пример #24
0
        public bool RemoveInlineUrlKey(string id)
        {
            var deleteResult = _inlineUrlKeys.DeleteOne(x => x.Id == MongoService.TryCreateObjectId(id));

            return(deleteResult.DeletedCount > 0);
        }
Пример #25
0
 internal UsersBL()
 {
     _repository = new MongoService<User>();
     //_repository = new UsersMongoService();
 }
Пример #26
0
 public void Starve()
 {
     State = SoldierState.Starving;
     MongoService <SoldierGroup> .Update(this);
 }
Пример #27
0
 public void Update()
 {
     MongoService <ArchAsset> .Update(this);
 }
Пример #28
0
 public void Feed()
 {
     State        = SoldierState.Working;
     LastFeedTime = DateTime.Now;
     MongoService <SoldierGroup> .Update(this);
 }
Пример #29
0
 public Handler(MongoService mongo, ILogger <Handler> logger)
 {
     _mongo  = mongo;
     _logger = logger;
 }
Пример #30
0
 public static List <SoldierGroup> Get(long QQNum)
 {
     return(MongoService <SoldierGroup> .Get(p => p.Owner == QQNum));
 }
Пример #31
0
 public void Setup()
 {
     _service = new MongoService();
 }
Пример #32
0
        public static IEnumerable <SoldierGroup> OverDateRebels(int overDays)
        {
            var overTime = DateTime.Now.AddDays(-overDays);

            return(MongoService <SoldierGroup> .Get(p => p.State == SoldierState.Rebel && p.CreateTime <= overTime));
        }
Пример #33
0
 public static List <SoldierGroup> StarvingGroups(long QQNum)
 {
     return(MongoService <SoldierGroup> .Get(p => p.Owner == QQNum && p.State == SoldierState.Starving).OrderBy(p => p.LastFeedTime).ToList());
 }
Пример #34
0
 public static int Pressure(string BindAi)
 {
     return((int)MongoService <RestrictRec> .Count(p => p.BindAi == BindAi));
 }