示例#1
0
 private void btnSpreFacturi_Click(object sender, EventArgs e)
 {
     using (Facturi f = new Facturi())
     {
         f.ShowDialog();
     }
 }
示例#2
0
 private void facturiToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (Facturi facturi = new Facturi())
     {
         facturi.ShowDialog();
     }
 }
示例#3
0
        void insertClienti()
        {
            string       query  = @"INSERT INTO Facturi (factura_id, data_factura, datascadenta, comandac_id, valoarefactura) 
                                                    VALUES (@factid, @datafact, @datascad, @idcomandac, @valfact)";
            DialogResult dialog = new DialogResult();

            checkBeforeInsert();
            if (valid == true)
            {
                try
                {
                    using (conn = new NpgsqlConnection(conexiune))
                    {
                        conn.Open();
                        using (NpgsqlCommand comanda = new NpgsqlCommand(query, conn))
                        {
                            comanda.Parameters.AddWithValue("@factid", int.Parse(txtNrFactura.Text));
                            comanda.Parameters.AddWithValue("@datafact", dtDataFactura.Value);
                            comanda.Parameters.AddWithValue("@datascad", dtDataScadenta.Value);
                            comanda.Parameters.AddWithValue("@idcomandac", int.Parse(cboNrComanda.SelectedItem.ToString()));
                            comanda.Parameters.AddWithValue("@valfact", double.Parse(txtTotalFactura.Text));
                            comanda.CommandType = CommandType.Text;
                            comanda.ExecuteNonQuery();
                        }
                        dialog = MetroFramework.MetroMessageBox.Show(this, @"Factura aferenta comenzii cu nr. " + cboNrComanda.SelectedItem.ToString() +
                                                                     " a clientului " + txtDenumireFurn.Text +
                                                                     " in valoare de " + txtTotalFactura.Text + " RON" +
                                                                     " a fost inregistrata cu succes!\nInregistrati alta factura?",
                                                                     "Succes!", MessageBoxButtons.YesNo,
                                                                     MessageBoxIcon.Question);
                        if (dialog == DialogResult.Yes)
                        {
                            using (Facturi fact = new Facturi())
                            {
                                Hide();
                                fact.ShowDialog();
                            }
                        }
                        else
                        {
                            Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MetroFramework.MetroMessageBox.Show(this, "A aparut o problema.\n" + ex, "Atentie!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }