示例#1
0
 public Dictionary <MongodbServerUrl, ServerInfo> GetServerInfo()
 {
     try
     {
         return(MongodbServerMaintainceCenter.GetServerInfos());
     }
     catch (Exception ex)
     {
         LocalLoggingService.Error("{0} {1} {2} {3}", MongodbServerConfiguration.ModuleName, "MongodbServer_Slave", "GetServerInfo", ex.Message);
         throw;
     }
 }
示例#2
0
        public List <Category> GetCategoryData()
        {
            try
            {
                var data = new Dictionary <string, Category>();

                foreach (var serverInfo in MongodbServerMaintainceCenter.GetServerInfos().Select(item => item.Value).ToList())
                {
                    var descriptions = serverInfo.Descriptions;
                    foreach (var description in descriptions)
                    {
                        if (string.IsNullOrEmpty(description.CategoryName) || string.IsNullOrEmpty(description.Name))
                        {
                            continue;
                        }

                        if (!data.ContainsKey(description.CategoryName))
                        {
                            data.Add(description.CategoryName, new Category
                            {
                                Name            = description.CategoryName,
                                SubCategoryList = new List <SubCategory>(),
                            });
                            data[description.CategoryName].SubCategoryList.Add(GetSubCategory(description, serverInfo));
                        }
                        else
                        {
                            if (!data[description.CategoryName].SubCategoryList.Exists(sub => sub.Name == description.Name))
                            {
                                data[description.CategoryName].SubCategoryList.Add(GetSubCategory(description, serverInfo));
                            }
                        }
                    }
                }

                return(data.Select(item => item.Value).ToList());
            }
            catch (Exception ex)
            {
                LocalLoggingService.Error("{0} {1} {2} {3}", MongodbServerConfiguration.ModuleName, "MongodbServer_Slave", "GetCategoryData", ex.Message);
                throw;
            }
        }