Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form3_mag form3 = new Form3_mag();

            //if (Application.OpenForms["Form3_mag"] == null)
            //{
            //    form3.Show();
            //}
            //else
            //{
            //    this.SendToBack();
            //    form3.BringToFront();
            //}
            form3.ShowDialog();
        }
Exemplo n.º 2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.RowCount == 0)
            {
                Form3_mag form3 = new Form3_mag();
                form3.ShowDialog();
            }
            else
            {
                path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Archiwum\\Magazyn_" + zalogowany + ".sqlite");
                SQLiteConnection con = new SQLiteConnection("Data Source='" + path + "';Version=3;");
                try
                {
                    con.Open();
                    sql = "Select * from Magazyn_kartoteki where Symbol_magazynu='" + magazyn_domyslny + "' and Nazwa='" + dataGridView1.CurrentRow.Cells[2].Value.ToString() + "'";
                    SQLiteCommand    cmd    = new SQLiteCommand(sql, con);
                    SQLiteDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        zdjęcie = reader["JPG"].ToString();
                        typ     = reader["Typ"].ToString();
                    }
                    reader.Close();
                    sql = "Delete from Pozycja_dokumentu";
                    cmd = new SQLiteCommand(sql, con);
                    cmd.ExecuteNonQuery();
                    sql = "Insert into Pozycja_dokumentu (Magazyn,Indeks,Nazwa,Jednostka_miary,Typ,Stawka_VAT,Cena_zakupu,Marża,JPG) values('" + dataGridView1.CurrentRow.Cells[0].Value + "','" + dataGridView1.CurrentRow.Cells[1].Value + "','" + dataGridView1.CurrentRow.Cells[2].Value + "','" + dataGridView1.CurrentRow.Cells[3].Value + "','" + typ + "','" + dataGridView1.CurrentRow.Cells[4].Value + "','" + dataGridView1.CurrentRow.Cells[9].Value + "','" + dataGridView1.CurrentRow.Cells[10].Value + "','" + zdjęcie + "')";
                    cmd = new SQLiteCommand(sql, con);
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    con.Close();
                }


                this.Visible = false;
                Form6_mag form6 = new Form6_mag();
                form6.ShowDialog();
                this.Close();
            }
        }