Exemplo n.º 1
0
 private void LoadRoomtypes()
 {
     using (RetailContext context = new RetailContext())
     {
         var roomtypes = context.RoomTypes.ToList();
         foreach (RoomType rt in roomtypes)
         {
             PUComboBoxItemModel item = new PUComboBoxItemModel()
             {
                 Header    = rt.Name,
                 CanDelete = false,
                 Value     = rt.Name,
             };
             rtypeitems.Add(item);
         }
         ComboBoxItemsList = new BindableCollection <PUComboBoxItemModel>(rtypeitems);
     }
 }
        public ChangeRoomStateWindow(Room room, RoomStatePage page)
        {
            InitializeComponent();
            isclosetrans = 0;
            thisroom     = room;
            thispage     = page;
            PUComboBoxItemModel selecteditem = new PUComboBoxItemModel();

            using (RetailContext context = new RetailContext())
            {
                List <RoomStateModel> roomstates         = context.RoomStates.ToList();
                List <int>            afterstates        = RoomHelper.NowState_AfterState[room.roomstate];
                List <string>         afterstates_string = new List <string>();
                foreach (int i in afterstates)
                {
                    afterstates_string.Add(RoomHelper.StateConfig[i]);
                }
                foreach (RoomStateModel rsm in roomstates)
                {
                    if (afterstates_string.Contains(rsm.Name))
                    {
                        PUComboBoxItemModel pUComboBoxItemModel = new PUComboBoxItemModel()
                        {
                            Header    = rsm.Name,
                            Value     = rsm.Name,
                            CanDelete = false,
                        };
                        StateList.Add(pUComboBoxItemModel);
                        if (rsm.Name == RoomHelper.StateConfig[thisroom.roomstate])
                        {
                            selecteditem = pUComboBoxItemModel;
                        }
                    }
                }
            }
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            StateCombobox.BindingItems = StateList;
            StateCombobox.Text         = selecteditem.Header;
        }