예제 #1
0
 public Paket(int id, Potrosac posiljaoc, string grad, string drzava, double cijena, double tezina)
 {
     this.Id        = id;
     this.Posiljaoc = posiljaoc;
     this.Grad      = grad;
     this.Drzava    = drzava;
     this.Cijena    = cijena;
     this.Tezina    = tezina;
 }
예제 #2
0
 public void promijeniRacun(Potrosac p, Racun r)
 {
     foreach (Potrosac i in SviPotrosaci)
     {
         if (i == p)
         {
             i.sviRacuni.Find(k => k == r).PostaviPlacen();
         }
     }
 }
예제 #3
0
        public bool obrisiPotrosaca(string jmbg)
        {
            Potrosac p = dajPotrosaca(jmbg);

            if (p != null)
            {
                sviPotrosaci.Remove(p);
                return(true);
            }
            return(false);
        }
예제 #4
0
 public bool obrisan(Potrosac p)
 {
     foreach (Potrosac i in sviPotrosaci)
     {
         if (i.JMBG.Equals(p.JMBG))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #5
0
        public Potrosac dajPotrosaca(string jmbg)
        {
            Potrosac p = null;

            try
            {
                p = SviPotrosaci.Find((Potrosac i) => i.JMBG.Equals(jmbg));
            }
            catch (Exception)
            {
            }
            return(p);
        }
예제 #6
0
        public async Task <bool> dodajPotrosaca(Potrosac p)
        {
            /*
             * var values = new Dictionary<string, string>
             * {
             *  { "Ime", p.ime },
             *  { "Prezime", p.prezime },
             *  {"Email", p.email },
             *  {"Password", p.password },
             *  {"BrojTelefona", p.brojTelefona },
             *  {"Adresa", p.adresa },
             *  {"JMBG", p.JMBG },
             *  {"DatumRodjenja", p.datumRodjenja.ToString() },
             * };
             *
             * System.Net.Http.HttpClient client = new System.Net.Http.HttpClient();
             *
             * var response = await client.PostAsync("http://localhost:50180/Potrosacs/Create", content);*/

            /*var content = new FormUrlEncodedContent(values);
             *
             * var response = await client.PostAsync("http://www.example.com/recepticle.aspx", content);
             *
             * var responseString = await response.Content.ReadAsStringAsync();*/

            /*
             * try
             * {
             *  Potrosaci obj = new Potrosaci();
             *  obj.Ime = p.Ime;
             *  obj.Prezime = p.Prezime;
             *  obj.Adresa = p.Adresa;
             *  obj.Email = p.Email;
             *  obj.Jmbg = p.JMBG1;
             *  obj.BrojTelefona = p.BrojTelefona;
             *  await Task.Run(() => tabelaPotrosaci.InsertAsync(obj));
             *
             * }
             * catch (Exception ex)
             * {
             *  throw ex;
             *  //MessageDialog msgDialogError = new MessageDialog("Error : " + ex.ToString());
             *  //msgDialogError.ShowAsync();
             * }*/
            return(true);
        }
예제 #7
0
        public async Task <Potrosac> dajPotrosaca(string jmbg)

        {
            Windows.Web.Http.HttpClient httpClient = new Windows.Web.Http.HttpClient();

            var headers = httpClient.DefaultRequestHeaders;

            string header = "ie";

            if (!headers.UserAgent.TryParseAdd(header))
            {
                throw new Exception("Invalid header value: " + header);
            }

            header = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36";
            if (!headers.UserAgent.TryParseAdd(header))
            {
                throw new Exception("Invalid header value: " + header);
            }

            string url = "http://localhost:50180/Potrosacs/GetJMBG?JMBG=" + jmbg;
            //Uri requestUri = new Uri("http://localhost:50180/Potrosacs/GetAccount?Email" + EMail + "&password="******"";

            try
            {
                httpResponse = await httpClient.GetAsync(requestUri);

                httpResponse.EnsureSuccessStatusCode();
                httpResponseBody = await httpResponse.Content.ReadAsStringAsync();

                string json = httpResponseBody;
                novi = JsonConvert.DeserializeObject <Potrosac>(json);

                return(novi);
            }
            catch (Exception ex)
            {
                httpResponseBody = "Error: " + ex.HResult.ToString("X") + " Message: " + ex.Message;
            }
            return(null);

            /*try
             * {
             *  Trazeni = null;
             *  Trazeni = await Task.Run(() => Baza.Instanca.dajPotrosaca(Jmbg));
             *
             *  if (Trazeni != null)
             *  {
             *      Found = true;
             *      var dialog = new MessageDialog("Uspjesno pronadjen potrosac!");
             *      await dialog.ShowAsync();
             *  }
             *  else
             *  {
             *      Found = false;
             *      var dialog = new MessageDialog("Nije pronadjen potrosac.");
             *      await dialog.ShowAsync();
             *  }
             * }
             * catch(Exception)
             * {
             *
             * }*/
        }
예제 #8
0
 public void dodajPotrosaca(Potrosac p)
 {
     SviPotrosaci.Add(p);
 }