Пример #1
0
 //=========================================================
 // PRIVATE FUNCTIONS
 //=========================================================
 protected ProviderCategory(Category aCategory)
     : base(aCategory)
 {
 }
Пример #2
0
 protected override void EntityClear()
 {
     _entityCategory = new Category();
     _entityCategory.Id = -1;
     _entityCategory.SystemCreateDate = new DateTime();
     _entityCategory.SystemEditDate = new DateTime();
     _entityCategory.CreateDate = new DateTime();
     _entityCategory.EditDate = new DateTime();
     _entityCategory.IsHidden = false;
     _entityCategory.Title = String.Empty;
     _entityCategory.ParentCategoryId = Root.Id;
     _entityCategory.HierarchyLevel = -1; // useful to get all categories in a certain level or check what level this category is on
     _entityCategory.FullPath = String.Empty; // used internally by the entity framework and database
 }
Пример #3
0
 protected static ProviderCategory _EntityToProvider(Category categoryEntity)
 {
     return new ProviderCategory(categoryEntity);
 }
Пример #4
0
        protected static bool CreateRoot(InsideWordEntities dbCtx)
        {
            // Note: The root creation function behaves VERY differently than a normal provider save
            Category root = new Category();
            root.Id = -1;
            root.SystemCreateDate = DateTime.UtcNow;
            root.SystemEditDate = DateTime.UtcNow;
            root.CreateDate = DateTime.UtcNow;
            root.EditDate = DateTime.UtcNow;
            root.IsHidden = false;
            root.Title = "root";
            root.ParentCategoryId = null;
            root.HierarchyLevel = -1; // useful to get all categories in a certain level or check what level this category is on
            root.FullPath = String.Empty; // used internally by the entity framework and database

            try
            {
                dbCtx.Categories.AddObject(root);
                dbCtx.SaveChanges();
                // Since the categories use triggers to update their hierarchy it is mandatory that a refresh be done on the entity
                // otherwise the data in HierarchyLevel and FullPath can be incorrect after a save.
                dbCtx.Refresh(RefreshMode.StoreWins, root);

            }
            catch (Exception caughtException)
            {
                DbCtx.Instance.Detach(root);
                throw caughtException;
            }

            return true;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategories(Category category)
 {
     base.AddObject("Categories", category);
 }
 /// <summary>
 /// Create a new Category object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="editDate">Initial value of the EditDate property.</param>
 /// <param name="createDate">Initial value of the CreateDate property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="isHidden">Initial value of the IsHidden property.</param>
 /// <param name="hierarchyLevel">Initial value of the HierarchyLevel property.</param>
 /// <param name="fullPath">Initial value of the FullPath property.</param>
 /// <param name="systemEditDate">Initial value of the SystemEditDate property.</param>
 /// <param name="systemCreateDate">Initial value of the SystemCreateDate property.</param>
 public static Category CreateCategory(global::System.Int64 id, global::System.DateTime editDate, global::System.DateTime createDate, global::System.String title, global::System.Boolean isHidden, global::System.Int32 hierarchyLevel, global::System.String fullPath, global::System.DateTime systemEditDate, global::System.DateTime systemCreateDate)
 {
     Category category = new Category();
     category.Id = id;
     category.EditDate = editDate;
     category.CreateDate = createDate;
     category.Title = title;
     category.IsHidden = isHidden;
     category.HierarchyLevel = hierarchyLevel;
     category.FullPath = fullPath;
     category.SystemEditDate = systemEditDate;
     category.SystemCreateDate = systemCreateDate;
     return category;
 }