Esempio n. 1
0
        //___DELETING___
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;

            if (ProvjeriHeader("Manage Partners"))
            {
                if (ProvjeriKontrolu("UC_Delete_Partner"))
                {
                    return;
                }

                uc_partneri_delete = new UC_PartneriDelete();
                //testMetodaDGV(uc_partneri_delete, "UC_Delete_Partner", new Point(20, 500));
                Helper.DodajKontrolu(uc_partneri_delete, "UC_Delete_Partner", new Point(20, 450), panel3);//500->450

                uc_partneri_delete.dataGridView1.DataSource = await _serviceP.Get <List <Partner> >(new PartneriSearchRequest { VrstaPartneraId = VrstaPartneraID });

                uc_partneri_delete.dataGridView1.CellContentClick += delegate(object sen, DataGridViewCellEventArgs er)
                {
                    UC_Delete_Partner(sender, er, uc_partneri_delete);
                };
                return;
            }
            if (ProvjeriHeader("Manage Users"))
            {
                UC_KorisniciEditDelete uc_korisniciEditDelete = new UC_KorisniciEditDelete();
                //testMetodaDGV(uc_korisniciEditDelete, "UC_Delete_Partner", new Point(20, 500));
                Helper.DodajKontrolu(uc_korisniciEditDelete, "UC_Delete_Partner", new Point(20, 450), panel3);//500->450

                uc_korisniciEditDelete.dataGridView1.DataSource = await _serviceKorisnici.Get <List <Korisnik> >(null);

                uc_korisniciEditDelete.dataGridView1.CellContentClick += delegate(object sen, DataGridViewCellEventArgs er)
                {
                    //UC_Delete_Partner(sender, er, uc_partneri_delete);
                };
                return;
            }

            if (ProvjeriKontrolu("UC_Delete"))
            {
                return;
            }

            uc_PoslovnicaDelete = new UC_PoslovniceDelete();
            //testMetodaDGV(uc_PoslovnicaDelete, "UC_Delete", new Point(20, 500));
            Helper.DodajKontrolu(uc_PoslovnicaDelete, "UC_Delete", new Point(20, 450), panel3);//500->450

            uc_PoslovnicaDelete.DataSource = await _servicePoslovnica.Get <List <Poslovnica> >(null);

            uc_PoslovnicaDelete.dataGridView1.ClearSelection();

            uc_PoslovnicaDelete.dataGridView1.CellContentClick += delegate(object sen, DataGridViewCellEventArgs er)
            {
                UC_Delete_Poslovnica(sender, er, uc_PoslovnicaDelete);
            };
        }
Esempio n. 2
0
        private async void UC_Delete_Partner(object sender, DataGridViewCellEventArgs e, UC_PartneriDelete uc)
        {
            if (e.ColumnIndex == 1 && e.RowIndex != -1)//U pocetku je radilo sa zadnjim sada je na NULI(DELETE BTN) KAKO NEZZ -- zbog autogenerate
            {
                uc_partneri_delete.dataGridView1.Rows[e.RowIndex].Selected = true;
                var _partner = uc.dataGridView1.CurrentRow.DataBoundItem as Partner; //currentRow ispravio prob, kako nemam blage veze (ISTRAZITI)
                if (_partner != null)
                {
                    var result = MessageBox.Show("Do you want to delete this record :\n" + _partner.Naziv.ToString() + " ?", "Delete action", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (result == DialogResult.Yes)
                    {
                        Partner delete = await _serviceP.Delete <Partner>(_partner.PartnerId);

                        MessageBox.Show(delete.Naziv.ToString() + " deleted.", "Delete action successfull", // baca error ne stavi partnera kod brisanja
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);

                        uc_partneri_delete.dataGridView1.DataSource = await _serviceP.Get <List <Partner> >(new PartneriSearchRequest { VrstaPartneraId = VrstaPartneraID });;
                        return;
                    }
                }
            }
        }