Exemple #1
0
        private void angajatiView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (angajatiView.Columns[e.ColumnIndex].Name == "Edit" && e.RowIndex > -1)//edit
            {
                AddAngajat ada = new AddAngajat();
                ada.set(angajatiView.Rows[e.RowIndex]);
                if (ada.ShowDialog() == DialogResult.OK)
                {
                    refreshAngajati();
                    refreshData();
                }
            }

            if (angajatiView.Columns[e.ColumnIndex].Name == "Concediaza" && e.RowIndex > -1)
            {
                int          id           = Int32.Parse(angajatiView.Rows[e.RowIndex].Cells["ID"].Value.ToString());
                string       name         = angajatiView.Rows[e.RowIndex].Cells["Nume"].Value.ToString() + " " + angajatiView.Rows[e.RowIndex].Cells["Prenume"].Value.ToString();
                DialogResult dialogResult = MessageBox.Show("Il concediati pe  " + name + "?", "Concediere - " + name, MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    Database.Execute("DELETE FROM Angajati WHERE id_angajat = '" + id + "'");
                    angajatiView.Rows.RemoveAt(e.RowIndex);
                    //MessageBox.Show("L-ati concediat pe " + name);
                }
            }
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddAngajat ada = new AddAngajat();

            if (ada.ShowDialog() == DialogResult.OK)
            {
                refreshAngajati();
                refreshData();
            }
        }