Ejemplo n.º 1
0
        private List <Stavka> LstStavki()
        {
            string joinQuery =
                @"SELECT Stavka, Opis FROM [Stavki] AS S ORDER BY Stavka;";

            List <Stavka> _lstStavka = new List <Stavka>();

            string connStr = "Data Source = E:\\vs2017\\svPloter\\eOFIdata.db; Version = 3;";

            //System.Data.SQLite.SQLiteConnection.CreateFile("Data Source = Config\\Data\\eOFIdata.db; Version = 3;");
            using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(connStr))
            {
                using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con))
                {
                    con.Open();                  // Open the connection to the database
                    com.CommandText = joinQuery; // Select all rows from our database table

                    using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Stavka s = new Stavka();
                            s.eKod  = reader["Stavka"].ToString();
                            s.Vrska = reader["Opis"].ToString();

                            _lstStavka.Add(s);
                        }
                    }

                    con.Close(); // Close the connection to the database
                }
            }

            return(_lstStavka);
        }
Ejemplo n.º 2
0
        private ofiObj SumRes(Stavka s, List <ofiObj> lsRes)
        {
            ofiObj ofiRes = new ofiObj();

            ofiRes.e_kod = s.eKod;
            ofiRes.Opis  = s.Vrska;
            foreach (ofiObj o in lsRes)
            {
                ofiRes.Sum(o);
            }
            return(ofiRes);
        }