Example #1
0
        public void AddChilds(MaterialCategoryObject materialCategory)
        {
            try
            {
                Revision blRev = new Revision();
                MaterialType bl = new MaterialType();
                materialCategory.Types = bl.GetByCategory(materialCategory);
                materialCategory.Revisions = blRev.GetByMaterialCategory(materialCategory);
                foreach (MaterialTypeObject materialType in  materialCategory.Types)
                {
                    materialType.SubTypes = new MaterialSubType().GetSubTypesByType(materialType);
                    materialType.Revisions = blRev.GetByMaterialType(materialType);
                    materialType.ChildsAdded = true;
                    foreach (MaterialSubTypeObject materialSubType in materialType.SubTypes)
                    {
                        materialSubType.Revisions = blRev.GetByMaterialSubType(materialSubType);
                        materialSubType.ChildsAdded = true;
                    }

                }
                materialCategory.ChildsAdded = true;
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Example #2
0
        public void Remove(MaterialSubTypeObject materialSubType)
        {
            try
            {
                CheckTransaction();
                new MaterialSubTypeDataService(Transaction).Remove(materialSubType);

                Revision blREv = new Revision(Transaction);
                blREv.RemoveAll(materialSubType.Revisions);

                if (IsOwner) Transaction.Commit();
            }
            catch (Exception exception1)
            {
                if (IsOwner) Transaction.Rollback();
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            finally
            {
                if (IsOwner) Connection.Close();
            }
        }
Example #3
0
        public void Remove(MaterialCategoryObject materialCategory)
        {
            try
            {
                CheckTransaction();
                foreach (MaterialTypeObject type in materialCategory.Types)
                {
                    foreach (MaterialSubTypeObject subType in type.SubTypes)
                    {
                        new MaterialSubType(Transaction).Remove(subType);
                    }
                    new MaterialType(Transaction).Remove(type);
                }
                Revision blREv = new Revision(Transaction);
                blREv.RemoveAll(materialCategory.Revisions);

                new MaterialCategoryDataService(Transaction).Remove(materialCategory);
                if (IsOwner) Transaction.Commit();
            }
            catch (Exception exception1)
            {
                if (IsOwner) Transaction.Rollback();
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            finally
            {
                if (IsOwner) Connection.Close();
            }
        }