Пример #1
0
        private void button15_Click(object sender, EventArgs e)
        {
            soundButton();
            if (int.Parse(sum) > 1000)
            {
                MessageBox.Show("Вы нарушили лимит", "Ошибка");
            }
            else
            {
                BD      bD        = new BD();
                DataSet dataTable = new DataSet();

                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());
                command.Parameters.Add("@uc", MySqlDbType.VarChar).Value = key;

                adapter.SelectCommand = command;
                adapter.Fill(dataTable);

                int summa  = int.Parse(textBox2.Text);
                int amount = 0;
                if (dataTable.Tables[0].Rows.Count > 0)
                {
                    amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
                }

                MySqlConnection conn   = bD.getConnection();
                string          result = (amount - summa).ToString();
                if (amount < summa)
                {
                    MessageBox.Show("Недостаточно средств", "Ошибка");
                }
                else
                {
                    MySqlCommand command1 = conn.CreateCommand();
                    command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                    command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                    command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;
                    conn.Open();
                    command1.ExecuteNonQuery();
                    conn.Close();

                    Form7 form7 = new Form7(summa, opertaion);
                    form7.Show();
                    this.Hide();
                }
            }
        }
 public Form2(Form1 ParentForm)
 {
     InitializeComponent();
     form3           = new Form3(this);
     form3.MdiParent = this;
     form4           = new Form4(this);
     form4.MdiParent = this;
     form5           = new Form5(this);
     form5.MdiParent = this;
     form6           = new Form6(this);
     form6.MdiParent = this;
     form7           = new Form7(this);
     form7.MdiParent = this;
     form9           = new Form9(this);
     form9.MdiParent = this;
     form1           = ParentForm;
 }
Пример #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();
            }
        }
Пример #4
0
        //Выдача денег
        private void button10_Click(object sender, EventArgs e)
        {
            soundButton();

            //Работа с БД (уменьшение средств на счете)
            BD      bD        = new BD();
            DataSet dataTable = new DataSet();

            MySqlDataAdapter adapter = new MySqlDataAdapter();
            MySqlCommand     command = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());

            command.Parameters.Add("@uc", MySqlDbType.VarChar).Value = key;

            adapter.SelectCommand = command;
            adapter.Fill(dataTable);

            int summa  = int.Parse(textBox1.Text);
            int amount = 0;

            if (dataTable.Tables[0].Rows.Count > 0)
            {
                amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
            }
            if (amount < summa)
            {
                MessageBox.Show("Недостаточно средств", "Ошибка");
            }
            else
            {
                MessageBox.Show($"Баланс {amount}");
                if (summa > 1000 || summa < 1)
                {
                    MessageBox.Show("Вы нарушили лимит (от 0 до 1000 рублей)", "Ошибка");
                    textBox1.Text = "";
                }
                else
                {
                    if (summa % 5 == 0) //Проверка н кратность (так как наличная сумма в любом случаи должна делиться на 5)
                    {
                        MySqlConnection conn   = bD.getConnection();
                        string          result = (amount - summa).ToString();
                        MessageBox.Show($"Result {result}");
                        MySqlCommand command1 = conn.CreateCommand();
                        command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                        command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                        command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;
                        conn.Open();
                        command1.ExecuteNonQuery();
                        conn.Close();

                        SoundPlayer soundPlayer1 = new SoundPlayer("after.wav");
                        SoundPlayer soundPlayer  = new SoundPlayer("cash.wav");
                        soundPlayer1.Load();
                        soundPlayer1.PlaySync();
                        soundPlayer.Load();
                        soundPlayer.PlaySync();
                        textBox1.Text = null;
                        sum           = "";
                        Form7 form7 = new Form7(summa, opertaion);
                        form7.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Мы не можем выдыть сумму с таким номиналом", "Ошибка");
                        textBox1.Text = null;
                        sum           = "";
                    }
                }
            }
        }
Пример #5
0
        private void пісочницяToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 form7 = new Form7();

            form7.Show();
        }
Пример #6
0
        private void button5_Click(object sender, EventArgs e)
        {
            Form7 otobus = new Form7();

            otobus.Show();
        }
Пример #7
0
        private void promanage_Click_1(object sender, EventArgs e)
        {
            Form7 form = new Form7();

            form.Show();
        }
Пример #8
0
        private void bunifuThinButton22_Click_2(object sender, EventArgs e)
        {
            Form7 frms = new Form7();

            frms.Show();
        }
Пример #9
0
        private void button4_Click(object sender, EventArgs e)
        {
            Form7 form7 = new Form7();

            form7.Show();
        }
Пример #10
0
        /// <summary>
        /// 通用按钮点击选项卡 在选项卡上显示对应的窗体
        /// </summary>
        private void btnX_Click(object sender, EventArgs e)
        {
            string formClass = ((TabControl)sender).SelectedTab.Tag.ToString();

            //string form = tabControl1.SelectedTab.Tag.ToString();

            Form      fm  = null;
            DBConn    db  = null;
            DataTable dt  = null;
            string    sql = "";

            switch (formClass)
            {
            case "Form5":     //身份验证信息
                fm = new Form5(aac044, frm, str_id);
                break;

            case "Form6":    //就诊登记
                fm = new Form6(sf, str_id);
                break;

            case "Form10":    //费用明细录入
                db  = new DBConn();
                sql = "select * from gxjzdj where aac044 = '" + sf.aac044 + "'and id =" + str_id;
                dt  = db.GetDataSet(sql).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    gxjzdj gx   = new gxjzdj();
                    var    pros = gx.GetType().GetProperties();
                    foreach (var p in pros)
                    {
                        p.SetValue(gx, dt.Rows[0][p.Name].ToString(), null);
                    }
                    fm = new Form10(gx, str_id);
                }
                break;

            case "Form7":    //出院登记
                DBConn con = new DBConn();
                sql = "select * from fymxjl where aac044 = '" + sf.aac044 + "' and id = " + str_id;
                dt  = con.GetDataSet(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    sql = "select * from fhjzdj where aac044 = '" + sf.aac044 + "' and id = " + str_id;
                    dt  = con.GetDataSet(sql).Tables[0];
                    string ykc700 = dt.Rows[0]["ykc700"].ToString();
                    fm = new Form7(sf, ykc700, str_id);
                }
                break;

            case "Form12":    //模拟结算
                db  = new DBConn();
                sql = "select * from cydj where aac044 = '" + sf.aac044 + "' and id = " + str_id;
                dt  = db.GetDataSet(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    fm = new Form12(this.sf, str_id);
                }
                break;

            case "Form14":     //费用结算
                db  = new DBConn();
                sql = "select * from cydj where aac044 = '" + sf.aac044 + "' and id = " + str_id;
                dt  = db.GetDataSet(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    fm = new Form14(sf, str_id);;;
                }
                break;

            case "Form15":
                db  = new DBConn();
                sql = "select * from gxjzdj where aac044 = '" + sf.aac044 + "' and id = " + str_id;
                dt  = db.GetDataSet(sql).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    gxjzdj gx   = new gxjzdj();
                    var    pros = gx.GetType().GetProperties();
                    foreach (var p in pros)
                    {
                        p.SetValue(gx, dt.Rows[0][p.Name].ToString(), null);
                    }
                    fm = new Form15(gx, str_id);
                }
                break;

            default:

                break;
            }
            if (fm == null)
            {
                int zt = int.Parse(qj.getGxStatus(aac044, str_id));
                foreach (var q in qj.status)
                {
                    if (int.Parse(q.Key) == zt + 1)
                    {
                        ((TabControl)sender).SelectedTab.Controls.Clear();
                        MessageBox.Show("请先完成:" + q.Value);
                        return;
                    }
                }
            }
            ((TabControl)sender).SelectedTab.Controls.Clear();
            fm.FormBorderStyle = FormBorderStyle.None;
            fm.TopLevel        = false;
            fm.Parent          = ((TabControl)sender).SelectedTab;
            fm.ControlBox      = false;
            fm.Dock            = DockStyle.Fill;
            fm.Anchor          = AnchorStyles.None;
            fm.Show();

            //s[((TabControl)sender).SelectedIndex] = 1;
        }
Пример #11
0
        private void button15_Click(object sender, EventArgs e)
        {
            soundButton();
            MessageBox.Show($"{number}");
            if (Convert.ToInt32(sum) < 1000)
            {
                //Работа с БД (уменьшение средств на счете)
                BD               bD         = new BD();
                DataSet          dataTable  = new DataSet();
                DataSet          dataTable2 = new DataSet();
                MySqlDataAdapter adapter    = new MySqlDataAdapter();
                MySqlDataAdapter adapter1   = new MySqlDataAdapter();
                MySqlCommand     command    = new MySqlCommand("SELECT money FROM clients WHERE code = @uc", bD.getConnection());
                command.Parameters.Add("@uc", MySqlDbType.VarChar).Value = key;

                MySqlCommand command2 = new MySqlCommand("SELECT money FROM clients WHERE number = @un", bD.getConnection());
                command2.Parameters.Add("@un", MySqlDbType.VarChar).Value = number;


                adapter.SelectCommand = command;
                adapter.Fill(dataTable);
                MessageBox.Show($"{number}");

                adapter1.SelectCommand = command2;
                adapter1.Fill(dataTable2);

                int summa      = int.Parse(textBox2.Text);
                int amount     = 0;
                int new_amount = 0; //Баланс получателя

                if (dataTable.Tables[0].Rows.Count > 0)
                {
                    amount = int.Parse(dataTable.Tables[0].Rows[0][0].ToString());
                }

                if (amount < summa)
                {
                    MessageBox.Show("Недостаточно средств", "Ошибка");
                }
                else
                {
                    if (dataTable2.Tables[0].Rows.Count > 0)
                    {
                        new_amount = int.Parse(dataTable2.Tables[0].Rows[0][0].ToString());
                    }

                    MySqlConnection conn       = bD.getConnection();
                    string          result     = (amount - summa).ToString();
                    string          new_result = (new_amount + summa).ToString();
                    MessageBox.Show($"Result {result}");
                    MessageBox.Show($"Result {new_result}");
                    MySqlCommand command1 = conn.CreateCommand();
                    MySqlCommand command3 = conn.CreateCommand();
                    command1.CommandText = "UPDATE clients SET money = @res WHERE code = @uckey";
                    command1.Parameters.Add("@res", MySqlDbType.VarChar).Value   = result;
                    command1.Parameters.Add("@uckey", MySqlDbType.VarChar).Value = key;

                    command3.CommandText = "UPDATE clients SET money = @newres WHERE number = @un";
                    command3.Parameters.Add("@newres", MySqlDbType.VarChar).Value = new_result;
                    command3.Parameters.Add("@un", MySqlDbType.VarChar).Value     = number;

                    conn.Open();
                    command1.ExecuteNonQuery();
                    command3.ExecuteNonQuery();
                    conn.Close();

                    MessageBox.Show("Перевод осуществлен", "Уведомление");
                    Form7 form7 = new Form7(summa, opertaion);
                    textBox2.Text = null;
                    this.Close();
                    form7.Show();
                }
            }
            else
            {
                MessageBox.Show("Превышен лимит!", "Ошибка");
            }
        }
Пример #12
0
        private void Project13_Click(object sender, EventArgs e)
        {
            Form7 openForm7 = new Form7();

            openForm7.Show();
        }
Пример #13
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);
                 * }*/
            }
        }
Пример #14
0
        private void видуКонтроляToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 z = new Form7();

            z.Show();
        }
Пример #15
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.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();
                }
            }
        }
Пример #16
0
        private void toplamaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 invert = new Form7();

            invert.ShowDialog();
        }
Пример #17
0
        private void button3_Click_2(object sender, EventArgs e)
        {
            Form7 hf = new Form7();

            hf.ShowDialog();
        }
Пример #18
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 0)
     {
         Form2 form2 = new Form2();
         this.Hide();
         form2.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 1)
     {
         Form3 form3 = new Form3();
         this.Hide();
         form3.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 2)
     {
         Form4 form4 = new Form4();
         this.Hide();
         form4.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 3)
     {
         Form5 form5 = new Form5();
         this.Hide();
         form5.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 4)
     {
         Form6 form6 = new Form6();
         this.Hide();
         form6.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 5)
     {
         Form7 form7 = new Form7();
         this.Hide();
         form7.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 6)
     {
         Form8 form8 = new Form8();
         this.Hide();
         form8.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 7)
     {
         Form9 form9 = new Form9();
         this.Hide();
         form9.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 8)
     {
         Form10 form10 = new Form10();
         this.Hide();
         form10.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 9)
     {
         Form11 form11 = new Form11();
         this.Hide();
         form11.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 0)
     {
         Form12 form12 = new Form12();
         this.Hide();
         form12.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 1)
     {
         Form13 form13 = new Form13();
         this.Hide();
         form13.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 2)
     {
         Form14 form14 = new Form14();
         this.Hide();
         form14.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 3)
     {
         Form15 form15 = new Form15();
         this.Hide();
         form15.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 4)
     {
         Form16 form16 = new Form16();
         this.Hide();
         form16.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 5)
     {
         Form17 form17 = new Form17();
         this.Hide();
         form17.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 6)
     {
         Form18 form18 = new Form18();
         this.Hide();
         form18.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 7)
     {
         Form19 form19 = new Form19();
         this.Hide();
         form19.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 8)
     {
         Form20 form20 = new Form20();
         this.Hide();
         form20.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 9)
     {
         Form21 form21 = new Form21();
         this.Hide();
         form21.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 10)
     {
         Form22 form22 = new Form22();
         this.Hide();
         form22.Show();
     }
 }
Пример #19
0
        private void аксToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form7 f7 = new Form7();

            f7.ShowDialog();
        }
Пример #20
0
        private void Attendance_Click(object sender, EventArgs e)
        {
            Form7 fm = new Form7();

            fm.Show();
        }
        private void openform7()
        {
            Form7 f7 = new Form7();

            Application.Run(f7);
        }
Пример #22
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form7 git = new Form7();

            git.Show();
        }
Пример #23
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);
                }
            }
        }
Пример #24
0
        private void button1_Click(object sender, EventArgs e)//สมัครสมาชิก
        {
            Form7 a = new Form7();

            a.Show();
        }
Пример #25
0
        private void button7_Click(object sender, EventArgs e)
        {
            var error7Form = new Form7();

            error7Form.Show();
        }