//--------------------------------------------------------------------------------------------- // Show the Room Creation Form //--------------------------------------------------------------------------------------------- private void ctxNewRoom_Click(object sender, EventArgs e) { frmRoom fDetail = new frmRoom(); fDetail.ModuleID = this.ModuleID; fDetail.RoomNameMandatory = _RoomNameMandatory; fDetail.Mode = GlobalVariables.EditMode.New; if (treeList.SelectedObject is RoomPicker_Entity) { fDetail.PreSelectedEntity = ((Entities.RoomPicker_Entity)treeList.SelectedObject).ID; } if (treeList.SelectedObject is RoomPicker_Building) { fDetail.PreSelectedBuilding = ((Entities.RoomPicker_Building)treeList.SelectedObject).ID; fDetail.PreSelectedEntity = ((Entities.RoomPicker_Entity)treeList.GetParent(treeList.SelectedObject)).ID; } if (treeList.SelectedObject is RoomPicker_Room) { fDetail.PreSelectedBuilding = ((Entities.RoomPicker_Building)treeList.GetParent(treeList.SelectedObject)).ID; fDetail.PreSelectedEntity = ((Entities.RoomPicker_Entity)treeList.GetParent(treeList.GetParent(treeList.SelectedObject))).ID; } RoomPicker_Room _room = new RoomPicker_Room(); _room.SITE = _SiteCode; fDetail.Entity = _room; if (fDetail.ShowDialog() == System.Windows.Forms.DialogResult.OK) { treeList.RebuildAll(true); treeList.Expand(treeList.SelectedObject); if (_SelectNewAfterCreation) { this.SynchronizeWithRoom(fDetail.Entity.ID); } } }