public CustomerAdminPage()
        {
            InitializeComponent();

            UserRoleAuths = ucSitePicker.UserRoleAuths = SecurityHelper.GetUserRoleAuths((int)LayoutComponentType.BookingAdmin);
            if (this.UserRoleAuths == null)
            {
                this.Content = SecurityHelper.GetNoPermissionInfoPanel();
                return;
            }
            btnSaveCustomer.IsEnabled             = ucCntactInfoPanel.IsEnabled
                                                  = ucBookingAdmin.btnSaveBooking.IsEnabled = ucBookingAdmin.btnSaveBookingEquipment.IsEnabled = ucBookingAdmin.btnSaveBookingService.IsEnabled
                                                                                                                                                     = ucBookingAdmin.btnNewBooking.IsEnabled = ucBookingAdmin.btnInsertBookingEquipment.IsEnabled = ucBookingAdmin.btnInsertBookingService.IsEnabled
                                                                                                                                                                                                                                                         = this.UserRoleAuths.Count(i => i.WriteRight == true) > 0;
            FillLanguage();

            ucSitePicker.Init();
            ucSitePicker.InitComplete      += new EventHandler(ucSitePicker_InitComplete);
            btnSaveCustomer.Click          += new RoutedEventHandler(btnSaveCustomer_Click);
            btnCancelCustomer.Click        += new RoutedEventHandler(btnCancelCustomer_Click);
            gvwCustomers.SelectionChanged  += new EventHandler <Telerik.Windows.Controls.SelectionChangeEventArgs>(gvwCustomers_SelectionChanged);
            gvwCustomers.AddingNewDataItem += new EventHandler <Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs>(gvwCustomers_AddingNewDataItem);
            gvwCustomers.CellValidating    += new EventHandler <Telerik.Windows.Controls.GridViewCellValidatingEventArgs>(gvwCustomers_CellValidating);
            gvwCustomers.RowEditEnded      += new EventHandler <GridViewRowEditEndedEventArgs>(gvwCustomers_RowEditEnded);

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

            genderDic.Add(-1, string.Empty);
            genderDic.Add((int)Enums.Gender.Male, Enums.Gender.Male.ToString());
            genderDic.Add((int)Enums.Gender.Female, Enums.Gender.Female.ToString());
            ((GridViewComboBoxColumn)this.gvwCustomers.Columns["Gender"]).ItemsSource = genderDic;

            ucCntactInfoPanel.btnSaveContact.Visibility = Visibility.Collapsed;

            btnSearch.Click          += new RoutedEventHandler(btnSearch_Click);
            chkHasContract.Checked   += new RoutedEventHandler(chkHasContract_CheckChanged);
            chkHasContract.Unchecked += new RoutedEventHandler(chkHasContract_CheckChanged);
            uiDateFrom.SelectedDate   = DateTime.Today;

            gridDetails.Visibility = ucCntactInfoPanel.Visibility = System.Windows.Visibility.Collapsed;

            ucBookingAdmin.RebindBookingList += new EventHandler(ucBookingAdmin_RebindBookingList);

            UiHelper.ApplyMouseWheelScrollViewer(scrollViewerCustomers);
        }
Exemple #2
0
        /*  ======================================================================
         *      PAGE FUNCTIONS
         *  ====================================================================== */


        private void DataBind()
        {
            this.DataContext = this.ImageDataItem;
            btnDelete.Tag    = this;
            if (this.ImageDataItem != null)
            {
                IsEnabled = true;

                if (this.ImageDataItem.ImageContent != null)
                {
                    imgContent.Source = UiHelper.ToBitmapImageFromBytes(this.ImageDataItem.ImageSmallContent);
                }
                else
                {
                    imgContent.Source = null;
                }
            }
            else
            {
                IsEnabled         = false;
                imgContent.Source = null;
            }
        }
        public BookingAdminPage()
        {
            InitializeComponent();
            UserRoleAuths = ucSitePicker.UserRoleAuths = ucBookingAdmin.ucBookingNew.ucSitePicker.UserRoleAuths = SecurityHelper.GetUserRoleAuths((int)LayoutComponentType.BookingAdmin);
            if (this.UserRoleAuths == null)
            {
                this.Content = SecurityHelper.GetNoPermissionInfoPanel();
                return;
            }
            ucBookingAdmin.btnSaveBooking.IsEnabled = ucBookingAdmin.btnSaveBookingEquipment.IsEnabled = ucBookingAdmin.btnSaveBookingService.IsEnabled
                                                                                                             = ucBookingAdmin.btnNewBooking.IsEnabled = ucBookingAdmin.btnInsertBookingEquipment.IsEnabled = ucBookingAdmin.btnInsertBookingService.IsEnabled
                                                                                                                                                                                                                 = this.UserRoleAuths.Count(i => i.WriteRight == true) > 0;
            FillLanguage();

            //ucSitePicker.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(ucSitePicker_SelectionChanged);
            ucSitePicker.Init();
            ucSitePicker.InitComplete += new EventHandler(ucSitePicker_InitComplete);
            btnSearch.Click           += new RoutedEventHandler(btnSearch_Click);
            uiDateFrom.SelectedDate    = DateTime.Today.AddMonths(-1);

            ucBookingAdmin.RebindBookingList += new EventHandler(ucBookingAdmin_RebindBookingList);

            UiHelper.ApplyMouseWheelScrollViewer(scrollViewerBookings);
        }