コード例 #1
0
        private async void dgvKorisnici_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string k = dgvKorisnici.SelectedCells[2].Value.ToString();
            int    korisnikID;
            var    senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (dgvKorisnici.SelectedCells[e.ColumnIndex].Value.ToString() == "Uredi")
                {
                    korisnikID = Convert.ToInt32(k);
                    Korisnici_forme.KorisniciIzmjna kIzmjena = new Korisnici_forme.KorisniciIzmjna(korisnikID);
                    kIzmjena.Show();
                    this.Close();
                }
                else
                {
                    if (dgvKorisnici.SelectedCells[e.ColumnIndex].Value.ToString() == "Obriši")
                    {
                        korisnikID = Convert.ToInt32(k);

                        var list = await _apiService.Delete <Korisnici>(korisnikID);

                        if (list != null)
                        {
                            const string message = "Korisnik obrisan ! ";
                            const string caption = "Informacija";

                            var result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            LoadList();
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void dgvJela_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string k = dgvJela.SelectedCells[2].Value.ToString();
            int    jeloID;
            var    senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (dgvJela.SelectedCells[e.ColumnIndex].Value.ToString() == "Uredi")
                {
                    jeloID = Convert.ToInt32(k);
                    jela_forme.IzmjenaJela jIzmjena = new jela_forme.IzmjenaJela(jeloID);
                    jIzmjena.Show();
                    this.Close();
                }
                else
                {
                    if (dgvJela.SelectedCells[e.ColumnIndex].Value.ToString() == "Obriši")
                    {
                        jeloID = Convert.ToInt32(k);

                        var response = _apiServiceJela.Delete <Jela>(jeloID);
                        if (response != null)
                        {
                            const string message = "Jelo je obrisano ! ";
                            const string caption = "Informacija";

                            var result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            BindData();
                        }
                    }
                }
            }
        }
コード例 #3
0
        private async void dgvRest_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string k = dgvRest.SelectedCells[2].Value.ToString();
            int    restoranID;
            var    senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                if (dgvRest.SelectedCells[e.ColumnIndex].Value.ToString() == "Uredi")
                {
                    restoranID = Convert.ToInt32(k);
                    restorani_forme.UrediRestoran jIzmjena = new restorani_forme.UrediRestoran(restoranID);
                    jIzmjena.Show();
                    this.Close();
                }
                else
                {
                    if (dgvRest.SelectedCells[e.ColumnIndex].Value.ToString() == "Obriši")
                    {
                        restoranID = Convert.ToInt32(k);

                        var response = await _apiServiceDel.Delete <Restorani>(restoranID);

                        if (response != null)
                        {
                            const string message = "Restoran je obrisano ! ";
                            const string caption = "Informacija";

                            var result = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            LoadData();
                        }
                    }
                }
            }
        }