Exemplo n.º 1
0
        public int UpdateActiveCountryNotes(ActiveCountryItem newItem)
        {
            string queryString = "update " + tableActiveCountry
                                 + " set note=@note where id=@id";

            using (SQLiteConnection connection = new SQLiteConnection(strConnection))
                using (SQLiteCommand dbCommand = new SQLiteCommand(queryString, connection))
                {
                    // Set command parameters.
                    dbCommand.Parameters.AddWithValue("@id", newItem.Id);
                    dbCommand.Parameters.AddWithValue("@note", newItem.Note);

                    // Update active ocuntry in table.
                    connection.Open();
                    int result = dbCommand.ExecuteNonQuery();

                    // Notify changes.
                    if (this.CountryModified != null)
                    {
                        this.CountryModified(this, null);
                    }

                    // Return the result.
                    return(result);
                }
        }
Exemplo n.º 2
0
        public int AddActiveCountry(ActiveCountryItem newItem)
        {
            string queryString = "insert into " + tableActiveCountry + " values(null, @iso2, @note)";

            using (SQLiteConnection connection = new SQLiteConnection(strConnection))
                using (SQLiteCommand dbCommand = new SQLiteCommand(queryString, connection))
                {
                    // Set command parameters.
                    dbCommand.Parameters.AddWithValue("@iso2", newItem.Iso2Code);
                    dbCommand.Parameters.AddWithValue("@note", newItem.Note);

                    // Add new active country to table.
                    connection.Open();
                    int result = dbCommand.ExecuteNonQuery();

                    // Notify changes.
                    if (this.CountryModified != null)
                    {
                        this.CountryModified(this, null);
                    }

                    // Return the result.
                    return(result);
                }
        }
Exemplo n.º 3
0
        public int DeleteActiveCountry(ActiveCountryItem newItem)
        {
            string queryString = "delete from " + tableActiveCountry + " where id=@id";

            using (SQLiteConnection connection = new SQLiteConnection(strConnection))
                using (SQLiteCommand dbCommand = new SQLiteCommand(queryString, connection))
                {
                    // Set command parameters.
                    dbCommand.Parameters.AddWithValue("@id", newItem.Id);

                    // Delete active country from table.
                    connection.Open();
                    int result = dbCommand.ExecuteNonQuery();

                    // Notify changes.
                    if (this.CountryModified != null)
                    {
                        this.CountryModified(this, null);
                    }

                    // Return the result.
                    return(result);
                }
        }