示例#1
0
        //---------------------------------------------------------------------------------------------
        // Show the Building Creation Form
        //---------------------------------------------------------------------------------------------
        private void btNewBuilding_Click(object sender, EventArgs e)
        {
            frmBuilding fDetail = new frmBuilding();

            fDetail.ModuleID          = this.ModuleID;
            fDetail.Mode              = GlobalVariables.EditMode.New;
            fDetail.PreSelectedEntity = (Int64)cbEntity.SelectedValue;
            RoomPicker_Building _building = new RoomPicker_Building();

            _building.SITE = _SiteCode;

            fDetail.Entity = _building;
            if (fDetail.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (_SelectNewAfterCreation)
                {
                    this.SynchronizeWithBuilding(fDetail.Entity.ID);
                }
                else
                {
                    _BuildingID = 0;
                    fillBuilding();
                }
            }
        }
示例#2
0
        //---------------------------------------------------------------------------------------------
        // Show the Building Creation Form
        //---------------------------------------------------------------------------------------------
        private void ctxNewBuilding_Click(object sender, EventArgs e)
        {
            frmBuilding fDetail = new frmBuilding();

            fDetail.ModuleID = this.ModuleID;
            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.PreSelectedEntity = ((Entities.RoomPicker_Entity)treeList.GetParent(treeList.SelectedObject)).ID;
            }

            if (treeList.SelectedObject is RoomPicker_Room)
            {
                fDetail.PreSelectedEntity = ((Entities.RoomPicker_Entity)treeList.GetParent(treeList.GetParent(treeList.SelectedObject))).ID;
            }

            RoomPicker_Building _building = new RoomPicker_Building();

            _building.SITE = _SiteCode;

            fDetail.Entity = _building;
            if (fDetail.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                treeList.RebuildAll(true);
                treeList.Expand(treeList.SelectedObject);

                if (_SelectNewAfterCreation)
                {
                    this.SynchronizeWithBuilding(fDetail.Entity.ID);
                }
            }
        }