Esempio n. 1
0
        private void emailTxt_Validating_1(object sender, CancelEventArgs e)
        {
            string a = emailTxt.Text;

            bool regextacan = false;

            //[a-z]|[A-Z]|[0-9]|[ ]|[-]|[_][.]

            if (Regex.Match(a, "^[[email protected]]*$").Success)
            {
                a          = a.Replace('.', ',');
                regextacan = true;
            }
            else
            {
                e.Cancel = true;
                errorProvider.SetError(emailTxt, Global.GetMessage("string_sc"));
            }

            if (regextacan)
            {
                if (String.IsNullOrEmpty(emailTxt.Text))
                {
                    e.Cancel = true;
                    errorProvider.SetError(emailTxt, Global.GetMessage("email_req"));
                }
                else
                {
                    try
                    {
                        HttpResponseMessage response = dostavljacServices.GetActionResponse("GetCheckEmail", a);
                        Kupci abc = new Kupci();
                        abc = null;
                        MailAddress mail = new MailAddress(emailTxt.Text);
                        if (response.IsSuccessStatusCode)
                        {
                            abc = response.Content.ReadAsAsync <Kupci>().Result;
                        }
                        else
                        {
                            abc = null;
                        }
                        if (abc == null)
                        {
                            errorProvider.SetError(emailTxt, "");
                        }
                        else
                        {
                            e.Cancel = true;
                            errorProvider.SetError(emailTxt, Global.GetMessage("email_ex"));
                        }
                    }
                    catch (Exception)
                    {
                        e.Cancel = true;
                        errorProvider.SetError(emailTxt, Global.GetMessage("email_err"));
                    }
                }
            }
        }
Esempio n. 2
0
        private void txtEmail_Validating(object sender, CancelEventArgs e)
        {
            Regex regex = new Regex(@"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
            Match match = regex.Match(txtEmail.Text);
            HttpResponseMessage response = zaposlenikServis.GetActionResponse("GetSearchByEmail", txtEmail.Text, 0.ToString());

            if (String.IsNullOrEmpty(txtEmail.Text))
            {
                e.Cancel = true;
                errorProvider.SetError(txtEmail, "Email je obavezno polje");
            }
            else if (txtEmail.Text.Length > 50)
            {
                e.Cancel = true;
                errorProvider.SetError(txtEmail, "Email adresa mora sadržavati manje od 50 karaktera");
            }
            else if (response.IsSuccessStatusCode)
            {
                e.Cancel = true;
                errorProvider.SetError(txtEmail, "Email adresa je zauzeta");
            }
            else if (!match.Success)
            {
                e.Cancel = true;
                errorProvider.SetError(txtEmail, "Email adresa nije validna");
            }
            else
            {
                errorProvider.SetError(txtEmail, null);
            }
        }
Esempio n. 3
0
        protected override void OnAppearing()
        {
            HttpResponseMessage response = lokacijaServis.GetActionResponse("GetPolazisteOdrediste", 0.ToString());

            if (response.IsSuccessStatusCode)
            {
                var         jsonObj = response.Content.ReadAsStringAsync();
                List <Grad> vrste   = JsonConvert.DeserializeObject <List <Grad> >(jsonObj.Result);
                PolazistePicker.ItemsSource        = vrste.OrderBy(x => x.Naziv).ToList();
                PolazistePicker.ItemDisplayBinding = new Binding("Prikazi");
                PolazistePicker.SelectedIndex      = polazakIndex;
            }
            else
            {
                DisplayAlert("Greška", "Nemoguće pristupiti lokacijama", "OK");
            }

            HttpResponseMessage response1 = lokacijaServis.GetActionResponse("GetPolazisteOdrediste", 0.ToString());

            if (response1.IsSuccessStatusCode)
            {
                var         jsonObj = response1.Content.ReadAsStringAsync();
                List <Grad> vrste   = JsonConvert.DeserializeObject <List <Grad> >(jsonObj.Result);
                OdredistePicker.ItemsSource        = vrste.OrderBy(x => x.Naziv).ToList();
                OdredistePicker.ItemDisplayBinding = new Binding("Prikazi");
                OdredistePicker.SelectedIndex      = destinacijaIndex;
            }
            else
            {
                DisplayAlert("Greška", "Nemoguće pristupiti lokacijama", "OK");
            }
            base.OnAppearing();
        }
Esempio n. 4
0
        private void LoadForm()
        {
            HttpResponseMessage response = ucionicaService.GetActionResponse("UcionicaDetails", idUcionice.ToString());

            if (response.IsSuccessStatusCode)
            {
                var jasonObject = response.Content.ReadAsStringAsync();
                var ucionica    = JsonConvert.DeserializeObject <Ucionica>(jasonObject.Result);
                //popuni podatke
                naslovInput.Text         = ucionica.Naslov;
                ucionicaSlika.Source     = ImageSource.FromStream(() => new MemoryStream(ucionica.Slika));
                opisInput.Text           = ucionica.Opis;
                datumPocetkaInput.Text   = ucionica.DatumPocetka.ToShortDateString();
                datumZavrsetkaInput.Text = ucionica.DatumZavrsetka.ToShortDateString();
                adresaInput.Text         = ucionica.AdresaUcionice;
                maxBrUcenikaInput.Text   = ucionica.MaxBrojPolaznika.ToString();
                cijenaInput.Text         = ucionica.Cijena.ToString() + " KM";
                tutorId = ucionica.TutorId;


                response    = ucionicaService.GetActionResponse("Termini", idUcionice.ToString());
                jasonObject = response.Content.ReadAsStringAsync();
                var termini = JsonConvert.DeserializeObject <List <Termin> >(jasonObject.Result);
                terminiList.ItemsSource   = termini;
                terminiList.HeightRequest = terminiList.RowHeight * (termini.Count + 1);
                //popuni podatke

                PrijavaCheck();
            }
        }
Esempio n. 5
0
        private void BindPickers()
        {
            List <string> spol = new List <string>();

            spol.Add("Odaberite spol");
            spol.Add("Muški");
            spol.Add("Ženski");
            pickerSpol.ItemsSource   = spol;
            pickerSpol.SelectedIndex = 0;

            List <string> tipPutnika = new List <string>();

            tipPutnika.Add("Odrasli");
            tipPutnika.Add("Djeca");
            pickerTipPutnika.ItemsSource   = tipPutnika;
            pickerTipPutnika.SelectedIndex = 0;

            List <string> tipDokumenta = new List <string>();

            tipDokumenta.Add("Odaberite tip");
            tipDokumenta.Add("Pasoš");
            tipDokumenta.Add("Lična karta");
            tipDokumenta.Add("Viza za osobno putovanje");
            tipDokumenta.Add("Viza za poslovno putovanje");
            pickerTipDokumenta.ItemsSource   = tipDokumenta;
            pickerTipDokumenta.SelectedIndex = 0;


            HttpResponseMessage response = sjedisteServis.GetActionResponse("SearchSlobodnaSjedista", OdabraniLetPolazak.LetID.ToString(), OdabranaKlasaPolazak.ToString());

            if (response.IsSuccessStatusCode)
            {
                var jsonObject            = response.Content.ReadAsStringAsync();
                Sjedista_IndexVM sjedista = JsonConvert.DeserializeObject <Sjedista_IndexVM>(jsonObject.Result);
                pickerSjediste.ItemsSource        = sjedista.sjedista;
                pickerSjediste.ItemDisplayBinding = new Binding("OznakaSaProzorom");
            }
            else
            {
                DisplayAlert("Greška", "Neka greška", "Nazad");
            }

            if (OdabranaKlasaPovratak != null)
            {
                HttpResponseMessage responseSjedistaPovratak = sjedisteServis.GetActionResponse("SearchSlobodnaSjedista", OdabraniLetPovratak.LetID.ToString(), OdabranaKlasaPovratak.ToString());
                if (responseSjedistaPovratak.IsSuccessStatusCode)
                {
                    var jsonObject            = responseSjedistaPovratak.Content.ReadAsStringAsync();
                    Sjedista_IndexVM sjedista = JsonConvert.DeserializeObject <Sjedista_IndexVM>(jsonObject.Result);
                    pickerSjedistePovratak.ItemsSource        = sjedista.sjedista;
                    pickerSjedistePovratak.ItemDisplayBinding = new Binding("OznakaSaProzorom");
                }
                else
                {
                    DisplayAlert("Greška", "Neka greška", "Nazad");
                }
            }
        }
        private void BindNarudzbe()
        {
            HttpResponseMessage response = narudzbeService.GetActionResponse("SelectAktivneByKupacID", Global.prijavljeniKupac.KupacID);

            if (response.IsSuccessStatusCode)
            {
                listNarudzbe.ItemsSource = response.Content.ReadAsAsync <List <Narudzbe> >().Result;
            }
        }
Esempio n. 7
0
        private void checkList()
        {
            var parametar   = OblastId.ToString() + "/" + GradId.ToString() + "/" + TipStudentaId.ToString();
            var response    = tutorService.GetActionResponse("TutorCount", parametar);
            var jasonObject = response.Content.ReadAsStringAsync();
            var tutori      = JsonConvert.DeserializeObject <int>(jasonObject.Result);

            nextPage = Items.Count < tutori;
        }
Esempio n. 8
0
        private void checkList()
        {
            var parametar   = OblastId.ToString() + "/" + GradId.ToString() + "/" + TipStudentaId.ToString();
            var response    = ucionicaService.GetActionResponse("selectMobileNum", parametar);
            var jasonObject = response.Content.ReadAsStringAsync();
            var ucionice    = JsonConvert.DeserializeObject <int>(jasonObject.Result);

            nextPage = Items.Count < ucionice;
        }
        private bool validateEmail()
        {
            if (emailInput.Text == null)
            {
                emailError.Text      = "Email obavezan!";
                emailError.IsVisible = true;
                return(false);
            }
            string a = emailInput.Text;

            if (Regex.Match(a, "^[[email protected]]*$").Success)
            {
                a = a.Replace('.', ',');
            }
            else
            {
                emailError.Text      = "Dozvoljeni specijalni karakteri su  ( _ @ . - )!";
                emailError.IsVisible = true;
                return(false);
            }

            HttpResponseMessage response = servis.GetActionResponse("CheckEmail2", a);
            Dostavljac          postoji  = null;

            if (response.IsSuccessStatusCode)
            {
                postoji = response.Content.ReadAsAsync <Dostavljac>().Result;
            }
            else
            {
                postoji = null;
            }

            try
            {
                MailAddress mail = new MailAddress(emailInput.Text);
                if (postoji == null)
                {
                    emailError.IsVisible = false;
                    emailError.Text      = "";
                    return(true);
                }
                else
                {
                    emailError.Text      = "Email već postoji!";
                    emailError.IsVisible = true;
                    return(false);
                }
            }
            catch (Exception)
            {
                emailError.Text      = "Email nije u ispravnom formatu!";
                emailError.IsVisible = true;
                return(false);
            }
        }
        private void BindPickers()
        {
            List <string> spol = new List <string>();

            spol.Add("Odaberite spol");
            spol.Add("Muški");
            spol.Add("Ženski");
            pickerSpol.ItemsSource   = spol;
            pickerSpol.SelectedIndex = 0;

            List <string> tipPutnika = new List <string>();

            tipPutnika.Add("Odrasli");
            tipPutnika.Add("Djeca");
            pickerTipPutnika.ItemsSource   = tipPutnika;
            pickerTipPutnika.SelectedIndex = 0;

            List <string> tipDokumenta = new List <string>();

            tipDokumenta.Add("Odaberite tip");
            tipDokumenta.Add("Pasoš");
            tipDokumenta.Add("Lična karta");
            tipDokumenta.Add("Viza za osobno putovanje");
            tipDokumenta.Add("Viza za poslovno putovanje");
            pickerTipDokumenta.ItemsSource   = tipDokumenta;
            pickerTipDokumenta.SelectedIndex = 0;

            HttpResponseMessage response = sjedisteServis.GetActionResponse("SearchSlobodnaSjedista", letPolazakId.ToString(), 0.ToString());//samo ekonomska

            if (response.IsSuccessStatusCode)
            {
                var jsonObject            = response.Content.ReadAsStringAsync();
                Sjedista_IndexVM sjedista = JsonConvert.DeserializeObject <Sjedista_IndexVM>(jsonObject.Result);
                pickerSjediste.ItemsSource   = sjedista.sjedista;
                pickerSjediste.SelectedIndex = 0;
            }
            else
            {
                DisplayAlert("Greška", "Neka greška", "Nazad");
            }

            HttpResponseMessage response1 = sjedisteServis.GetActionResponse("SearchSlobodnaSjedista", letDolazakId.ToString(), 0.ToString());//samo ekonomska

            if (response1.IsSuccessStatusCode)
            {
                var jsonObject            = response1.Content.ReadAsStringAsync();
                Sjedista_IndexVM sjedista = JsonConvert.DeserializeObject <Sjedista_IndexVM>(jsonObject.Result);
                pickerSjediste1.ItemsSource   = sjedista.sjedista;
                pickerSjediste1.SelectedIndex = 0;
            }
            else
            {
                DisplayAlert("Greška", "Neka greška", "Nazad");
            }
        }
Esempio n. 11
0
        private void BindPreporuceniProizvodi()
        {
            HttpResponseMessage response = proizvodiService.GetActionResponse("RecomendedProduct", proizvod.ProizvodID);

            if (response.IsSuccessStatusCode)
            {
                List <Proizvodi> preporuceniProizvodi = response.Content.ReadAsAsync <List <Proizvodi> >().Result;
                if (preporuceniProizvodi != null)
                {
                    listPreporuceniProizvodi.ItemsSource = preporuceniProizvodi;
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            HttpResponseMessage response = rezervacijeServis.GetActionResponse("SearchRezervacijeByPutnik", txtImePrezime.Text);

            if (response.IsSuccessStatusCode)
            {
                dgvRezervacije.DataSource = response.Content.ReadAsAsync <Rezervacije_IndexVM>().Result.podaci;
                dgvRezervacije.ClearSelection();
            }
            else
            {
                MessageBox.Show(response.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        private void BindLetovi()
        {
            HttpResponseMessage respones = letServis.GetActionResponse("SearchLetPosPonuda", "");

            if (respones.IsSuccessStatusCode)
            {
                dgvLetovi.DataSource = respones.Content.ReadAsAsync <Letovi_IndexVM>().Result.podaci;
                dgvLetovi.ClearSelection();
            }
            else
            {
                MessageBox.Show(respones.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BindZaposlenici()
        {
            HttpResponseMessage response = servis.GetActionResponse("SearchAllPosada", "p");

            if (response.IsSuccessStatusCode)
            {
                Zaposlenici_IndexVM Model = response.Content.ReadAsAsync <Zaposlenici_IndexVM>().Result;
                dgvZaposlenici.DataSource = Model.podaci;
            }
            else
            {
                MessageBox.Show(response.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 15
0
        private void checkList()
        {
            var response    = ocjenaTutorService.GetActionResponse("TutorReview", TutorId.ToString());
            var jasonObject = response.Content.ReadAsStringAsync();
            var ocjene      = JsonConvert.DeserializeObject <List <OcjenaTutor> >(jasonObject.Result);

            if (ocjene != null)
            {
                nextPage = Items.Count < ocjene.Count;
            }
            else
            {
                nextPage = false;
            }
        }
Esempio n. 16
0
        private void BindPosada()
        {
            HttpResponseMessage response = posadaServis.GetActionResponse("SearchPosadaLeta", let.LetID.ToString());

            if (response.IsSuccessStatusCode)
            {
                dgvPosada.DataSource = response.Content.ReadAsAsync <List <PosadaLeta> >().Result;
                dgvPosada.ClearSelection();
                brojClanova = dgvPosada.RowCount;
            }
            else
            {
                MessageBox.Show(response.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void BindKorisniciGrid()
        {
            HttpResponseMessage response = korisniciService.GetActionResponse("SearchKorisnici", usernameInput.Text.Trim());

            if (response.IsSuccessStatusCode)
            {
                List <Korisnik> korisnici = response.Content.ReadAsAsync <List <Korisnik> >().Result;
                korisniciGrid.DataSource = korisnici;
            }
            else
            {
                MessageBox.Show("Error Code" +
                                response.StatusCode + " : Message - " + response.ReasonPhrase);
            }
        }
Esempio n. 18
0
        private void BindGrid()
        {
            HttpResponseMessage korisniciResponse = korisniciService.GetActionResponse("SearchKorisnici", txtImePrezimePretraga.Text.Trim());

            if (korisniciResponse.IsSuccessStatusCode)
            {
                List <Korisnici> korisnici = korisniciResponse.Content.ReadAsAsync <List <Korisnici> >().Result;
                dgKorisnici.DataSource = korisnici;
            }

            else
            {
                MessageBox.Show("Error Code:" + korisniciResponse.StatusCode + "Message: " + korisniciResponse.ReasonPhrase);
            }
        }
Esempio n. 19
0
        private void btnProcesiraj_Click(object sender, EventArgs e)
        {
            if (this.ValidateChildren())
            {
                bool imaNaSkladistu = true;



                Izlazi izlaz = new Izlazi();
                izlaz.KorisnikID  = Global.prijavljeniKorisnici.KorisnikID;
                izlaz.NarudzbaID  = odabranaNarudzba.NarudzbaID;
                izlaz.IznosSaPDV  = (decimal)odabranaNarudzba.Iznos;
                izlaz.IznosBezPDV = (decimal)odabranaNarudzba.Iznos / (decimal)1.17;
                izlaz.SkladisteID = Convert.ToInt32(listSkladista.SelectedValue);
                string message = "";

                for (int i = 0; i < stavkeNarudzbe.Count; i++)
                {
                    HttpResponseMessage responseProizvodi = proizvodiService.GetActionResponse("StanjeNaSkladistu", stavkeNarudzbe[i].ProizvodID, izlaz.SkladisteID);
                    if (responseProizvodi.IsSuccessStatusCode)
                    {
                        int stanjeNaSkladistu = responseProizvodi.Content.ReadAsAsync <int>().Result;
                        if (stanjeNaSkladistu < stavkeNarudzbe[i].Kolicina)
                        {
                            imaNaSkladistu = false;
                            message       += "Proizvoda " + stavkeNarudzbe[i].Naziv + " nema dovoljno na odabranom skladištu!" + Environment.NewLine;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Error: " + responseProizvodi.StatusCode + Environment.NewLine + "Message: " + responseProizvodi.ReasonPhrase);
                    }
                }


                if (imaNaSkladistu)
                {
                    HttpResponseMessage responseIzlazi = izlaziService.PostResponse(izlaz);
                    if (responseIzlazi.IsSuccessStatusCode)
                    {
                        MessageBox.Show("Narudža " + odabranaNarudzba.BrojNarudzbe + " uspješno procesirana!");

                        HttpResponseMessage responseNarudzbe = narudzbeService.GetActionResponse("SelectAktivne", txtDatum.Text.Trim());
                        dgNarudzbe.Refresh();
                        BindGridNarudzbe();
                    }
                    else
                    {
                        MessageBox.Show("Error: " + responseIzlazi.StatusCode + Environment.NewLine + "Message: " + responseIzlazi.ReasonPhrase);
                    }
                }



                else
                {
                    MessageBox.Show(message);
                }
            }
        }
Esempio n. 20
0
        private void Login()
        {
            var response = _userService.GetActionResponse("GetByUsername", UsernameInput.Text);

            if (response.StatusCode == HttpStatusCode.NotFound)
            {
                MessageBox.Show("Username or password is incorrect", "Warning", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
            else if (response.IsSuccessStatusCode)
            {
                var user = response.Content.ReadAsAsync <User>().Result;
                if (user.PasswordHash == PasswordHelper.GenerateHash(PasswordInput.Text, user.PasswordSalt))
                {
                    DialogResult      = DialogResult.OK;
                    Global.OnlineUser = user;
                    Close();
                }
                else
                {
                    MessageBox.Show("Password is incorrect", "Warning", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Error Code: " + response.StatusCode + " Message: " + response.ReasonPhrase);
            }
        }
Esempio n. 21
0
        private void BtnPriava_Clicked(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtLozinka.Text))
            {
                errorLabel.Text = "Email i lozinka su obavezno polje";
            }
            else
            {
                errorLabel.Text = null;

                HttpResponseMessage response = korisnikServis.GetActionResponse("SearchKorisnikByPrijava", txtEmail.Text, txtLozinka.Text, 0.ToString());

                if (response.IsSuccessStatusCode)
                {
                    var      jsonResult = response.Content.ReadAsStringAsync();
                    Korisnik k          = JsonConvert.DeserializeObject <Korisnik>(jsonResult.Result);
                    Global.logiraniKorisnik = k;
                    Navigation.PushModalAsync(new Navigacija());
                }
                else
                {
                    DisplayAlert("Greška", "Pogrešan email ili lozinka", "Nazad");
                }
            }
        }
Esempio n. 22
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            HttpResponseMessage response = service.GetActionResponse("GetKupciByUsername", korisnickoImeInput.Text);
            string message = string.Empty;    string message = string.Empty;

            if (response.IsSuccessStatusCode)
            {
                Kupci k = response.Content.ReadAsAsync <Kupci>().Result;
                if (UIHelper.GenerateHash(lozinkaInput.Password, k.LozinkaSalt) == k.LozinkaHash)
                {
                    message = "Welcome " + k.Ime + " " + k.Prezime;
                    Global.prijavljeniKupac = k;
                    Frame.Navigate(typeof(MainPage));
                }
                else
                {
                    message = "Podaci nisu validni";
                }
            }
            else
            {
                message = "Greska u komunikaciji sa webApi-em";
            }
            MessageDialog msg = new MessageDialog(message);
            await msg.ShowAsync();
        }
Esempio n. 23
0
        private void PrijavaCheck()
        {
            var response = studentService.GetActionResponse("AllPrijave", Global.prijavljeniStudent.StudentId.ToString());

            if (response.IsSuccessStatusCode)
            {
                bool check       = true;
                var  jasonObject = response.Content.ReadAsStringAsync();
                var  lstPrijava  = JsonConvert.DeserializeObject <List <Prijava> >(jasonObject.Result);
                foreach (var item in lstPrijava)
                {
                    if (item.UcionicaId.Equals(idUcionice))
                    {
                        if (item.Prihvaceno)
                        {
                            docDownloadBtn.IsVisible = true;
                        }

                        check = false;
                    }
                }

                zahtjevBtn.IsVisible = check;
            }
        }
Esempio n. 24
0
        private async void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            HttpResponseMessage response = korisniciService.GetActionResponse("GetUserByUsername", korisnickoImeInput.Text.Trim());

            if (response.IsSuccessStatusCode)
            {
                Kupci k = response.Content.ReadAsAsync <Kupci>().Result;

                string hash = UIHelper.GenerateHash(lozinkaInput.Password, k.LozinkaSalt);
                if (hash == k.LozinkaHash)
                {
                    Global.prijavljeniKupac = k;
                    Global.Lozinka          = lozinkaInput.Password;
                    MessageDialog dialog = new MessageDialog("Welcome " + k.Ime + " " + k.Prezime);
                    await dialog.ShowAsync();

                    Frame.Navigate(typeof(MainPage));
                }
                else
                {
                    MessageDialog dialog = new MessageDialog("Wrong password");
                    await dialog.ShowAsync();
                }
            }
            else
            {
                MessageDialog dialog = new MessageDialog("Wrong username");
                await dialog.ShowAsync();
            }
        }
Esempio n. 25
0
        public frm_KorisniciUredi(Korisnici k)
        {
            this.k = k;

            HttpResponseMessage ulogeResponse = ulogeService.GetResponse();

            InitializeComponent();

            txtIme.Text                        = k.Ime;
            txtPrezime.Text                    = k.Prezime;
            txtEmail.Text                      = k.Email;
            txtTelefon.Text                    = k.Telefon;
            txtKorisnickoIme.Text              = k.KorisnickoIme;
            ((ListBox)ulogeList).DataSource    = ulogeResponse.Content.ReadAsAsync <List <Uloge> >().Result;
            ((ListBox)ulogeList).DisplayMember = "Naziv";
            ((ListBox)ulogeList).ValueMember   = "UlogaID";

            ulogeResponse = korisniciService.GetActionResponse(k.KorisnikID, "Uloge");
            List <Uloge> ulogeKorisnika = ulogeResponse.Content.ReadAsAsync <List <Uloge> >().Result;

            k.Uloge = ulogeKorisnika;

            for (int i = 0; i < ulogeKorisnika.Count; i++)
            {
                ulogeList.SetItemChecked(ulogeKorisnika[i].UlogaID, true);
            }
        }
        private void BindOdrediste()
        {
            HttpResponseMessage response = gradServis.GetActionResponse("GetPolazisteOdrediste", "parametar");

            if (response.IsSuccessStatusCode)
            {
                List <Grad> gradovi = response.Content.ReadAsAsync <List <Grad> >().Result;
                gradovi.Insert(0, new Grad("*Odaberite odredište*"));
                cmbOdrediste.DataSource    = gradovi.OrderBy(x => x.Naziv).ToList();
                cmbOdrediste.ValueMember   = "GradID";
                cmbOdrediste.DisplayMember = "Naziv";
            }
            else
            {
                MessageBox.Show("Error code: " + response.StatusCode + " Message: " + response.ReasonPhrase);
            }
        }
Esempio n. 27
0
        private void BindGridNarudzbe()
        {
            string date = txtDatum.Value.Year.ToString() + "-" + txtDatum.Value.Month.ToString() + "-" + txtDatum.Value.Day.ToString();
            HttpResponseMessage responseNarudzbe = narudzbeService.GetActionResponse("SelectAktivne", date);


            if (responseNarudzbe.IsSuccessStatusCode)
            {
                dgNarudzbe.AutoGenerateColumns = false;
                dgNarudzbe.DataSource          = responseNarudzbe.Content.ReadAsAsync <List <Narudzbe_Result> >().Result;
            }

            else
            {
                MessageBox.Show("Error: " + responseNarudzbe.StatusCode + Environment.NewLine + "Message: " + responseNarudzbe.ReasonPhrase);
            }
        }
        public EditForm(int id)
        {
            InitializeComponent();
            this.AutoValidate = AutoValidate.Disable;

            HttpResponseMessage response = zaposlenikServis.GetActionResponse("GetZaposlenikByID", id.ToString());

            if (response.IsSuccessStatusCode)
            {
                z = response.Content.ReadAsAsync <Zaposlenik>().Result;
                FillForm();
            }
            else
            {
                z = null;
                MessageBox.Show(response.ReasonPhrase, Poruke.error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 29
0
        private void BindStavke()
        {
            HttpResponseMessage response = narudzbeService.GetActionResponse("SelectProizvodiStavke", narudzba.NarudzbaID);

            if (response.IsSuccessStatusCode)
            {
                listNarudzbaStavke.ItemsSource = response.Content.ReadAsAsync <List <ProizvodiNarudzbe> >().Result;
            }
        }
        private void ukloniButton_Click(object sender, EventArgs e)
        {
            if (knjigeGrid.SelectedRows.Count > 0)
            {
                HttpResponseMessage response = desktopService.GetActionResponse("RemoveKnjiga", policaidLabel.Text + "/" + knjigeGrid.SelectedRows[0].Cells[0].Value.ToString());

                if (response.IsSuccessStatusCode)
                {
                    MessageBox.Show("Knjiga uspjesno uklonjena!");
                    BindGrid();
                }
                else
                {
                    MessageBox.Show("Error Code" +
                                    response.StatusCode + " : Message - " + response.ReasonPhrase);
                }
            }
        }