예제 #1
0
        public RoomAdminPage()
        {
            InitializeComponent();
            UserRoleAuths = ucSitePicker.UserRoleAuths = SecurityHelper.GetUserRoleAuths((int)LayoutComponentType.RoomAdmin);
            if (this.UserRoleAuths == null)
            {
                this.Content = SecurityHelper.GetNoPermissionInfoPanel();
                return;
            }
            FillLanguage();

            btnSaveRoom.IsEnabled    = btnSaveRoomEquipment.IsEnabled = btnSaveRoomService.IsEnabled = this.UserRoleAuths.Count(i => i.WriteRight == true) > 0;
            ucImageUpload.IsReadOnly = !btnSaveRoom.IsEnabled;

            //ucSitePicker.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(ucSitePicker_SelectionChanged);
            ucSitePicker.Init();
            ucSitePicker.InitComplete += new EventHandler(ucSitePicker_InitComplete);
            ucRoomTypes.Init();
            ucRoomTypes.InitComplete  += new EventHandler(ucRoomTypes_InitComplete);
            gvwRoom.AddingNewDataItem += new EventHandler <Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs>(gvwRoom_AddingNewDataItem);
            gvwRoom.Deleting          += new EventHandler <GridViewDeletingEventArgs>(gvwRoom_Deleting);
            gvwRoom.CellValidating    += new EventHandler <GridViewCellValidatingEventArgs>(gvwRoom_CellValidating);
            gvwRoom.BeginningEdit     += new EventHandler <GridViewBeginningEditRoutedEventArgs>(gvwRoom_BeginningEdit);
            gvwRoom.SelectionChanged  += new EventHandler <SelectionChangeEventArgs>(gvwRoom_SelectionChanged);

            btnSearch.Click     += new RoutedEventHandler(btnSearch_Click);
            btnSaveRoom.Click   += new RoutedEventHandler(btnSaveRoom_Click);
            btnCancelRoom.Click += new RoutedEventHandler(btnCancelRoom_Click);

            Dictionary <int, string> roomStatusDic = new Dictionary <int, string>();

            roomStatusDic.Add((int)RoomStatus.Available, RoomStatus.Available.ToString());
            roomStatusDic.Add((int)RoomStatus.Occupied, RoomStatus.Occupied.ToString());
            ((GridViewComboBoxColumn)this.gvwRoom.Columns["RoomStatus"]).ItemsSource = roomStatusDic;

            gridEquipmentService.Visibility = gridImages.Visibility = System.Windows.Visibility.Collapsed;
            ucImageUpload.ImageType         = ImageType.Room;

            DataServiceHelper.ListEquipmentAsync(Globals.UserLogin.UserOrganisationId, null, false, ListEquipmentCompleted);
            btnSaveRoomEquipment.Click   += new RoutedEventHandler(btnSaveRoomEquipment_Click);
            btnCancelRoomEquipment.Click += new RoutedEventHandler(btnCancelRoomEquipment_Click);
            btnInsertRoomEquipment.Click += new RoutedEventHandler(btnInsertRoomEquipment_Click);
            gvwRoomEquipment.Deleting    += new EventHandler <GridViewDeletingEventArgs>(gvwRoomEquipment_Deleting);

            DataServiceHelper.ListServiceAsync(Globals.UserLogin.UserOrganisationId, null, false, ListServiceCompleted);
            btnSaveRoomService.Click   += new RoutedEventHandler(btnSaveRoomService_Click);
            btnCancelRoomService.Click += new RoutedEventHandler(btnCancelRoomService_Click);
            btnInsertRoomService.Click += new RoutedEventHandler(btnInsertRoomService_Click);
            gvwRoomService.Deleting    += new EventHandler <GridViewDeletingEventArgs>(gvwRoomService_Deleting);

            //Common
            UiHelper.ApplyMouseWheelScrollViewer(scrollViewerRooms);
        }
 private void BeginRebindEquipment()
 {
     Globals.IsBusy = true;
     DataServiceHelper.ListEquipmentAsync(Globals.UserLogin.UserOrganisationId, null, true, ListEquipmentCompleted);
 }