Exemplo 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);
            };
        }
Exemplo n.º 2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     panelMain.Controls.Clear();
     if (btnAdd.Text == "Add New SHOP")
     {
         UC_PoslovniceDelete poslovnice = new UC_PoslovniceDelete();
         Helper.DodajKontrolu(poslovnice, "uc_poslovnice_delete", new Point(10, 60), panelMain);
         poslovnice.LoadDgv(APIService.PartnerID);
     }
     else
     {
         UC_UposlenikEdit uposlenici = new UC_UposlenikEdit();
         Helper.DodajKontrolu(uposlenici, "uc_uposlenik_edit", new Point(10, 60), panelMain);
     }
     //poslovnice.LoadDgv(APIService.PartnerID);
 }
Exemplo n.º 3
0
        private async void UC_Delete_Poslovnica(object sender, DataGridViewCellEventArgs e, UC_PoslovniceDelete uc)
        {
            if (e.ColumnIndex == 5 && e.RowIndex != -1)//U pocetku je radilo sa zadnjim sada je na NULI(DELETE BTN) KAKO NEZZ -- zbog autogenerate
            {
                uc_PoslovnicaDelete.dataGridView1.Rows[e.RowIndex].Selected = true;
                var _posl = uc.dataGridView1.CurrentRow.DataBoundItem as Poslovnica; //currentRow ispravio prob, kako nemam blage veze (ISTRAZITI)
                if (_posl != null)
                {
                    var result = MessageBox.Show("Do you want to delete this record :\n" + _posl.Partner.ToString() + " " + _posl.Naziv.ToString() + "?", "Delete action", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (result == DialogResult.Yes)
                    {
                        Poslovnica delete = await _servicePoslovnica.Delete <Poslovnica>(_posl.PoslovnicaId);

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

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

                        return;
                    }
                }
            }
        }