private async void btnUkloni_Click(object sender, EventArgs e)
        {
            try
            {
                await _rezervacija.Delete <Model.Rezervacija>(_id);

                this.Close();
                MessageBox.Show("Uspješno izvršeno");
                this.Close();
            }
            catch (Exception)
            {
            }
        }
        private async void btnUkloni_Click(object sender, EventArgs e)
        {
            var result = await _korisnici.Get <List <Model.Korisnici> >(null);

            var odabrani = (Model.Korisnici)cmbOdaberiKorisnika.SelectedItem;
            var poruke   = await _poruke.Get <IList <Model.Poruke> >(null);

            var recenzijes = await _recenzije.Get <IList <Model.Recenzije> >(null);

            var mojifavoriti = await _favoriti.Get <List <Model.MojiFavoriti> >(null);

            var userActivity = await _useractivity.Get <List <Model.UserActivity> >(null);

            if (odabrani.KorisnikId != 0)
            {
                foreach (var item in poruke)
                {
                    if (item.PosiljalacId == odabrani.KorisnikId || item.PrimalacId == odabrani.KorisnikId)
                    {
                        await _poruke.Delete(item.PorukaId);
                    }
                }
                foreach (var item in mojifavoriti)
                {
                    if (item.KorisnikId == odabrani.KorisnikId)
                    {
                        await _favoriti.Delete(item.FavoritiId);
                    }
                }
                foreach (var item in recenzijes)
                {
                    if (item.KorisnikId == odabrani.KorisnikId)
                    {
                        await _recenzije.Delete(item.RecenzijaId);
                    }
                }
                foreach (var item in userActivity)
                {
                    if (item.KorisnikId == odabrani.KorisnikId)
                    {
                        await _useractivity.Delete(item.KorisnikId);
                    }
                }
            }
            if (odabrani.KorisnikId != 0)
            {
                await _korisnici.Delete(odabrani.KorisnikId);
            }
            await LoadKorisnici();
        }
Example #3
0
        public async Task DeleteRezervacija(int rezervacijaId)
        {
            try
            {
                await _rezervacija.Delete <Rezervacija>(rezervacijaId);

                await Application.Current.MainPage.DisplayAlert("Carpool", "Uspješno uklonjena rezervacija", "OK");

                await Application.Current.MainPage.Navigation.PopAsync();
            }
            catch (Exception)
            {
            }
        }
        public async void Ukloni(int userId, int role, int obavijestId)
        {
            var t = await Application.Current.MainPage.DisplayAlert("Upozorenje", "Da li ste sigurni da želite uklonuti odabranu obavijest?", "Da", "Ne");

            if (t == true)
            {
                var temp = await _service.Delete(obavijestId);

                List <obavijesti> lista = await _service.Get <List <obavijesti> >(null);

                Application.Current.MainPage = new ObavijestiPage(lista, userId, role);
                await Application.Current.MainPage.DisplayAlert("Poruka", "Uspješno ste uklonuli obavijest", "OK");
            }
        }
Example #5
0
        private async void DgvSlike_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvSlike.Columns[e.ColumnIndex].Name == "Ukloni")
            {
                var id = dgvSlike.Rows[e.RowIndex].Cells[1].Value;

                if (MessageBox.Show("Da li ste sigurni da želite ukloniti ovu fotografiju ?", "Poruka", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    await _slike.Delete(id);

                    RefreshSlika();
                    MessageBox.Show("Zapis uspješno obrisan");
                }
            }
        }
        private async void btnBrisi_Click(object sender, EventArgs e)
        {
            var t = MessageBox.Show("Da li ste sigurni da želite obrisati podatak?", "Upozorenje", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (t == DialogResult.Yes)
            {
                if (_id != null)
                {
                    await _service.Delete(_id);

                    MessageBox.Show("Uspješno ste obrisali uplatu");
                    this.Close();
                }
            }
        }
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure you want to delete this track ?",
                                                "Confirm",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                await _trackService.Delete <Model.Track>(_trackId);

                refreshHandler?.Invoke(this, null);
                MessageBox.Show("Task successful");
                this.Close();
            }
        }
Example #8
0
        private async void dgv_Smjestaj_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgv_Smjestaj.CurrentCell.ColumnIndex.Equals(4))
            {
                var id = int.Parse(dgv_Smjestaj[e.ColumnIndex - 4, e.RowIndex].Value.ToString());
                frm_UrediSmjestaj Form = new frm_UrediSmjestaj(id, _IzdavacId);
                Form.Show();
            }


            else if (dgv_Smjestaj.CurrentCell.ColumnIndex.Equals(5))
            {
                var id = int.Parse(dgv_Smjestaj[e.ColumnIndex - 5, e.RowIndex].Value.ToString());
                await _SmjestajService.Delete <SmjestajModel>(id);
            }
        }
Example #9
0
        async Task removePresenceAsync(int userId, int eventId)
        {
            var presenceSearchRequest = new PresenceSearchRequest()
            {
                EventId = eventId,
                UserId  = userId,
            };
            var presenceList = await apiService_presence.Get <List <Model.Presence> >(presenceSearchRequest);

            if (presenceList.Count <= 0)
            {
                return;
            }
            var presenceId = presenceList[0].Id;
            await apiService_presence.Delete <Model.Presence>(presenceId);
        }
Example #10
0
        public async Task DeleteAccount()
        {
            if ((await NotificationService.Instance.Prompt())?.Ok ?? false)
            {
                _apiSerivce.ChangeRoute(Routes.PacijentiRoute);
                var result = await _apiSerivce.Delete <int>(0);

                if (result.StatusCode != HttpStatusCode.NoContent)
                {
                    NotificationService.Instance.Error(AppResources.Error);
                    return;
                }

                await Auth.Logout();
            }
        }
        private async void btnSnimi_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                //   txtSlikaInput = Convert.ToBase64String(circleButton1.Image.);


                // if the original encoding was ASCII


                byte[] bytes = Encoding.ASCII.GetBytes(txtSlikaInput.Text);


                var request = new PrevozUpsertRequest
                {
                    Naziv = txtNazivA.Text,

                    Slika   = bytes,
                    Telefon = textBox2.Text,
                    Vrsta   = textBox1.Text
                };
                if (openFileDialog1.FileName.Length != 0)
                {
                    request.PutanjaSlike = txtSlikaInput.Text;
                }


                if (_id != null || _id != 0)
                {
                    if (APIService.isUpdate)
                    {
                        await _prevoz.Update <Model.Prevoz>(_id, request);

                        MessageBox.Show("Operacija uspješna!");
                    }
                    else if (APIService.isDelete)
                    {
                        await _prevoz.Delete((int)_id);

                        MessageBox.Show("Uspješno ste obrisali prevoz!");
                    }
                }

                FreeUp();
                await LoadPrevoz();
            }
        }
Example #12
0
        private async void dgvScheduledMovies_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var cinemaDayMovieId = dgvScheduledMovies.Rows[e.RowIndex].Cells["CinemaDayMovieId"].Value;
                var movieId          = dgvScheduledMovies.Rows[e.RowIndex].Cells["MovieId"].Value;
                var action           = dgvScheduledMovies.Columns[e.ColumnIndex].Name;
                var cdmApi           = new APIService("cinemaDayMovie");
                var movieApi         = new APIService("movies");
                var cdm = await cdmApi.GetById <Model.CinemaDayMovie>(cinemaDayMovieId);

                var movie = await movieApi.GetById <Model.Movie>(cdm.MovieId);

                CustomMessageBox messageBox = new CustomMessageBox();

                if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete '{movie.Title}' on the {DateTime.Parse(_date.ToString()).ToShortDateString()}, {_day}?", "Delete movie?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        await cdmApi.Delete <Model.CinemaDayMovie>(cinemaDayMovieId);

                        this.Close();
                        _scheduleForm.Close();
                        ScheduleForm sch = new ScheduleForm(_schedule.Cinema.CinemaId, _menuForm)
                        {
                            MdiParent = _menuForm,
                            Dock      = DockStyle.Fill
                        };

                        var schedule = await _apiService.CustomGet <Model.Requests.CinemasScheduleRequest>("GetCinemasSchedule", _schedule.Cinema.CinemaId);

                        CinemaDayMovieForm form = new CinemaDayMovieForm(sch, schedule, _menuForm, _airingDayId, _date, _day);
                        sch.Show();
                        _helper.ShowForm(form, 15);

                        messageBox.Show("Movie deleted successfully", "success");
                    }
                }
                else if (action == "Apps")
                {
                    AppointmentsForm form = new AppointmentsForm(_scheduleForm, _schedule, _menuForm, _airingDayId, _date, _day, int.Parse(cinemaDayMovieId.ToString()), int.Parse(movieId.ToString()), this);
                    _helper.CloseForm(this, 15);
                    _helper.ShowForm(form, 15);
                }
            }
        }
Example #13
0
        private async void dgvAdmins_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var      adminId  = dgvAdmins.Rows[e.RowIndex].Cells["AdminId"].Value;
                var      action   = dgvAdmins.Columns[e.ColumnIndex].Name;
                MenuForm menuForm = (MenuForm)this.MdiParent;

                if (action == "Edit")
                {
                    AddEditAdminForm form = new AddEditAdminForm(menuForm, _currentUsername, int.Parse(adminId.ToString()))
                    {
                    };
                    _helper.ShowForm(form, 15);
                }
                else if (action == "Delete")
                {
                    var confirm = MessageBox.Show("Are you sure to delete this admin? You will be logged out if you delete yourself.", "Confirm Delete", MessageBoxButtons.YesNo);
                    if (confirm == DialogResult.Yes)
                    {
                        var mbox  = new CustomMessageBox();
                        var admin = await _apiService.GetById <Model.Admin>(adminId);

                        var message = await _apiService.Delete <string>(adminId);

                        if (admin.Account.Username == _currentUsername)
                        {
                            LoginForm form = new LoginForm();
                            form.Show();
                            var menu = (MenuForm)this.MdiParent;
                            menu.Close();
                        }
                        else
                        {
                            AdminsForm form = new AdminsForm(_currentUsername)
                            {
                                MdiParent = (MenuForm)this.MdiParent,
                                Dock      = DockStyle.Fill
                            };
                            form.Show();
                            this.Close();
                        }
                        mbox.Show(message, "success");
                    }
                }
            }
        }
        private async void Button_Clicked_4(object sender, EventArgs e)
        {
            var btn  = sender as Button;
            var item = btn.BindingContext as Recept;

            var p = item.ReceptId;

            KomentarSearchRequest       komentar = new KomentarSearchRequest();
            OcjenaSearchRequest         ocjena   = new OcjenaSearchRequest();
            ReceptSastojakSearchRequest sastojak = new ReceptSastojakSearchRequest();
            FavoritiSearchRequest       favoriti = new FavoritiSearchRequest();

            komentar.ReceptId = p;
            ocjena.ReceptId   = p;
            sastojak.ReceptId = p;
            favoriti.ReceptId = p;

            var listakomentara = await _apiKomentar.Get <IEnumerable <Komentar> >(komentar);

            var listaocjena = await _apiOcjena.Get <IEnumerable <Ocjena> >(ocjena);

            var listareceptsastojaka = await _apiReceptSastojak.Get <IEnumerable <ReceptSastojak> >(sastojak);

            var listafavorita = await _apiFavoriti.Get <IEnumerable <Favoriti> >(favoriti);

            foreach (var y in listakomentara)
            {
                await _apiKomentar.Delete <Komentar>(y.KomentarId);
            }
            foreach (var y in listaocjena)
            {
                await _apiOcjena.Delete <Ocjena>(y.OcjenaId);
            }
            foreach (var y in listareceptsastojaka)
            {
                await _apiReceptSastojak.Delete <ReceptSastojak>(y.ReceptSastojakId);
            }
            foreach (var y in listafavorita)
            {
                await _apiFavoriti.Delete <Favoriti>(y.FavoritiId);
            }
            await _apiRecept.Delete <Recept>(item.ReceptId);

            await DisplayAlert("OK", "Uspješno ste izbrisali recept", "OK");

            await Navigation.PushAsync(new MojiRecepti());
        }
Example #15
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var btn  = sender as Button;
            var item = btn.BindingContext as Rezervacija;

            if ((item.DatumVrijeme - DateTime.Now).TotalDays <= 1)
            {
                await Application.Current.MainPage.DisplayAlert(" ", "Rok za otkazivanje rezervacije je prošao!", "OK");
            }
            else
            {
                await _rezervacije.Delete <Rezervacija>(item.RezervacijaId);
                await DisplayAlert("OK", "Uspješno ste otkazali rezervaciju!", "OK");

                await Navigation.PushAsync(new MojeRezervacije());
            }
        }
Example #16
0
        public async Task DodajOcjenu()
        {
            IsBusy = true;
            if (Ocjena != null)
            {
                await _ocjene.Delete <Ocjena>(Ocjena.OcjenaId);
            }

            Ocjena = await _ocjene.Insert <Ocjena>(new OcjenaUpsertRequest()
            {
                Ocjena1    = _ocjena,
                PacijentId = _pacijentId,
                ClanakId   = _clanakId
            });

            await Application.Current.MainPage.DisplayAlert(" ", "Uspješno ocjenjeno!", "OK");
        }
Example #17
0
        private async void btnObrisi_Click(object sender, EventArgs e)
        {
            try
            {
                var auto = await _apiService.Delete <Model.Automobil>((int)_id);

                if (auto != null)
                {
                    MessageBox.Show("Uspješno obrisan automobil");
                }

                this.Close();
            }
            catch (Exception)
            {
            }
        }
Example #18
0
        public async Task ObrisiZahtjev(int id)
        {
            if (id <= 0)
            {
                await Application.Current.MainPage.DisplayAlert("Greska", Messages.NemoguceBrisanjeZahtijeva, "Ok");
            }
            else
            {
                Prijateljstvo result = await _prijateljstvoService.Delete <Prijateljstvo>(id);

                if (result != null && result != default(Prijateljstvo))
                {
                    await Application.Current.MainPage.DisplayAlert("Info", Messages.ObrisanZahtjev, "Ok");
                }
                await Init();
            }
        }
Example #19
0
        public async Task DodajOcjenu()
        {
            IsBusy = true;
            if (PredstavaKupac != null)
            {
                await _predstavaKupac.Delete <PredstavaKupac>(PredstavaKupac.PredstavaKupacId);
            }

            PredstavaKupac = await _predstavaKupac.Insert <PredstavaKupac>(new PRedstavaKupacInsertRequest()
            {
                Ocjena      = _ocjena,
                KupacId     = _kupacId,
                PredstavaId = _predstavaId
            });

            await Application.Current.MainPage.DisplayAlert(" ", "Uspješno sačuvani podaci", "OK");
        }
Example #20
0
        private async void btnObrisi_Click(object sender, EventArgs e)
        {
            //jel ovo to jes, vidis da sam pokusavala
            //al ne uspeva

            bool jel = await _kategorije.Delete(KategorijaId);

            if (jel)
            {
                MessageBox.Show("Kategorija uspjesno obrisana!");
                Parent.Reload();
            }
            else
            {
                MessageBox.Show("Greska!", "Kategorija se koristi u drugim podacima, nije moguce obrisati");
            }
        }
Example #21
0
        private async void BtnZavrsi_Click(object sender, EventArgs e)
        {
            NarudzbaUpsertRequest req = new NarudzbaUpsertRequest
            {
                NarudzbaId = _id,
                Zavrsena = true
            };
            await _narudzba.Update<NarudzbaUpsertRequest>(_id, req);
            var narudzba = await _narudzba.GetById<Model.Narudzba>(_id);
            var klijent = await _klijent.GetById<Model.Klijenti>(narudzba.KlijentId);
            MessageBox.Show("Narudzba uspjesno zavrsena", " ", MessageBoxButtons.OK, MessageBoxIcon.Information);

            await _klijent.Delete(klijent.KorisnikId);
            NarudzbaSearchRequest reload = new NarudzbaSearchRequest { Zavrsena = false };
            await _parent.LoadNarudzbe(reload);
            Close();
        }
Example #22
0
        public async Task DodajOcjenu()
        {
            IsBusy = true;
            if (ocjena != null)
            {
                await _apiocjena.Delete <Ocjena>(ocjena.OcjenaId);
            }

            ocjena = await _apiocjena.Insert <Ocjena>(new OcjenaUpsertRequest()
            {
                ocjena       = _ocjena,
                PosjetilacId = _posjetilacId,
                ReceptId     = _receptId
            });

            await Application.Current.MainPage.DisplayAlert(" ", "Uspješno sačuvani podaci", "OK");
        }
Example #23
0
 private async void btnDeleteCourse_Click(object sender, EventArgs e)
 {
     if (dgvCourses.CurrentRow != null)
     {
         var result = false;
         int ID     = Convert.ToInt32(dgvCourses.CurrentRow.Cells["CourseID"].Value);
         if (MessageBox.Show("Do you really want to delete this course?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             result = await courseService.Delete <dynamic>(ID);
         }
         if (result == true)
         {
             MessageBox.Show("You have deleted course successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         PanelHelper.SwapPanels(this.Parent, this, new CourseList(_user, _course));
     }
 }
Example #24
0
        private async void btnUkloni_Click(object sender, EventArgs e)
        {
            try
            {
                var auto = await _obavijestiService.Delete <Model.Obavijesti>(_id);

                if (auto != null)
                {
                    MessageBox.Show("Uspješno uklonjena obavijest!");
                }

                this.Close();
            }
            catch (Exception)
            {
            }
        }
Example #25
0
        public async Task Delete()
        {
            Prikazi = true;
            var notifikacijaKlijent = await _notifikacijaKlijentService.Get <List <KlijentNotifikacija> >(new KlijentNotifikacijaSearchRequest {
                RezervacijaId = rezervacija.Id
            });

            if (notifikacijaKlijent.Count > 0)
            {
                await _notifikacijaKlijentService.Delete <KlijentNotifikacija>(notifikacijaKlijent[0].NotifikacijaId);

                int broj = int.Parse(APIService.BrojNotifikacija);
                if (broj > 0)
                {
                    broj -= 1;

                    APIService.BrojNotifikacija = broj.ToString();
                }
            }
            var notifikacijarezervacijat = await _notifikacijaService.Get <List <PoslataNotifikacija> >(new PoslataNotifikacijaSearchRequest {
                RezervacijaId = rezervacija.Id
            });

            if (notifikacijarezervacijat.Count > 0)
            {
                await _notifikacijaService.Delete <PoslataNotifikacija>(notifikacijarezervacijat[0].Id);
            }

            var entity = await _rezervacijaService.Delete <Rezervacija>(rezervacija.Id);

            if (entity != null)
            {
                var termin = await _terminiservice.GetById <Termin>(entity.TerminId);

                await _terminiservice.Update <Termin>(termin.Id, new TerminInsertRequest
                {
                    Id             = termin.Id,
                    KorisnikId     = termin.KorisnikId,
                    Rezervisan     = false,
                    VrijemeTermina = termin.VrijemeTermina
                });

                await Application.Current.MainPage.DisplayAlert("Tim threading bar d.o.o", "Uspjesno ste otkazali rezervaciju!", "OK");
            }
        }
Example #26
0
        private async void dgvMovies_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var      movieId  = dgvMovies.Rows[e.RowIndex].Cells["MovieId"].Value;
                var      action   = dgvMovies.Columns[e.ColumnIndex].Name;
                MenuForm menuForm = (MenuForm)this.MdiParent;
                var      movie    = await _apiService.GetById <Model.Movie>(movieId);

                CustomMessageBox messageBox = new CustomMessageBox();

                if (action == "Edit" || action == "Title")
                {
                    AddEditMovieForm form = new AddEditMovieForm(menuForm, int.Parse(movieId.ToString()))
                    {
                        MdiParent = menuForm,
                        Dock      = DockStyle.Fill
                    };
                    form.Show();
                }
                else if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete '{movie.Title}'?", "Delete movie?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        await _apiService.Delete <Model.Movie>(movieId);

                        foreach (Form frm in menuForm.MdiChildren)
                        {
                            frm.Close();
                        }
                        MoviesForm form = new MoviesForm {
                            MdiParent = menuForm,
                            Dock      = DockStyle.Fill
                        };
                        form.Show();
                        messageBox.Show("Movie deleted successfully", "success");
                    }
                }
                else
                {
                    return;
                }
            }
        }
Example #27
0
        private async Task DeletePost()
        {
            bool answer = await Application.Current.MainPage.DisplayAlert("Confirm", "Are you sure you want to remove this post?", "Yes", "No");

            if (answer == false)
            {
                return;
            }
            else
            {
                await _postService.Delete <Post>(thisPostId);

                await Application.Current.MainPage.DisplayAlert("Success", "Post successfully deleted! You will now be redirected to the News Feed page.", "Ok");

                var aps = Application.Current.MainPage as MasterPage;
                await aps.MenuNavigate("News Feed");
            }
        }
Example #28
0
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvSubcategories.CurrentRow != null)
            {
                bool result = false;
                int  ID     = Convert.ToInt32(dgvSubcategories.CurrentRow.Cells["SubcategoryID"].Value);

                if (MessageBox.Show("Do you really want to delete this subcategory?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    result = await subcategoryService.Delete <dynamic>(ID);
                }
                if (result == true)
                {
                    MessageBox.Show("You have deleted subcategory successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                PanelHelper.SwapPanels(this.Parent, this, new SubcategoryList());
            }
        }
Example #29
0
        private async void btnRemove_Click(object sender, EventArgs e)
        {
            string promptValue = Prompt.ShowDialog("Are you sure you want to remove this administrator?" +
                                                   " Type your password to confirm.", "Confirm");

            if (APIService.Password == promptValue)
            {
                await _adminService.Delete <Model.AdministratorLogin>(_adminId);

                refreshHandler?.Invoke(this, null);
                MessageBox.Show("Task successful");
                this.Close();
            }
            else
            {
                MessageBox.Show("Password incorrect");
            }
        }
Example #30
0
        private async void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this?", "Caption", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    var result = await _service.Delete <FunctionalField>(_functionalField.Id);

                    frmIndex.Instance.btnDashFF_Click(null, null);
                    MessageBox.Show("Successfully deleted Functional Field!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " " + ex.InnerException);
            }
        }