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(" ⇐ ") .Append("راک ").Append(rack.Name).Append(" ⇐ "); 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()); }
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(); }
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(" ⇐ ") .Append("مرکز ").Append(center.Name).Append(" ⇐ ") .Append("ساختمان ").Append(building.Name).Append(" ⇐ ") .Append("اتاق/سالن ").Append(room.Name).Append(" ⇐ ") .Append("راک ").Append(rack.Name).Append(" ⇐ ") .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(" ⇐ ") .Append("مرکز ").Append(center.Name).Append(" ⇐ ") .Append("کافو ").Append(DisplayUtils.DisplayName(kafu.Type)) .Append(" \"").Append(kafu.Name).Append("\""); } else { throw new NotImplementedException(); } return(sb.ToString()); }
public string GetPlaceDisplay(IReadOnlyDbContext db) { var device = db.FindById <Device>(Device); return(device.GetPlaceDisplay(db)); }
public static City GetMainCity(IReadOnlyDbContext db) { var mainCitySettings = db.FindFirst <Settings>(s => s.Key == "MainCity"); return(db.FindById <City>(mainCitySettings.Value)); }