Beispiel #1
0
        private void InformationConnection(bool value)  //проверка подключения к базе данных
        {
            try
            {
                Action action = () =>
                {
                    switch (value)
                    {
                    case (true):
                        lbsstConnection.Text = Registry_Class.DataSource + "\\" + Registry_Class.DSServerName + " - " + Registry_Class.InitialCatalog;
                        AuthorizationForm authorizationForm = new AuthorizationForm();
                        authorizationForm.Show();
                        break;

                    case (false):
                        lbsstConnection.Text = MessageUser.NoConnection;

                        foreach (Form f in Application.OpenForms)
                        {
                            if (f.Name == "ConnectionForm")
                            {
                                return;
                            }
                        }

                        ConnectionForm connectionForm = new ConnectionForm();
                        connectionForm.Show(this);
                        break;
                    }
                };
                Invoke(action);
            }
            catch
            {
                threadConnection.Abort();
            }
        }
Beispiel #2
0
        private void miAuthorization_Click(object sender, EventArgs e)  //открытие окна авторизации
        {
            AuthorizationForm authorizationForm = new AuthorizationForm();

            authorizationForm.Show();
        }
Beispiel #3
0
        private void miExitProfile_Click(object sender, EventArgs e)    //выход из профиля
        {
            switch (AuthorizationForm.userRole)
            {
            case 1:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;

            case 2:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;

            case 3:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;

            case 4:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;

            case 5:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;

            case 6:
                miHandBook.Visible      = false;
                miEmployee.Visible      = false;
                miTrain.Visible         = false;
                miTrainDriver.Visible   = false;
                miDolj.Visible          = false;
                miPassenger.Visible     = false;
                miPlaceStatus.Visible   = false;
                miRoute.Visible         = false;
                miTicket.Visible        = false;
                miAuthorization.Enabled = false;
                break;
            }

            //Close();
            AuthorizationForm authorizationForm = new AuthorizationForm();

            authorizationForm.Show();
            AuthorizationForm.userRole = 0;
        }