Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form8 f = new Form8();

            this.Hide();
            f.ShowDialog();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form8 f8 = new Form8();

            this.Hide();
            f8.ShowDialog();
            this.Close();
        }
Esempio n. 3
0
 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.dateTimePicker1.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();
         }
     }
 }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //string printbill = "Thoi gian: " + DateTime.UtcNow + Constants.endline + fDrinklist.sanPhamBuill + Constants.endline + "So tien tich luy: " + fDrinklist.sum + "->Diem tich luy: " + Constants.endline + fDrinklist.sumMoney;
            ////Helper.CreateFolder(Form3.textBox1);
            //var arrayPrintBill = new List<string>
            //{
            //    printbill,
            //};
            //var path = Helper.writeonfile("091232323", "leee", arrayPrintBill);



            //Helper.writetext(path, arrayPrintBill);

            string username = tbUsername.Text;
            string password = tbpassword.Text;
            bool   a        = Helper.Checkstaff(username, password);

            if (a == true)
            {
                string loichao1 = "You are now login as staff ";
                staffname = Helper.Checkstaffname(username, password);
                MessageBox.Show(loichao1 + "\nWelcome " + staffname);
                string        textt        = Helper.readtext("quanlynhanvien.txt");
                List <string> newstaffname = new List <string> {
                    textt + "\n" + staffname + ":\n Bat dau lam viec: " + DateTime.Now + "\n Ket thuc:"
                };
                Helper.writetext("quanlynhanvien.txt", newstaffname);
                Form6 f = new Form6();
                this.Hide();
                f.ShowDialog();
            }
            else
            {
                if (username == "ticklabcoffee" && password == "ticklabcoffee")
                {
                    string loichao2 = "You are now login as admin ";
                    MessageBox.Show(loichao2 + "\nWelcome ticklabcoffee");
                    Form8 f = new Form8();
                    this.Hide();
                    f.ShowDialog();
                }
                else
                {
                    MessageBox.Show("I am sorry, your username and password are incorrect");
                }
            }
        }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            //string text;
            //List<string> tendangnhap = new List<string> {"\n"+ textBox1.Text+"\n" };
            //List<string> matkhau = new List<string> { "\n" + textBox2.Text + "\n" };
            //List<string> ten = new List<string> { "\n" + textBox3.Text + "\n" };
            // text = Helper.readtext("staff.txt");
            // List<string> text = new List<string> { Helper.readtext("staff.txt") };
            string        tendangnhap = "\n" + textBox1.Text + "\n";
            string        matkhau     = textBox2.Text + "\n";
            string        ten         = textBox3.Text;
            string        text        = Helper.readtext("staff.txt");
            List <string> giatri      = new List <string> {
                text + tendangnhap + matkhau + ten
            };

            Helper.writetext("staff.txt", giatri);
            //Helper.writetext("staff.txt", matkhau);
            //Helper.writetext("staff.txt", ten);
            this.Hide();
            Form8 f = new Form8();

            f.ShowDialog();
        }
Esempio n. 6
0
        private void searchEmployeeButton_Click(object sender, EventArgs e)
        {
            Form8 form8 = new Form8();

            form8.ShowDialog();

            if (form8.answer)
            {
                dataView.AllowUserToAddRows = false;
                dataView.ReadOnly           = true;
                addSalaryButton.Enabled     = false;
                ShowEmployeeSalary.Enabled  = false;

                query = "SELECT * from Pracownicy WHERE ";
                if (form8.employeeID != 0)
                {
                    query = query + "nr_pracownika=" + form8.employeeID + " AND ";
                }
                if (form8.oddzialID != 0)
                {
                    query = query + "nr_oddzialu=" + form8.oddzialID + " AND ";
                }
                if (form8.name != "")
                {
                    query = query + "Imie='" + form8.name + "' AND ";
                }
                if (form8.surname != "")
                {
                    query = query + "Nazwisko='" + form8.surname + "' AND ";
                }
                if (form8.numberPESEL != "")
                {
                    query = query + "PESEL='" + form8.numberPESEL + "' AND ";
                }
                if (form8.birthDate != "")
                {
                    query = query + "Data_urodzenia=date '" + form8.birthDate + "' AND ";
                }
                if (form8.jobTitle != "")
                {
                    query = query + "Nr_stanowiska=(SELECT nr_stanowiska from Stanowiska WHERE Nazwa='" + form8.jobTitle + "') AND ";
                }

                query = query.Substring(0, query.Length - 5);
                if (form8.employeeID == 0 && form8.oddzialID == 0 && form8.name == "" && form8.surname == "" && form8.numberPESEL == "" && form8.birthDate == "" && form8.jobTitle == "")
                {
                    query = "SELECT * from Pracownicy";
                }


                Console.WriteLine(query);
                try
                {
                    using (connection = new OracleConnection(connectionString))
                    {
                        dataAdapter = new OracleDataAdapter(query, connection);
                        dataTable   = new DataTable();
                        dataAdapter.Fill(dataTable);
                        dataView.DataSource = dataTable;
                    }
                }
                catch (Oracle.DataAccess.Client.OracleException oe)
                {
                    MessageBox.Show("Nie udało sie znależć takiego pracownika");
                    return;
                }
            }
        }
Esempio n. 7
0
        private void аксессуарыЛодкиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form8 f8 = new Form8();

            f8.ShowDialog();
        }
        private void thresHoldToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form8 invert = new Form8();

            invert.ShowDialog();
        }
Esempio n. 9
0
        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);
        }