private void button2_Click(object sender, EventArgs e)
        {
            //новое поле
            trener_dostyp f = new trener_dostyp();

            f.Show();
            this.Close();
        }
Beispiel #2
0
        private void enterbutton_Click(object sender, EventArgs e)
        {
            //повтор процедуры, как выше
            if (Directory.Exists(@"C:\data_orientiring\documentation\checkdocumentation"))
            {
                FileStream   file1  = new FileStream(@"C:\data_orientiring\documentation\checkdocumentation.txt", FileMode.Open);
                StreamReader reader = new StreamReader(file1);
                string       a      = reader.ReadToEnd();
                reader.Close();
                if (a == "true")
                {
                    documentation = true;
                }
                else
                {
                    MessageBox.Show("Сначала прочитайте документацию", "Внимание");
                }
            }
            else
            {
                Directory.CreateDirectory(@"C:\data_orientiring");
                Directory.CreateDirectory(@"C:\data_orientiring\documentation");
                Directory.CreateDirectory(@"C:\data_orientiring\documentation\checkdocumentation");
                File.Create(@"C:\data_orientiring\documentation\checkdocumentation.txt").Close();
                MessageBox.Show("Сначала прочитайте документацию", "Внимание");
            }
            if (documentation)
            {
                //считываем логин и пароль
                string s = logintextBox.Text;
                s = s.ToLower();
                string g = passworrdtextBox.Text;
                g = g.ToLower();
                //-------------------------
                //проверка на вход и заполнение нужных файлов, а также переход в другие формы
                if (s != "bannikovaelena" && g == "256b872r927")
                {
                    MessageBox.Show("Банникова Елена. Логин неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "bannikovaelena" && g != "256b872r927")
                {
                    MessageBox.Show("Банникова Елена. Пароль неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    passworrdtextBox.Text = "";
                }
                else if (s == "bannikovaelena" && g == "256b872r927")
                {
                    MessageBox.Show("Логин и пароль верны. Здраствуйте, Банникова Елена", "Здравствуйте, Банникова Елена", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (!Directory.Exists(@"C:\data_orientiring\name"))
                    {
                        Directory.CreateDirectory(@"C:\data_orientiring\name");
                    }
                    File.WriteAllText(@"C:\data_orientiring\name\coach_name.txt", "Банникова Елена Геннадьевна");
                    trener_dostyp f = new trener_dostyp();
                    f.Show();
                    this.Hide();
                }
                else if (s != "dementyevkonstantin" && g == "98732h357sf")
                {
                    MessageBox.Show("Дементьев Константин. Логин неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "dementyevkonstantin" && g != "98732h357sf")
                {
                    MessageBox.Show("Дементьев Константин. Пароль неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "dementyevkonstantin" && g == "98732h357sf")
                {
                    MessageBox.Show("Логин и пароль верны. Здраствуйте, Дементьев Константин", "Здравствуйте, Дементьев Константин", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (!Directory.Exists(@"C:\data_orientiring\name"))
                    {
                        Directory.CreateDirectory(@"C:\data_orientiring\name");
                    }
                    File.WriteAllText(@"C:\data_orientiring\name\coach_name.txt", "Дементьев Константин Юрьевич");
                    trener_dostyp f = new trener_dostyp();
                    f.Show();
                    this.Hide();
                }
                else if (s != "tester" && g == "123ret65v4c9b1")
                {
                    MessageBox.Show("Тестер. Логин неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "tester" && g != "123ret65v4c9b1")
                {
                    MessageBox.Show("Тестер. Пароль неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "tester" && g == "123ret65v4c9b1")
                {
                    MessageBox.Show("Логин и пароль верны. Здраствуйте, Тестер", "Здравствуйте, Тестер", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (!Directory.Exists(@"C:\data_orientiring\name"))
                    {
                        Directory.CreateDirectory(@"C:\data_orientiring\name");
                    }
                    File.WriteAllText(@"C:\data_orientiring\name\coach_name.txt", "Тестер");
                    trener_dostyp f = new trener_dostyp();
                    f.Show();
                    this.Hide();
                }

                else if (s != "ivanovaleksey" && g == "mdb156frt12Gh5")
                {
                    MessageBox.Show("Иванов Алексей. Логин неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "ivanovaleksey" && g == "mdb156frt12Gh5")
                {
                    MessageBox.Show("Иванов Алексей. Пароль неверный", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    logintextBox.Text = "";
                }
                else if (s == "ivanovaleksey" && g == "mdb156frt12Gh5")
                {
                    MessageBox.Show("Логин и пароль верны. Здраствуйте, Иванов Алексей", "Здравствуйте, Иванов Алексей", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (!Directory.Exists(@"C:\data_orientiring\name"))
                    {
                        Directory.CreateDirectory(@"C:\data_orientiring\name");
                    }
                    File.WriteAllText(@"C:\data_orientiring\name\coach_name.txt", "Иванов Алексей");
                    trener_dostyp f = new trener_dostyp();
                    f.Show();
                    this.Hide();
                }
                //-------------------------------------------------------------------------
                //если ни один из if-ов не совпал, значит и логин и пароль неправильный
                else
                {
                    //сообщаем об этом и чистим поля
                    MessageBox.Show("Логин и пароль неверны");
                    logintextBox.Text     = "";
                    passworrdtextBox.Text = "";
                    //-----------------------------
                }
            }
        }