Esempio n. 1
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. 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Form7 f7 = new Form7();

            if (f7.ShowDialog(this) == DialogResult.OK)
            {
                //timer2.Enabled = true;
                this.Close();
            }
        }
Esempio n. 3
0
        private void button6_Click(object sender, EventArgs e)
        {
            int    index, index_src, n;
            string SqlText = "UPDATE [Aviakompania] SET ";
            string Aviakompania_ID, Litak_ID, Nazva, NomerTelefony, EMail;
            string Name_Source;

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

            Form7 f = new Form7();

            // заповнити форму даними перед відкриттям
            index           = dataGridView2.CurrentRow.Index;
            Aviakompania_ID = dataGridView2[0, index].Value.ToString();
            Litak_ID        = dataGridView2[1, index].Value.ToString();
            Nazva           = dataGridView2[2, index].Value.ToString();
            NomerTelefony   = dataGridView2[3, index].Value.ToString();
            EMail           = dataGridView2[4, index].Value.ToString();

            index_src   = dataGridView1.CurrentRow.Index;
            Name_Source = dataGridView1[1, index_src].Value.ToString();

            //
            f.label1.Text   = Name_Source;
            f.textBox1.Text = Nazva;
            f.textBox2.Text = NomerTelefony;
            f.textBox3.Text = EMail;

            if (f.ShowDialog() == DialogResult.OK)
            {
                Nazva         = f.textBox1.Text;
                NomerTelefony = f.textBox2.Text;
                EMail         = f.textBox3.Text;

                SqlText += "Nazva = " + Nazva + ", NomerTelefony = \'" + NomerTelefony + "\', EMail = \'" + EMail + "\' ";
                SqlText += "WHERE [Aviakompania].Aviakompania_ID = " + Aviakompania_ID;

                MyExecuteNonQuery(SqlText);
                Aviakompania();
            }
        }
Esempio n. 4
0
 private void button7_Click(object sender, EventArgs e)
 {
     form7.ShowDialog();
 }
Esempio n. 5
0
        private void Form8_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                button1.PerformClick();
            }

            if (e.KeyCode == Keys.Oemplus || e.KeyCode == Keys.Add)
            {
                if (tabel == 1)
                {
                    string html2 = string.Empty;
                    int    zi    = DateTime.Today.Day;
                    int    an    = DateTime.Today.Year;
                    int    luna  = DateTime.Today.Month;
                    string url2  = @"https://*****:*****@"https://localhost:8080/createproduct";
                     * // https://localhost:8080/createbill?zi=3&luna=14&an=2444
                     *
                     * HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url2);
                     * request.AutomaticDecompression = DecompressionMethods.GZip;
                     * using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                     * using (Stream stream = response.GetResponseStream())
                     * using (StreamReader reader = new StreamReader(stream))
                     * {
                     *  html2 = reader.ReadToEnd();
                     * }
                     *
                     *
                     * if (html2 == "Executat")
                     * {
                     *  populateDGV2();
                     * }
                     * else if (html2 == "Baza de date offline")
                     * {
                     *  MessageBox.Show("Baza de date offline", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     * }
                     */
                }

                else if (tabel == 3)
                {
                }
            }

            if (e.KeyCode == Keys.Delete)
            {
                if (tabel == 1)
                {
                    if (dataGridView1.SelectedRows.Count == 0)
                    {
                    }
                    else
                    {
                        int counterr = 0;
                        foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                        {
                            int indexx = int.Parse(row.Index.ToString());

                            int id;
                            id = int.Parse(dataGridView1.Rows[indexx].Cells["ID"].Value.ToString());

                            string html23 = string.Empty;
                            string url23  = @"https://*****:*****@"https://localhost:8080/deletegridproduct?id=" + id + "&tip=" + ctip;

                            // https://localhost:8080/deletegridu?id=14
                            Console.WriteLine(url23);
                            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url23);
                            request.AutomaticDecompression = DecompressionMethods.GZip;
                            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                                using (Stream stream = response.GetResponseStream())
                                    using (StreamReader reader = new StreamReader(stream))
                                    {
                                        html23 = reader.ReadToEnd();
                                    }


                            if (html23 == "Executat")
                            {
                                counterr = 1;
                            }
                        }
                        if (counterr == 0)
                        {
                            MessageBox.Show("Baza de date offline", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            populateDGV2();
                        }
                    }
                }

                else if (tabel == 3)
                {
                }
            }

            if (e.Control & e.KeyCode.ToString() == "S")
            {
                if (tabel != 0)
                {
                    using (Form7 form7 = new Form7())
                    {
                        if (form7.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (form7.SelectedText == "CSV")
                            {
                                if (tabel == 1)
                                {
                                    SaveToCSV(dataGridView1);
                                }
                                else
                                if (tabel == 2)
                                {
                                    SaveToCSV(dataGridView2);
                                }
                                else
                                if (tabel == 3)
                                {
                                    SaveToCSV(dataGridView3);
                                }
                                else
                                if (tabel == 4)
                                {
                                    SaveToCSV(dataGridView4);
                                }
                            }
                            else if (form7.SelectedText == "PDF")
                            {
                                if (tabel == 1)
                                {
                                    SavePDF(dataGridView1, "Facturi");
                                }
                                else
                                if (tabel == 2)
                                {
                                    SavePDF(dataGridView2, "Produse");
                                }
                                else
                                if (tabel == 3)
                                {
                                    SavePDF(dataGridView3, "Calculatoare");
                                }
                                else
                                if (tabel == 4)
                                {
                                    SavePDF(dataGridView4, "Telefoane");
                                }
                            }
                        }
                    }
                }

                /* if (tabel == 1) {
                 *  SavePDF(dataGridView1);
                 *
                 * } if (tabel == 2)
                 * {
                 *  SaveToCSV(dataGridView2);
                 * }*/
            }

            if (e.KeyCode == Keys.G)
            {
                if (tabel == 2)
                {
                    if (dataGridView2.SelectedRows.Count == 0)
                    {
                    }
                    else
                    {
                        int counterr = 0;
                        foreach (DataGridViewRow row in dataGridView2.SelectedRows)
                        {
                            int indexx = int.Parse(row.Index.ToString());

                            int id;
                            id = int.Parse(dataGridView2.Rows[indexx].Cells["ID"].Value.ToString());
                            string html23 = string.Empty;
                            string url23  = @"https://localhost:8080/generatesale?produs=" + id;

                            // https://localhost:8080/deletegridu?id=14
                            Console.WriteLine(url23);
                            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url23);
                            request.AutomaticDecompression = DecompressionMethods.GZip;
                            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                                using (Stream stream = response.GetResponseStream())
                                    using (StreamReader reader = new StreamReader(stream))
                                    {
                                        html23 = reader.ReadToEnd();
                                    }


                            if (html23 == "Executat")
                            {
                                counterr = 1;
                            }
                        }
                        if (counterr == 0)
                        {
                            MessageBox.Show("Baza de date offline", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            populateDGV2();
                        }
                    }
                }
            }

            if (e.KeyCode == Keys.R)
            {
                using (Form11 f8 = new Form11())
                {
                    f8.ShowDialog(this);
                }
            }
        }
Esempio n. 6
0
        private void аксToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 f7 = new Form7();

            f7.ShowDialog();
        }
Esempio n. 7
0
        private void button3_Click_2(object sender, EventArgs e)
        {
            Form7 hf = new Form7();

            hf.ShowDialog();
        }
        private void toplamaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 invert = new Form7();

            invert.ShowDialog();
        }
Esempio n. 9
0
        private void Form6_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                //button2.PerformClick();
            }

            if (e.KeyCode == Keys.Oemplus || e.KeyCode == Keys.Add)
            {
                if (tabel == 1)
                {
                    string html2 = string.Empty;
                    int    zi    = DateTime.Today.Day;
                    int    an    = DateTime.Today.Year;
                    int    luna  = DateTime.Today.Month;
                    string url2  = @"https://*****:*****@"https://localhost:8080/createproduct";
                    // https://localhost:8080/createbill?zi=3&luna=14&an=2444

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url2);
                    request.AutomaticDecompression = DecompressionMethods.GZip;
                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                        using (Stream stream = response.GetResponseStream())
                            using (StreamReader reader = new StreamReader(stream))
                            {
                                html2 = reader.ReadToEnd();
                            }


                    if (html2 == "Executat")
                    {
                        populateDGV2();
                    }
                    else if (html2 == "Baza de date offline")
                    {
                        MessageBox.Show("Baza de date offline", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                else if (tabel == 3)
                {
                }
            }

            if (e.KeyCode == Keys.Delete)
            {
                if (tabel == 1)
                {
                    if (dataGridView1.SelectedRows.Count == 0)
                    {
                    }
                    else
                    {
                        int counterr = 0;
                        foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                        {
                            int indexx = int.Parse(row.Index.ToString());

                            int id;
                            id = int.Parse(dataGridView1.Rows[indexx].Cells["ID"].Value.ToString());

                            string html23 = string.Empty;
                            string url23  = @"https://*****:*****@"https://localhost:8080/deletegridproduct?id=" + id;
                            // https://localhost:8080/deletegridu?id=14

                            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url23);
                            request.AutomaticDecompression = DecompressionMethods.GZip;
                            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                                using (Stream stream = response.GetResponseStream())
                                    using (StreamReader reader = new StreamReader(stream))
                                    {
                                        html23 = reader.ReadToEnd();
                                    }


                            if (html23 == "Executat")
                            {
                                counterr = 1;
                            }
                        }
                        if (counterr == 0)
                        {
                            MessageBox.Show("Baza de date offline", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            populateDGV2();
                        }
                    }
                }

                else if (tabel == 3)
                {
                }
            }

            if (e.Control & e.KeyCode.ToString() == "S")
            {
                if (tabel != 0)
                {
                    using (Form7 form7 = new Form7())
                    {
                        if (form7.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            if (form7.SelectedText == "CSV")
                            {
                                if (tabel == 1)
                                {
                                    SaveToCSV(dataGridView1);
                                }
                                else
                                if (tabel == 2)
                                {
                                    SaveToCSV(dataGridView2);
                                }
                            }
                            else if (form7.SelectedText == "PDF")
                            {
                                if (tabel == 1)
                                {
                                    SavePDF(dataGridView1, "Facturi");
                                }
                                else
                                if (tabel == 2)
                                {
                                    SavePDF(dataGridView2, "Produse");
                                }
                            }
                        }
                    }
                }

                /* if (tabel == 1) {
                 *  SavePDF(dataGridView1);
                 *
                 * } if (tabel == 2)
                 * {
                 *  SaveToCSV(dataGridView2);
                 * }*/
            }
        }