Example #1
0
 private void LoginUnit(object sender, RoutedEventArgs e)
 {
     if (login != null && login.IsVisible)
     {
         if (login.WindowState == WindowState.Minimized)
         {
             login.WindowState = WindowState.Normal;
         }
         login.Focus();
         return;
     }
     login          = new LoginWindow();
     login.Closing += ClosingLogin;
     login.LoginUserControl.TitleAuth = "הזדהות - יחידת אירוח";
     login.LoginUserControl.SetToolTipValues("מספר יחידת אירוח קיימת - יש לבדוק ברשימות", "כל סיסמה");
     login.LoginUserControl.spPass.Visibility = Visibility.Collapsed;
     login.Show();
 }
Example #2
0
 private void LoginWebOwner(object sender, RoutedEventArgs e)
 {
     if (login != null && login.IsVisible)
     {
         if (login.WindowState == WindowState.Minimized)
         {
             login.WindowState = WindowState.Normal;
         }
         login.Focus();
         return;
     }
     login          = new LoginWindow();
     login.Closing += ClosingLogin1;
     login.LoginUserControl.TitleAuth = "הזדהות - בעל האתר";
     login.LoginUserControl.LoginType = 1;
     login.LoginUserControl.SetToolTipValues(bl.GetWebUsername(), bl.GetWebPassword());
     login.Show();
     //login
 }
        //פונקציה שפותחת חלון לפני איזה משתנה שהתחבר
        private void ShowLogin()
        {
            loginWindow         = new LoginWindow();
            BL_imp.loggedInUser = null;
            if (loginWindow.ShowDialog().Value)
            {
                userName.Content           = BL_imp.loggedInUser.Username;
                newGuestRequest.Visibility = Visibility.Hidden;
                guestRequest.Visibility    = Visibility.Hidden;
                OutPanel.Visibility        = Visibility.Visible;
                isNewUser = loginWindow.isNewUser;

                switch (BL.BL_imp.loggedInUser.UserType)
                {
                case UserTypes.Host:
                    if (isNewUser)
                    {
                        try
                        {
                            newHostWindow = new newHost();
                            newHostWindow.ShowDialog();
                        }
                        catch (BE.ZimmerException a)
                        {
                            MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }

                    try
                    {
                        hostingUnit = new HostingUnit();
                        hostingUnit.ShowDialog();
                    }
                    catch (BE.ZimmerException a)
                    {
                        MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    catch (Exception a)
                    {
                        MessageBox.Show(a.Message, "שגיאה", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    break;

                case UserTypes.Guest:
                    if (isNewUser)
                    {
                        newGuestRequest.Visibility  = Visibility.Visible;
                        newGuestRequest.DataContext = new BE.GuestRequest();
                        UnitDate.IsEnabled          = true;
                        guestRequest.Visibility     = Visibility.Hidden;
                    }
                    else
                    {
                        newGuestRequest.Visibility = Visibility.Hidden;
                        guestRequest.Visibility    = Visibility.Visible;
                    }
                    break;

                case UserTypes.administrator:
                    administrator = new Administrator();
                    administrator.ShowDialog();
                    break;

                default:
                    break;
                }
            }
            else
            {
                Environment.Exit(0);
            }
        }