Ejemplo n.º 1
0
        public virtual bool Delete()
        {
            SoftFluent.Samples.RedisCache.Product.ClearCache();
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Product", "Delete");
            persistence.AddParameter("@Product_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Ejemplo n.º 2
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Publication", "Delete");
            persistence.AddParameter("@Publication_Id", this.Id, ((int)(-1)));
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Ejemplo n.º 3
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "RoleClaim", "Delete");
            persistence.AddParameter("@RoleClaim_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Ejemplo n.º 4
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "User", "Delete");
            persistence.AddParameter("@User_Id", this.Id, default(string));
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Ejemplo n.º 5
0
        internal void SaveProductsRelations()
        {
            if ((this._products == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._products)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry        entry        = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Json.NET.Product               product      = ((SoftFluent.Json.NET.Product)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((product.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)
                      == false)))
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
                    persistence.CreateStoredProcedureCommand(null, "Publication", "SaveProductPublications");
                    persistence.AddParameter("@Product_Id", product.Id, ((int)(-1)));
                    persistence.AddParameter("@Publication_Id", this.Id, ((int)(-1)));
                    persistence.ExecuteNonQuery();
                }
                else
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
                    persistence1.CreateStoredProcedureCommand(null, "Publication", "DeleteProductPublications");
                    persistence1.AddParameter("@Product_Id", product.Id, ((int)(-1)));
                    persistence1.AddParameter("@Publication_Id", this.Id, ((int)(-1)));
                    persistence1.ExecuteNonQuery();
                }
                if ((product.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    product.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._products)).Relations.Clear();
        }
Ejemplo n.º 6
0
        internal void SaveUsersRelations()
        {
            if ((this._users == null))
            {
                return;
            }
            System.Collections.IEnumerator enumerator = ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.GetEnumerator();
            bool b;

            for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
            {
                System.Collections.DictionaryEntry entry = ((System.Collections.DictionaryEntry)(enumerator.Current));
                SoftFluent.Samples.Thinktecture.IdentityServer.User user         = ((SoftFluent.Samples.Thinktecture.IdentityServer.User)(entry.Key));
                CodeFluent.Runtime.CodeFluentRelationType           relationType = ((CodeFluent.Runtime.CodeFluentRelationType)(entry.Value));
                if (((relationType == CodeFluent.Runtime.CodeFluentRelationType.Added) &&
                     ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked)
                      == false)))
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
                    persistence.CreateStoredProcedureCommand(null, "User", "SaveRoleUsers");
                    persistence.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence.ExecuteNonQuery();
                }
                else
                {
                    CodeFluent.Runtime.CodeFluentPersistence persistence1 = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
                    persistence1.CreateStoredProcedureCommand(null, "User", "DeleteRoleUsers");
                    persistence1.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence1.AddParameter("@User_Id", user.Id, CodeFluentPersistence.DefaultGuidValue);
                    persistence1.ExecuteNonQuery();
                }
                if ((user.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeUnlinked))
                {
                    user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                }
            }
            ((CodeFluent.Runtime.ICodeFluentSet)(this._users)).Relations.Clear();
        }
Ejemplo n.º 7
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Customer", "Delete");
            persistence.AddParameter("@Customer_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }