Ejemplo n.º 1
0
        /// <summary>
        /// Adds an <see cref="HaushaltsRechner.Data.Model.CATEGORY"/>.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns><c>true</c>, if addition successfull</returns>
        public static bool AddCategory(string name)
        {
            using (var en = new HaushaltsrechnerEntities())
            {
                var cOld = en.CATEGORY.FirstOrDefault(cat => cat.NAME == name);

                if (cOld == null)
                {
                    var c = new CATEGORY
                    {
                        ID = Guid.NewGuid(),
                        NAME = name
                    };

                    en.CATEGORY.AddObject(c);
                    en.SaveChanges();

                    return true;
                }

                return false;
            }
        }
 /// <summary>
 /// Erstellt ein neues CATEGORY-Objekt.
 /// </summary>
 /// <param name="id">Anfangswert der Eigenschaft ID.</param>
 /// <param name="nAME">Anfangswert der Eigenschaft NAME.</param>
 public static CATEGORY CreateCATEGORY(global::System.Guid id, global::System.String nAME)
 {
     CATEGORY cATEGORY = new CATEGORY();
     cATEGORY.ID = id;
     cATEGORY.NAME = nAME;
     return cATEGORY;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CategorySummary" /> class.
 /// </summary>
 /// <param name="cat">The <see cref="HaushaltsRechner.Data.Model.CATEGORY"/></param>
 /// <param name="movementAmounts">List of all <see cref="HaushaltsRechner.Data.Model.MOVEMENT"/>s.</param>
 public CategorySummary(CATEGORY cat, List<GridMovement> movementAmounts)
     : this(cat.ID, cat.NAME, movementAmounts)
 {
 }
 /// <summary>
 /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'CATEGORY'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet&lt;T&gt;'.
 /// </summary>
 public void AddToCATEGORY(CATEGORY cATEGORY)
 {
     base.AddObject("CATEGORY", cATEGORY);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CategorySummary" /> class.
 /// </summary>
 /// <param name="cat">The <see cref="HaushaltsRechner.Data.Model.CATEGORY"/></param>
 public CategorySummary(CATEGORY cat)
     : this(cat.ID, cat.NAME, null)
 {
 }