Пример #1
0
    private void btnObrisiObrazac_Click(object sender, EventArgs e)
    {
        if (this.UltraGrid1.Selected == null)
        {
            return;
        }

        if (this.UltraGrid1.Selected.Rows.Count == 0)
        {
            return;
        }

        if (MessageBox.Show("Nastaviti sa brisanjem obrasca?\n\nNAPOMENA: brisanjem obrasca NE brišete obračune već samo JOPPD izvještaj!", "Brisanje JOPPD obrasca",
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
        {
            int joppdID = (int)this.UltraGrid1.Selected.Rows[0].Cells["JoppdaID"].Value;

            Mipsed7.DataAccessLayer.SqlClient database = new Mipsed7.DataAccessLayer.SqlClient();

            database.ExecuteNonQuery(string.Format("DELETE FROM dbo.JOPPDB WHERE JOPPDAID = {0}", joppdID));
            database.ExecuteNonQuery(string.Format("DELETE FROM dbo.JOPPDA WHERE ID = {0}", joppdID));
            database.ExecuteNonQuery(string.Format("DELETE FROM dbo.JOPPDAObracun WHERE JOPPDA_ID = {0}", joppdID));

            GetObracunJOPPD();
        }
    }
Пример #2
0
    private void btnObrisi_Click(object sender, EventArgs e)
    {
        string sifra_os = string.Empty;
        string broj_os  = string.Empty;
        int    index    = UltraGrid1.ActiveRow.Index;

        sifra_os = UltraGrid1.Rows[index].Cells[0].Value.ToString();
        broj_os  = UltraGrid1.Rows[index].Cells[2].Value.ToString();

        Mipsed7.DataAccessLayer.SqlClient client = new Mipsed7.DataAccessLayer.SqlClient();

        client.ExecuteNonQuery("Delete From OSTEMELJNICA Where IDOSDOKUMENT = '" + sifra_os + "' And OSBROJDOKUMENTA = '" + broj_os + "'");

        client.CloseConnection();

        UltraGrid1.DeleteSelectedRows();
    }