Beispiel #1
0
 public bool DeleteOseba(Oseba toDelete)
 {
     using (SQLiteCommand com = new SQLiteCommand(con))
     {
         com.CommandText = "DELETE FROM osebe WHERE ID = '" + toDelete.UserID + "'";//SQL STAVEK
         com.ExecuteNonQuery();
         com.Dispose();
     }
     return(true);
 }
Beispiel #2
0
 public bool AddOseba(Oseba toAdd)
 {
     using (SQLiteCommand com = new SQLiteCommand(con))
     {
         com.CommandText = "INSERT INTO osebe (FirstName, LastName, HomeAddress, Post, City, PhoneNumber, EMailAddress, PhoneBook_id)" +
                           "VALUES ('" + toAdd.FirstName + "', '" + toAdd.LastName + "','" + toAdd.HomeAdress + "', '" + toAdd.Post + "', '" + toAdd.City + "','" + toAdd.PhoneNumber + "','" + toAdd.EMailAddress + "', '" + toAdd.PhoneBook_id + "')"; //SQL STAVEK
         com.ExecuteNonQuery();
         com.Dispose();
     }
     return(true);
 }
Beispiel #3
0
        /// <summary>
        ///  Tle je pa zdej treba mal več dela... Za izpis oseb in imenikov
        /// </summary>

        public Oseba ShowOsebe(Oseba toShow)
        {
            Oseba toReturn = null;

            using (SQLiteCommand com = new SQLiteCommand(con))
            {
                com.CommandText = "SELECT * FROM osebe WHERE PhoneBook_id = '" + toShow.PhoneBook_id + "'";//SQL STAVEK
                using (SQLiteDataReader reader = com.ExecuteReader())
                    while (reader.HasRows)
                    {
                        reader.Read();
                        toReturn = new Oseba(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetInt32(4), reader.GetString(5), reader.GetString(6), reader.GetString(7), reader.GetInt32(8));
                        //             Oseba(int userID, string firstName, string lastName, string homeadress, int post, string city, int phonenumber, string emailaddress, int phonebook_id)
                    }
                com.Dispose();
            }
            return(toReturn);
        }
Beispiel #4
0
        public bool UpdateOseba(Oseba toUpdate)
        {
            using (SQLiteCommand com = new SQLiteCommand(con))
            {
                com.CommandText = "UPDATE osebe SET " +
                                  "FirstName = '" + toUpdate.FirstName + "', " +
                                  "LastName = '" + toUpdate.LastName + "', " +
                                  "HomeAddress = '" + toUpdate.HomeAdress + "', " +
                                  "Post = '" + toUpdate.Post + "', " +
                                  "City = '" + toUpdate.City + "', " +
                                  "PhoneNumber = '" + toUpdate.PhoneNumber + "', " +
                                  "EMailAddress = '" + toUpdate.EMailAddress + "' " +

                                  "WHERE PhoneBook_id = '" + toUpdate.PhoneBook_id + "' " +
                                  "AND ID = '" + toUpdate.UserID + "'"; //SQL STAVEK
                com.ExecuteNonQuery();
                com.Dispose();
            }
            return(true);
        }