コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "customer")
     {
         if (textBox2.Text == "admin")
         {
             Form1 f1 = new Form1();
             f1.ShowDialog();
         }
     }
     if (textBox1.Text == "manager")
     {
         if (textBox2.Text == "admin")
         {
             Form3 f3 = new Form3();
             f3.ShowDialog();
         }
     }
     if (textBox1.Text == "working")
     {
         if (textBox2.Text == "admin")
         {
             Form4 f4 = new Form4();
             f4.ShowDialog();
         }
     }
     if (textBox1.Text == "director")
     {
         if (textBox2.Text == "admin")
         {
             Form5 f5 = new Form5();
             f5.ShowDialog();
         }
     }
     else
     {
         MessageBox.Show("Не правильный логин или пароль");
     }
     textBox1.Clear();
     textBox2.Clear();
 }
コード例 #2
0
ファイル: Form4.cs プロジェクト: TatianaGV/botinok.fun
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("type", "api");
            data.Add("action", "send_req_reset_pass");
            data.Add("email", textBox1.Text);

            string json = JsonConvert.SerializeObject(data, Formatting.Indented);
            string answer;

            try
            {
                answer = Service.SendRequestAndGetAnswer(json);
            }
            catch
            {
                MessageBox.Show("Ошибка соединения с сервером\n Повторите позже", "Botinok.fun", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int ans = int.Parse(answer);

            if (ans == 1)
            {
                MessageBox.Show("Проверочный код отправлен на указанный email");
                ServiceReset.email = textBox1.Text;
                Hide();
                Form fm = new Form5();

                fm.ShowDialog();
                Close();
            }
            else if (ans == -1)
            {
                MessageBox.Show("Пользователя с таким email не существует");
            }
            else
            {
                MessageBox.Show("Ошибка сервера\n Повторите позже", "Botinok.fun", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    index, n;
            string Litak_ID;
            string Nazva, Aviakompania_ID, Model, KilkistMisc;
            string SqlText = "DELETE FROM [Litak] WHERE [Litak].Litak_ID = ";

            // перевірка, чи є взагалі записи в таблиці Source
            n = dataGridView1.Rows.Count;
            if (n == 1)
            {
                return;
            }

            Form5 f = new Form5();

            index    = dataGridView1.CurrentRow.Index;
            Litak_ID = Convert.ToString(dataGridView1[0, index].Value);

            // сформувати SQL-команду
            SqlText = SqlText + Litak_ID;

            // заповнити інформаційну довідку у вікні Form5
            Nazva           = Convert.ToString(dataGridView1[1, index].Value);
            Aviakompania_ID = Convert.ToString(dataGridView1[2, index].Value);
            Model           = Convert.ToString(dataGridView1[2, index].Value);
            KilkistMisc     = Convert.ToString(dataGridView1[2, index].Value);

            f.label2.Text = Litak_ID + " - " + Nazva + " - " + Aviakompania_ID + " - " + Model + " - " + KilkistMisc;

            if (f.ShowDialog() == DialogResult.OK) // вивести форму
            {
                // виконати SQL-команду
                MyExecuteNonQuery(SqlText);
                // відобразити таблицю Source
                Litak();
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string _kab1 = textBox1.Text.Substring(0, 3);//считываем данные о нашем местоположении
            string _kab2 = textBox3.Text.Substring(0, 3);

            int kab1 = int.Parse(_kab1 + textBox2.Text);
            int kab2 = int.Parse(_kab2 + textBox4.Text);

            if (kab2 < 2000) // открытие карты 1 этажа
            {
                Form form2 = new Form2();
                form2.ShowDialog();
            }

            else if (kab2 < 3000) // открытие карты 2 этажа
            {
                Form form3 = new Form3(kab1, kab2);
                form3.ShowDialog();
            }
            else if (kab2 < 4000) // открытие карты 3 этажа
            {
                Form form4 = new Form4(kab1, kab2);
                form4.ShowDialog();
            }

            else if (kab2 < 5000) // открытие карты 4 этажа
            {
                Form form5 = new Form5(kab1, kab2);
                form5.ShowDialog();
            }

            else if (kab2 < 6000) // открытие карты 5 этажа
            {
                Form form6 = new Form6(kab1, kab2);
                form6.ShowDialog();
            }
        }
コード例 #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form5 f2 = new Form5();

            f2.ShowDialog();
        }
コード例 #6
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            string sexes = "";

            if (homme.Checked == true)
            {
                sexes = "homme";
            }

            if (femme.Checked == true)
            {
                sexes = "femme";
            }
            if (prenom.Text.Length == 0 || prenom.Text == "Prénom")
            {
                prenom.BorderColorIdle    = Color.Red;
                prenom.BorderColorFocused = Color.Red;
            }
            else
            {
                if (nom.Text.Length == 0 || nom.Text == "Nom")
                {
                    nom.BorderColorIdle    = Color.Red;
                    nom.BorderColorFocused = Color.Red;
                }
                else
                {
                    if (email.Text.Length == 0 || email.Text == "E-mail")
                    {
                        email.BorderColorIdle    = Color.Red;
                        email.BorderColorFocused = Color.Red;
                    }
                    else
                    {
                        if (ages.Text.Length == 0 || ages.Text == "Age") //ajouter chiffre seulement
                        {
                            ages.BorderColorIdle    = Color.Red;
                            ages.BorderColorFocused = Color.Red;
                        }
                        else
                        {
                            if (homme.Checked == false && femme.Checked == false)
                            {
                                homme.BackColor = Color.Red;
                                femme.BackColor = Color.Red;
                            }
                            else
                            {
                                if (mdp.Text.Length == 0 || mdp.Text == "Mot de passe")
                                {
                                    mdp.BorderColorIdle    = Color.Red;
                                    mdp.BorderColorFocused = Color.Red;
                                }
                                else
                                {
                                    if (pseudo.Text.Length == 0 || pseudo.Text == "Pseudo")
                                    {
                                        pseudo.BorderColorIdle    = Color.Red;
                                        pseudo.BorderColorFocused = Color.Red;
                                    }
                                    else
                                    {
                                        TcpClient     sendregisterinfo        = new TcpClient(Form5.ip, 9856);
                                        NetworkStream nsendinfo               = sendregisterinfo.GetStream();
                                        string        msgsendinfo             = "RegisterRequest:|" + prenom.Text + "|" + nom.Text + "|" + email.Text + "|" + ages.Text + "|" + sexes + "|" + mdp.Text + "|" + "0" + "|" + "0" + "|" + "0" + "|" + pseudo.Text;
                                        byte[]        messagesendregisterinfo = Encoding.Unicode.GetBytes(msgsendinfo);
                                        nsendinfo.Write(messagesendregisterinfo, 0, messagesendregisterinfo.Length);
                                        // on attend la réponse

                                        byte[] buffer = new byte[sendregisterinfo.ReceiveBufferSize];
                                        int    data   = nsendinfo.Read(buffer, 0, sendregisterinfo.ReceiveBufferSize);
                                        string msg    = Encoding.Unicode.GetString(buffer, 0, data);

                                        if (msg == "Mail déjà pris")
                                        {
                                            email.BorderColorIdle    = Color.Red;
                                            email.BorderColorFocused = Color.Red;
                                            MessageBox.Show("Mail déjà pris !");
                                        }
                                        else
                                        {
                                            if (msg == "Pseudo déjà pris")
                                            {
                                                pseudo.BorderColorIdle    = Color.Red;
                                                pseudo.BorderColorFocused = Color.Red;
                                                MessageBox.Show("Pseudo déjà pris !");
                                            }
                                            else
                                            {
                                                if (msg == "Inscrit avec succès")
                                                {
                                                    this.Hide();
                                                    Form5 frm = new Form5();
                                                    frm.ShowDialog();
                                                    this.Close();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form5 f5 = new Form5();

            f5.ShowDialog();
        }
コード例 #8
0
 private void button5_Click(object sender, EventArgs e)
 {
     form5.ShowDialog();
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: SomeLeftGuy/Kursach_True
        private void button9_Click(object sender, EventArgs e)
        {
            if (act_table == 1) // обрабатываем таблицу "Билет"
            {
                Form4 f = new Form4();

                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Билеты"
                    Add_Bilet(f.textBox1.Text, f.textBox2.Text, Convert.ToDateTime(f.textBox3.Text),
                              f.textBox4.Text, f.textBox5.Text, f.checkBox1.Checked);
                    Get_Bilets();
                }
            }
            else
            if (act_table == 2) // обрабатываем таблицу "Маршрут"
            {
                Form5 f = new Form5();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Маршрут"
                    Add_Marshrut(f.textBox1.Text, f.textBox2.Text, f.textBox3.Text, f.textBox4.Text,
                                 Convert.ToDouble(f.textBox5.Text), Convert.ToDouble(f.textBox6.Text),
                                 f.dateTimePicker1.Value, f.dateTimePicker2.Value);
                    Get_Marshruts();
                }
            }
            else
            if (act_table == 3)  // обрабатываем таблицу "Автобус"
            {
                Form6 f = new Form6();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Автобус"
                    Add_Avtobus(f.textBox1.Text, f.textBox2.Text, f.textBox3.Text, f.textBox4.Text);
                    Get_Avtobus();
                }
            }
            else
            if (act_table == 4) // обрабатываем таблицу "Водитель"
            {
                Form7 f = new Form7();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Водитель"
                    Add_Voditel(f.textBox1.Text, Convert.ToString(f.dateTimePicker1.Value), f.textBox2.Text);
                    Get_Voditel();
                }
            }
            else
            if (act_table == 5) // обрабатываем таблицу "Диспетчер"
            {
                Form8 f = new Form8();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    // добавляем данные в таблицу "Диспетчер"
                    Add_Dispetcher(f.textBox1.Text, Convert.ToString(f.dateTimePicker1.Value), f.textBox2.Text);
                    Get_Dispetcher();
                }
            }
        }
コード例 #10
0
ファイル: Form2.cs プロジェクト: misha6757/sil-nierebayta
        private void партнерыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form5 f5 = new Form5();

            f5.ShowDialog();
        }
コード例 #11
0
        private void histogramAlToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form5 histogramalma = new Form5();

            histogramalma.ShowDialog();
        }
コード例 #12
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            tenkhachhang = textBox1.Text;
            sodienthoai  = textBox2.Text;

            string newtext = Helper.readtext("customers.txt");

            if ((newtext).Contains(tenkhachhang) == false)
            {
                List <string> customers = new List <string> {
                    newtext + tenkhachhang + "\n"
                };
                Helper.writetext("customers.txt", customers);
            }

            string path1 = "tongtien.txt";
            //FileStream fs = File.Create(path1);
            int           newmoney  = Form6.sumMoney + int.Parse(Helper.readtext2(path1));
            List <string> tongtienn = new List <string> {
                newmoney.ToString()
            };

            Helper.writetext(path1, tongtienn);
            string path2 = "/thanhtoan/tongtien" + tenkhachhang + ".txt";

            if (File.Exists(path2))
            {
                int        newmoney2 = Form6.sumMoney + int.Parse(Helper.readtext2(path2));
                FileStream fs        = File.Create(path2);
                fs.Close();
                File.WriteAllText(path2, "0");
                fs.Close();

                File.WriteAllText(path2, newmoney2.ToString());

                fs.Close();
            }
            else
            {
                FileStream fs = File.Create(path2);
                fs.Close();
                File.WriteAllText(path2, Form6.sumMoney.ToString());
                fs.Close();
            }

            //    int newmoney2 = Form6.sumMoney + int.Parse(Helper.readtext2(path2));
            //List<string> tongtiennn = new List<string> { newmoney2.ToString() };
            //using (StreamWriter sw = new StreamWriter(path2))
            //{

            //    foreach (string s in tongtiennn)
            //    {
            //        sw.WriteLine(s);
            //    }
            //}
            diemtichluy = int.Parse(Helper.readtext2(path2)) / 1000;
            if (diemtichluy <= 100)
            {
                MessageBox.Show("Điểm tích lũy của bạn: " + diemtichluy + "\n" + "Bạn là thành viên thông thường\n" + "Chưa đủ điều kiện để nhận ưu đãi");
            }
            else
            {
                MessageBox.Show("Điểm tích lũy của bạn: " + diemtichluy + "\n" + "Bạn là thành viên VIP\n" + "Được hưởng 10% ưu đãi");
            }
            //System.IO.File.WriteAllLines(path1, tongtienn);

            // Helper.CreateFolder(path);
            this.Hide();
            Form5 f = new Form5();

            f.ShowDialog();
        }
コード例 #13
0
ファイル: Form1.cs プロジェクト: Ionnier/Atestat
        private void button1_Click(object sender, EventArgs e)
        {
            string password = SecurePasswordHasher.Hash(txtpass.Text);
            string html     = string.Empty;
            string url      = @"https://localhost:8080/searchu?username="******"C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem";
                //X509Certificate cert = new X509Certificate2(Certificate,"cert112",);
                //X509Certificate cert = new X509Certificate();
                //cert.Import()
                //request.ClientCertificates.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(Certificate)));


                // if everything else fails System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

                //  request.ClientCertificates.Add(new X509Certificate("C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/server.crt","cert112"));
                // The path to the certificate.
                //string Certificate = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem";

                // Load the certificate into an X509Certificate object.
                // X509Certificate cert = new X509Certificate();



                /*string file="C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem"; // Contains name of certificate file
                 * X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
                 * store.Open(OpenFlags.ReadWrite);
                 * store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file)));
                 * store.Close();*/


                //X509Certificate2 Cert = new X509Certificate2();
                //string file = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/certificate.pkcs12"; // Contains name of certificate file
                //Cert.Import(file, "123", X509KeyStorageFlags.PersistKeySet);
                //request.ClientCertificates.Add(Cert);

                /*string file = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem";
                 * X509Certificate2 mycert = new X509Certificate2();
                 * mycert.Import(file, "cert112", X509KeyStorageFlags.PersistKeySet);
                 * request.ClientCertificates.Add(mycert);*/
                request.AutomaticDecompression = DecompressionMethods.GZip;

                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (Stream stream = response.GetResponseStream())
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            html = reader.ReadToEnd();
                        }
                Console.WriteLine(html);

                if (html == "Baza de date offline")
                {
                    MessageBox.Show("Baza de date offline");
                }
                else
                {
                    try
                    {
                        //Console.WriteLine(html);



                        var resultscan = JsonConvert.DeserializeObject <List <RootObject> >(html);

                        try
                        {
                            obj = resultscan[0];
                            bool vf;
                            Console.WriteLine(obj.password);
                            vf = SecurePasswordHasher.Verify(txtpass.Text, obj.password);
                            if (vf)
                            {
                                name = obj.username;

                                if (obj.admin == 1)
                                {
                                    using (Form5 f5 = new Form5())
                                    {
                                        this.Hide();
                                        f5.ShowDialog(this);
                                        this.Close();
                                    }
                                }
                                else if (obj.admin == 0)
                                {
                                    using (Form8 f8 = new Form8())
                                    {
                                        this.Hide();
                                        f8.ShowDialog(this);
                                        this.Close();
                                    }

                                    /*
                                     * AppCointainer container = new AppCointainer();
                                     * container.Tabs.Add(
                                     * new TitleBarTab(container)
                                     * {
                                     *    Content = new Form6
                                     *    {
                                     *        Text= "New Tab"
                                     *    }
                                     * }
                                     * );
                                     *
                                     * container.SelectedTabIndex = 0;
                                     * this.Hide();
                                     * TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext();
                                     * applicationContext.Start(container);
                                     */
                                }
                                else
                                {
                                    using (Form4 f4 = new Form4())
                                    {
                                        this.Hide();
                                        f4.ShowDialog(this);
                                        this.Close();
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show("Nume de utilizator sau parola incorecta.");
                            }
                        }
                        //
                        catch { MessageBox.Show("Nume de utilizator sau parola incorecta."); }
                    }
                    catch { MessageBox.Show("A cazut serverul."); }
                }
            }
            catch { MessageBox.Show("A cazut serverul"); }


            // RootObject  obj= JsonConvert.DeserializeObject<RootObject>(html);
        }
コード例 #14
0
        private void 회원ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form5 showForm5 = new Form5();

            showForm5.ShowDialog();
        }
コード例 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            FileStream file1 = new FileStream("password.txt", FileMode.OpenOrCreate);

            StreamReader reader = new StreamReader(file1);

            _passLine = reader.ReadToEnd();

            reader.Close();
            string _crresultChar  = "";
            string _randomLine    = "нуkы6мцc5вlт2шajдdрэ1лrъефx3ogbeжохfа0hipnп97и8qкvщtючьzmсsзywuг4йб";
            string _cryptedString = "";
            string _result        = "";
            string _resultChar    = "";
            Random _rand          = new Random();
            int    _d             = (int)Math.Ceiling(Math.Sqrt(_line.Length));

            if (_d % 2 != 1)
            {
                _d++;
            }
            int[,] _quad = new int[_d, _d];
            for (int j = 0; j < _d; j++)
            {
                for (int i = 0; i < _d; i++)
                {
                    _quad[i, j] = _d * (((i + 1) + (j + 1) - 1 + (_d / 2)) % _d) + (((i + 1) + 2 * (j + 1) - 2) % _d) + 1;
                    _resultChar = (_quad[i, j].ToString() + " ");
                    _result    += _resultChar;
                }
            }
            for (int j = 0; j < _d; j++)
            {
                for (int i = 0; i < _d; i++)
                {
                    if ((_quad[i, j] - 1) < _line.Length)
                    {
                        _cryptedString += _line[_quad[i, j] - 1]; _crresultChar += _line[_quad[i, j] - 1];
                    }
                    else
                    {
                        char _randomChar = _randomLine[j];
                        _cryptedString += _randomChar; _crresultChar += _randomChar;
                    }
                }
            }



            if (_passLine.Length == 0)
            {
                Hide();
                Form Form5 = new Form5();
                Form5.ShowDialog();
                Close();
            }
            else
            if (_cryptedString == _passLine)
            {
                Hide();
                Form Form2 = new Form2();
                Form2.ShowDialog();
                Close();
            }


            else
            {
                textBox1.Text = ""; i--; label2.Text = "Осталось попыток " + i + ".";
            }
            if (i == 1)
            {
                Form Form3 = new Form3(); Form3.ShowDialog();
            }
            if (i == 0)
            {
                Close();
            }
        }
コード例 #16
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form5 showForm5 = new Form5();

            showForm5.ShowDialog();
        }