Пример #1
0
        //--------------------------------------------------------------------------------------------------------
        // Fill the Building combobox for the selected Entity based on properties: SiteCode, OnlyAvailable, EmptyMemberLabel & DisplayMember
        //--------------------------------------------------------------------------------------------------------
        private void fillBuilding()
        {
            IList <RoomPicker_Building> _list = new List <RoomPicker_Building>();

            if (cbEntity.SelectedItem != null && ((RoomPicker_Entity)cbEntity.SelectedItem).ID != 0)
            {
                if (_OnlyAvailable)
                {
                    _list = RoomPicker_Building.Load("WHERE AVAILABLE='True' AND SITE='" + _SiteCode + "' AND FK_ENTITY=" + cbEntity.SelectedValue + " AND FK_MODULE=" + _ModuleID);
                }
                else
                {
                    _list = RoomPicker_Building.Load("WHERE SITE='" + _SiteCode + "' AND FK_ENTITY=" + cbEntity.SelectedValue + " AND FK_MODULE=" + _ModuleID);
                }
            }
            RoomPicker_Building _empty = new RoomPicker_Building();

            _empty.CODE = " " + _EmptyMemberLabel;
            _empty.NAME = " " + _EmptyMemberLabel;
            _list.Add(_empty);

            cbBuilding.ValueMember = "ID";
            if (_DisplayMember == GlobalVariables.DisplayMember.Code)
            {
                cbBuilding.DisplayMember = "CODE";
                cbBuilding.DataSource    = _list.OrderBy(x => x.CODE).ToList();
            }
            else
            {
                cbBuilding.DisplayMember = "NAME";
                cbBuilding.DataSource    = _list.OrderBy(x => x.NAME).ToList();
            }

            cbBuilding.SelectedValue = _BuildingID;
        }
Пример #2
0
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            EntityList = RoomPicker_Entity.Load("WHERE FK_MODULE=" + this.ModuleID + " AND SITE='" + _SiteCode + "'");

            updateSearchCheckboxes();

            tsbOpen.Enabled   = false;
            tsbDelete.Enabled = false;
            ctxOpen.Enabled   = false;
            ctxDelete.Enabled = false;

            if (!AllowDelete)
            {
                tsbDelete.Enabled = false;
                ctxDelete.Enabled = false;
                tsbDelete.Visible = false;
                ctxDelete.Visible = false;
            }

            IList <RoomPicker_Building> _List = RoomPicker_Building.Load("WHERE SITE='" + _SiteCode + "' AND FK_MODULE=" + this.ModuleID);

            olvBuilding.SetObjects(_List);
        }
Пример #3
0
        private void displayBuilding()
        {
            if (cbEntity.SelectedItem != null)
            {
                IList <RoomPicker_Building> _list = new List <RoomPicker_Building>();
                _list = RoomPicker_Building.Load("WHERE SITE='" + _entity.SITE + "' AND FK_ENTITY=" + cbEntity.SelectedValue);

                cbBuilding.DisplayMember = "CODE";
                cbBuilding.ValueMember   = "ID";
                cbBuilding.DataSource    = _list.OrderBy(x => x.CODE).ToList();
            }
        }
Пример #4
0
        public override void initForm(SynapseCore.Security.Tools.SecureAndTranslateMode Mode)
        {
            base.initForm(Mode);

            EntityList   = RoomPicker_Entity.Load("WHERE FK_MODULE=" + this.ModuleID + " AND SITE='" + _SiteCode + "'");
            BuildingList = RoomPicker_Building.Load("WHERE FK_MODULE=" + this.ModuleID + " AND SITE='" + _SiteCode + "'");

            if (!_RoomNameMandatory)
            {
                colName.FillsFreeSpace = false;
                colName.Searchable     = false;
                colName.IsVisible      = false;
                colCode.FillsFreeSpace = true;

                olvRoom.RebuildColumns();
            }

            updateSearchCheckboxes();

            tsbOpen.Enabled   = false;
            tsbDelete.Enabled = false;
            ctxOpen.Enabled   = false;
            ctxDelete.Enabled = false;

            if (!AllowDelete)
            {
                tsbDelete.Enabled = false;
                ctxDelete.Enabled = false;
                tsbDelete.Visible = false;
                ctxDelete.Visible = false;
            }

            IList <RoomPicker_Room> _List = RoomPicker_Room.Load("WHERE SITE='" + _SiteCode + "' AND FK_MODULE=" + this.ModuleID);

            olvRoom.SetObjects(_List);
        }
Пример #5
0
        public RoomPickerTree()
        {
            InitializeComponent();

            colCode.ImageGetter = delegate(object x)
            {
                if (_ShowImage)
                {
                    if (x is RoomPicker_Entity)
                    {
                        return("entity");
                    }
                    else
                    if (x is RoomPicker_Building)
                    {
                        return("building");
                    }
                    else
                    if (x is RoomPicker_Room)
                    {
                        return("room2");
                    }
                }

                return(null);
            };

            treeList.CanExpandGetter = delegate(object x)
            {
                if (x is Entities.RoomPicker_Entity)
                {
                    if (_PickerType == GlobalVariables.PickerType.Building || _PickerType == GlobalVariables.PickerType.Room)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (x is Entities.RoomPicker_Building)
                {
                    if (_PickerType == GlobalVariables.PickerType.Room)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(false);
            };

            treeList.ChildrenGetter = delegate(object x)
            {
                if (x is Entities.RoomPicker_Entity)
                {
                    Entities.RoomPicker_Entity  _ent  = (Entities.RoomPicker_Entity)x;
                    IList <RoomPicker_Building> _list = new List <RoomPicker_Building>();
                    if (_OnlyAvailable)
                    {
                        _list = RoomPicker_Building.Load("WHERE AVAILABLE='True' AND SITE='" + _SiteCode + "' AND FK_ENTITY=" + _ent.ID + " AND FK_MODULE=" + _ModuleID);
                    }
                    else
                    {
                        _list = RoomPicker_Building.Load("WHERE SITE='" + _SiteCode + "' AND FK_ENTITY=" + _ent.ID + " AND FK_MODULE=" + _ModuleID);
                    }

                    return(_list.OrderBy(y => y.CODE).ToList());
                }
                else
                {
                    Entities.RoomPicker_Building _bld  = (Entities.RoomPicker_Building)x;
                    IList <RoomPicker_Room>      _list = new List <RoomPicker_Room>();
                    if (_OnlyAvailable)
                    {
                        _list = RoomPicker_Room.Load("WHERE AVAILABLE='True' AND SITE='" + _SiteCode + "' AND FK_BUILDING=" + _bld.ID + " AND FK_MODULE=" + _ModuleID);
                    }
                    else
                    {
                        _list = RoomPicker_Room.Load("WHERE SITE='" + _SiteCode + "' AND FK_BUILDING=" + _bld.ID + " AND FK_MODULE=" + _ModuleID);
                    }

                    return(_list.OrderBy(y => y.CODE).ToList());
                }
            };
        }