示例#1
0
        public string GetPlaceDisplayName(IReadOnlyDbContext db)
        {
            var passive = db.FindById <Passive>(PatchPanel);
            var rack    = db.FindById <Rack>(passive.Place);
            var room    = db.FindById <Room>(rack.Parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("اتاق/سالن ").Append(room.Name).Append(" &lArr; ")
            .Append("راک ").Append(rack.Name).Append(" &lArr; ");
            if (passive.Type == Passive.PassiveTypeEnum.PatchPanel)
            {
                sb.Append("پچ پنل ");
            }
            else if (passive.Type == Passive.PassiveTypeEnum.Transmissional)
            {
                sb.Append("تجهیز انتقال ")
                .Append(DisplayUtils.DisplayName(passive.TransmissionType))
                .Append(" ");
            }
            else
            {
                throw new NotImplementedException();
            }
            sb.Append(passive.Name);

            return(sb.ToString());
        }
示例#2
0
 public string GetCenterId(IReadOnlyDbContext db)
 {
     if (PlaceType == DevicePlaceType.Rack)
     {
         var rack     = db.FindById <Rack>(Place);
         var room     = db.FindById <Room>(rack.Parent);
         var building = db.FindById <Building>(room.Parent);
         return(building.Parent);
     }
     else if (PlaceType == DevicePlaceType.Kafu)
     {
         var kafu = db.FindById <Kafu>(Place);
         return(kafu.CommCenter);
     }
     throw new NotImplementedException();
 }
示例#3
0
        public string GetPlaceDisplay(IReadOnlyDbContext db)
        {
            StringBuilder sb = new StringBuilder();

            if (PlaceType == DevicePlaceType.Rack)
            {
                var rack     = db.FindById <Rack>(Place);
                var room     = db.FindById <Room>(rack.Parent);
                var building = db.FindById <Building>(room.Parent);
                var center   = db.FindById <CommCenter>(building.Parent);
                var city     = db.FindById <City>(center.City);

                sb.Append(city.Name).Append(" &lArr; ")
                .Append("مرکز ").Append(center.Name).Append(" &lArr; ")
                .Append("ساختمان ").Append(building.Name).Append(" &lArr; ")
                .Append("اتاق/سالن ").Append(room.Name).Append(" &lArr; ")
                .Append("راک ").Append(rack.Name).Append(" &lArr; ")
                .Append("دستگاه ").Append(ToString());
            }
            else if (PlaceType == DevicePlaceType.Kafu)
            {
                var kafu   = db.FindById <Kafu>(Place);
                var center = db.FindById <CommCenter>(kafu.CommCenter);
                var city   = db.FindById <City>(center.City);

                sb.Append(city.Name).Append(" &lArr; ")
                .Append("مرکز ").Append(center.Name).Append(" &lArr; ")
                .Append("کافو ").Append(DisplayUtils.DisplayName(kafu.Type))
                .Append(" \"").Append(kafu.Name).Append("\"");
            }
            else
            {
                throw new NotImplementedException();
            }

            return(sb.ToString());
        }
示例#4
0
        public string GetPlaceDisplay(IReadOnlyDbContext db)
        {
            var device = db.FindById <Device>(Device);

            return(device.GetPlaceDisplay(db));
        }
示例#5
0
        public static City GetMainCity(IReadOnlyDbContext db)
        {
            var mainCitySettings = db.FindFirst <Settings>(s => s.Key == "MainCity");

            return(db.FindById <City>(mainCitySettings.Value));
        }