Пример #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Window = ((CourseProject.TourismWindow)(target));
                return;

            case 2:
                this.Trips = ((System.Windows.Controls.Button)(target));

            #line 19 "..\..\TourismWindow.xaml"
                this.Trips.Click += new System.Windows.RoutedEventHandler(this.Trips_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.Selected = ((System.Windows.Controls.Button)(target));

            #line 20 "..\..\TourismWindow.xaml"
                this.Selected.Click += new System.Windows.RoutedEventHandler(this.Selected_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.Cabinet = ((System.Windows.Controls.Button)(target));

            #line 21 "..\..\TourismWindow.xaml"
                this.Cabinet.Click += new System.Windows.RoutedEventHandler(this.Cabinet_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.Author = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.Exit = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\TourismWindow.xaml"
                this.Exit.Click += new System.Windows.RoutedEventHandler(this.Exit_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.frame = ((System.Windows.Controls.Frame)(target));
                return;

            case 8:
                this.Back = ((System.Windows.Controls.Button)(target));

            #line 25 "..\..\TourismWindow.xaml"
                this.Back.Click += new System.Windows.RoutedEventHandler(this.Back_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.History = ((System.Windows.Controls.Button)(target));

            #line 26 "..\..\TourismWindow.xaml"
                this.History.Click += new System.Windows.RoutedEventHandler(this.History_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #2
0
 private void Enter_Click(object sender, RoutedEventArgs e)
 {
     if (Login.Text.Length > 0 && Password.Password.Length > 0)
     {
         if (DataManager.CheckInputString(@"^(?=.{3,10}$)[A-Za-z0-9]*$", Login.Text))                   //предварительная проверка логина
         {
             if (DataManager.CheckInputString(@"^(?=.{5,20}$)[A-Za-z0-9!#$%^&*]*$", Password.Password)) //предварительная проверка пароля
             {
                 SqlManager connection = new SqlManager();
                 int        flag       = connection.ExistsAccount(Login.Text, Password.Password); //проверка на существование аккаунта
                 if (flag == 0)
                 {
                     //получение прав доступа
                     DataPerson.right = connection.ReturnNumber("SELECT access_right FROM Accounts " +
                                                                "WHERE login = '******'");
                     if (DataPerson.right != -2)
                     {
                         //получение номера аккаунта в зависимости от прав
                         if (DataPerson.right == 3)
                         {
                             DataPerson.id = connection.ReturnNumber("SELECT Num_tourist FROM Accounts " +
                                                                     "WHERE login = '******'");
                             if (DataPerson.id == -2)
                             {
                                 flag = -2;
                             }
                         }
                         else if (DataPerson.right == 2)
                         {
                             DataPerson.id = connection.ReturnNumber("SELECT Num_worker FROM Accounts " +
                                                                     "WHERE login = '******'");
                             if (DataPerson.id == -2)
                             {
                                 flag = -2;
                             }
                         }
                         if ((DataPerson.right == 2 || DataPerson.right == 3) && flag != -2)
                         {
                             TourismWindow tw = new TourismWindow();
                             tw.Show();
                             Close();
                         }
                         else if (DataPerson.right == 1 && flag != -2)
                         {
                             WindowAdmin wa = new WindowAdmin();
                             wa.Show();
                             Close();
                         }
                         else
                         {
                             ShowConnectionError();
                         }
                         System.GC.Collect();
                     }
                     else
                     {
                         ShowConnectionError();
                     }
                 }
                 else if (flag == -2)
                 {
                     ShowConnectionError();
                 }
                 else
                 {
                     ShowError();
                 }
             }
             else
             {
                 ShowError();
             }
         }
         else
         {
             ShowError();
         }
     }
     else
     {
         MessageBox.Show("Необходимо ввести пароль и логин.", "", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }