Exemple #1
0
        public void IzbrisiStavku(StavkaNarudzbeNode ns)
        {
            stavkeNarudzbeNodeStore.RemoveNode(ns);
            narudzba.Stavke.Remove(ns.stavka);
            UpdateUkupno();

            DBStavkeNarudzbe.DeleteStavka(ns.stavka);
            MainWindow.stavkeChanged();
        }
Exemple #2
0
        public void DodajStavku(StavkaNarudzbe ns)
        {
            narudzba.AddStavka(ns);            //CheckUniqueArtikl u proceduri
            stavkeNarudzbeNodeStore.Add(ns, OznakaStola);
            UpdateUkupno();

            DBStavkeNarudzbe.SaveStavka(narudzba, ref ns);
            MainWindow.stavkeChanged();
        }
Exemple #3
0
        public static void DeleteNarudzba(Narudzba n)
        {
            SqliteCommand com = DB.con.CreateCommand();

            DBStavkeNarudzbe.DeleteStavke(n);
            com.CommandText = String.Format(@"DELETE FROM Narudzba WHERE id = {0}", n.ID);

            com.ExecuteNonQuery();
            com.Dispose();
        }
Exemple #4
0
        public void UpdateStavku(StavkaNarudzbeNode ns, string sifra, int kolicina, int status)
        {
            narudzba.CheckUniqueArtikl(ns.stavka, sifra);
            ns.Sifra    = sifra;
            ns.Kolicina = kolicina.ToString();
            ns.Status   = StavkaNarudzbe.GetStatus(status);
            UpdateUkupno();

            DBStavkeNarudzbe.UpdateStavka(ns.stavka);
            MainWindow.stavkeChanged();
        }
Exemple #5
0
        public static List <Narudzba> GetNarudzbe()
        {
            List <Narudzba> narudzbe = new List <Narudzba>();
            SqliteCommand   c        = DB.con.CreateCommand();

            c.CommandText = String.Format(@"SELECT id, broj, datum, oznaka_potvrde, ifnull(id_stol,0) as id_stol FROM Narudzba WHERE oznaka_potvrde = 'Nepotvrdeno' ");

            SqliteDataReader reader = c.ExecuteReader();

            while (reader.Read())
            {
                Narudzba n = new Narudzba((long)reader["id"], (string)reader["broj"],
                                          DateTime.FromFileTime((Int64)reader["datum"]),
                                          Narudzba.OznakaFromString((string)reader["oznaka_potvrde"]),
                                          StoloviPresenter.stoloviList.Find(s => s.ID == (long)reader["id_stol"]));

                DBStavkeNarudzbe.GetStavke(ref n);
                narudzbe.Add(n);
            }
            c.Dispose();
            return(narudzbe);
        }
 public void UpdateStatus(StavkaNarudzbe.StatusStavke status)
 {
     Status = status;
     DBStavkeNarudzbe.UpdateStavka(stavka);
 }