Exemplo n.º 1
0
        /// <summary>
        /// Methode zum hinzufügen eines neuen Eintrags in der Datenbank
        /// </summary>
        /// <param name="filterID">Die ID des Filters</param>
        /// <param name="name">Name des Filters</param>
        /// <param name="linking">Linking</param>
        /// <returns>Die ID des Eintrags in der Datenbank</returns>
        public static int Add(string name, string linking, int? formletterPatternID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var filterSet = new FilterSet()
                {
                    FormletterPattern = (formletterPatternID.HasValue) ? db.FormletterPatterns.Single(fp => fp.FormletterPatternID == formletterPatternID) : null,
                    Name = name,
                    Linking = linking
                };

                db.FilterSets.AddObject(filterSet);
                db.SaveChanges();

                return filterSet.FilterSetID;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Methode zum hinzufügen eines neuen Eintrags in der Datenbank
        /// </summary>
        /// <param name="filterID">Die ID des Filters</param>
        /// <param name="name">Name des Filters</param>
        /// <param name="linking">Linking</param>
        /// <returns>Die ID des Eintrags in der Datenbank</returns>
        public static int Add(string name, string linking, int?formletterPatternID = null)
        {
            using (TafelModelContainer db = new TafelModelContainer())
            {
                var filterSet = new FilterSet()
                {
                    FormletterPattern = (formletterPatternID.HasValue) ? db.FormletterPatterns.Single(fp => fp.FormletterPatternID == formletterPatternID) : null,
                    Name    = name,
                    Linking = linking
                };

                db.FilterSets.AddObject(filterSet);
                db.SaveChanges();

                return(filterSet.FilterSetID);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Wandelt ein FilterSet der Datenbank in eine Instanz von FilterSetModel um
        /// </summary>
        /// <param name="filterSet">DataModel.FilterSet</param>
        /// <returns>FilterSetModel</returns>
        public static FilterSetModel getFilterSetModelFromFilterSet(FilterSet filterSet)
        {
            if (filterSet == null)
                return null;

            IEnumerable<Filter> filters = Filter.GetFilters(null, filterSet.FilterSetID);

            // Name des FilterSets
            FilterSetModel filterSetModel = new FilterSetModel(filterSet.Linking);
            filterSetModel.name = filterSet.Name;

            // füge diesem filterSet alle filter hinzu
            foreach (var filter in filters)
            {
                FilterModel filterModel = new FilterModel();
                // konvertiere die strings aus der datenbank in enums
                filterModel.group = (FilterModel.Groups)Enum.Parse(typeof(FilterModel.Groups), filter.Table);
                filterModel.criterion = (FilterModel.Criterions)Enum.Parse(typeof(FilterModel.Criterions), filter.Type);
                filterModel.operation = (FilterModel.Operations)Enum.Parse(typeof(FilterModel.Operations), filter.Operation);
                filterModel.value = SafeStringParser.safeParseToStr(filter.Value);
                filterSetModel.filterList.Add(filterModel);
            }
            return filterSetModel;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'FilterSets'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToFilterSets(FilterSet filterSet)
 {
     base.AddObject("FilterSets", filterSet);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Erstellt ein neues FilterSet-Objekt.
 /// </summary>
 /// <param name="filterSetID">Anfangswert der Eigenschaft FilterSetID.</param>
 /// <param name="name">Anfangswert der Eigenschaft Name.</param>
 /// <param name="linking">Anfangswert der Eigenschaft Linking.</param>
 public static FilterSet CreateFilterSet(global::System.Int32 filterSetID, global::System.String name, global::System.String linking)
 {
     FilterSet filterSet = new FilterSet();
     filterSet.FilterSetID = filterSetID;
     filterSet.Name = name;
     filterSet.Linking = linking;
     return filterSet;
 }