public void AddNewRoom() { SelectedRoom = new RoomDTO { Type = RoomTypes.ByFixed, Status = RoomStatus.Active }; if (Floors != null) { SelectedFloor = Floors.FirstOrDefault(); } }
public RoomEntryViewModel() { CleanUp(); _roomService = new RoomService(); CheckRoles(); LoadCategories(); SelectedFloor = Floors.FirstOrDefault(); AddNewRoom(); Messenger.Default.Register <RoomDTO>(this, (message) => { SelectedRoomParam = message; }); }
public CachedDataModel(MallBotContext dbContext) { OrganizationMapObjects = dbContext.OrganizationMapObject.Include(nameof(MapObject)).ToList(); TerminalMapObjects = dbContext.TerminalMapObject.Include(nameof(MapObject)).ToList(); Organizations = dbContext.Organization.Include("CategoryOrganization.Category").Include("OrganizationMapObject.MapObject").Where(x => !x.CategoryOrganization.Select(y => y.Category.ServiceCategoryType).Contains(ServiceCategoryType.Terminal) && x.OrganizationMapObject.Count != 0 && x.Name != null && x.IsUsed != false).OrderByDescending(x => x.Rating).ToList(); MTerminals = dbContext.MTerminal.Include("TerminalMapObject.MapObject").ToList(); Synonyms = dbContext.OrganizationSynonym.Where(x => x.Synonyms != null).ToList(); Categories = dbContext.Category.Where(x => x.IsUsed && x.Name != null && x.CustomerID != null).ToList(); Floors = dbContext.Floor.Where(x => x.Paths != null && x.CustomerID != null && x.FileExtension != null && x.Type == null).OrderBy(x => x.Number).ToList(); Customers = dbContext.Customer.ToList(); MapObjects = dbContext.MapObject.Where(x => x.Longitude >= -180 && x.Longitude <= 180 && x.Latitude >= -90 && x.Latitude <= 90 && x.Floor.Type == null).ToList(); MapObjectLinks = dbContext.MapObjectLink.ToList(); var temp = dbContext.BotCustomersSetting.ToList(); foreach (var item in Customers) { //var thisSystemSetting = dbContext.SystemSetting.FirstOrDefault(x => x.CustomerID == item.CustomerID && x.SystemSettingTypeID == dbContext.SystemSettingType.FirstOrDefault(y => y.Name == "TUTORIAL_DATA").SystemSettingTypeID); //List<SystemSettingHistory> ssHistories = null; //if (thisSystemSetting != null) ssHistories = dbContext.SystemSettingHistory.Where(x => x.SystemSettingID == thisSystemSetting.SystemSettingID).OrderByDescending(x => x.ModifiedDate).ToList(); var tmp = temp.FirstOrDefault(x => x.CustomerID == item.CustomerID); if (tmp == null) { throw new Exception($"Нет настроект для торгового центра CustomerID: {item.CustomerID}"); } item.IsPublish = tmp.IsPublish; item.Location = DbGeography.FromText($"POINT({tmp.GeoLongitude ?? "-161"} {tmp.GeoLatitude ?? "1"})"); } foreach (var item in MapObjects) { item.FixCoords(Floors.FirstOrDefault(x => x.FloorID == item.FloorID)); } foreach (var item in Floors.Where(x => x.ImportMetadata != null && x.Width != null && x.Height != null)) { item.FixPaths(); } Texts = dbContext.BotText.ToList(); }
private void ExcuteAddNewCategoryCommand() { var category = new Categories(NameTypes.FloorCategory); category.ShowDialog(); var dialogueResult = category.DialogResult; if (dialogueResult != null && (bool)dialogueResult) { LoadCategories();//should also get the latest updates in each row SelectedFloor = Floors.FirstOrDefault(c => c.DisplayName == category.TxtCategoryName.Text); if (SelectedFloor != null) { SelectedRoom.FloorId = SelectedFloor.Id; } } }
private Floor GetDefaultFloor() { var defaultFloor = Floors.FirstOrDefault(f => f.Name == "Default floor"); if (defaultFloor == null) { defaultFloor = new Floor { Name = "Default floor", Spaces = new List <Space>(), CreatedOn = DateTime.Now, CreatedBy = GetDefaultContactKey(), Categories = GetDefaultCategories(), ExternalId = Guid.NewGuid().ToString() }; Floors.Add(defaultFloor); } return(defaultFloor); }
public void RemoveFloor(int id) { var floor = Floors.FirstOrDefault(flr => flr.FloorNo == id); Floors.Remove(floor); }