public void AddTag([NotNull] HouseholdTag tag)
        {
            var stdt = new STHouseholdDistributionTag(null, tag, IntID, tag.Name,
                                                      ConnectionString, System.Guid.NewGuid().ToStrGuid());

            Tags.Add(stdt);
            stdt.SaveToDB();
        }
        public static void LoadFromDatabase([ItemNotNull][NotNull] ObservableCollection <STHouseholdDistribution> result,
                                            [NotNull] string connectionString, bool ignoreMissingTables, [ItemNotNull][NotNull] ObservableCollection <HouseholdTag> tags)
        {
            var aic = new AllItemCollections();

            LoadAllFromDatabase(result, connectionString, TableName, AssignFields, aic, ignoreMissingTables, false);

            var stHouseholdDistributionTags =
                new ObservableCollection <STHouseholdDistributionTag>();

            STHouseholdDistributionTag.LoadFromDatabase(stHouseholdDistributionTags, connectionString, tags,
                                                        ignoreMissingTables);
            SetSubitems(new List <DBBase>(result), new List <DBBase>(stHouseholdDistributionTags), IsCorrectParentHHDist,
                        ignoreMissingTables);
        }
        private static STHouseholdDistributionTag AssignFields([NotNull] DataReader dr, [NotNull] string connectionString,
                                                               bool ignoreMissingFields, [NotNull] AllItemCollections aic)
        {
            var id    = dr.GetIntFromLong("ID");
            var tagID = dr.GetIntFromLong("TagID", ignoreMissingField: ignoreMissingFields);
            var tag   = aic.HouseholdTags.FirstOrDefault(x => x.ID == tagID);

            var householdID = dr.GetIntFromLong("STHouseholdDistributionID");
            var name        = "(no name)";

            if (tag != null)
            {
                name = tag.Name;
            }
            var guid = GetGuid(dr, ignoreMissingFields);
            var hhp  = new STHouseholdDistributionTag(id, tag, householdID, name, connectionString, guid);

            return(hhp);
        }