Exemplo n.º 1
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();
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        public MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialCategoryObject materialCategory)
        {
            try
            {
                InitializeComponent();

                MaterialCategoryMember = materialCategory;
                _typeForm = typeForm;
                if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    Initialize();
                    InitializePropertyFormMaterialCategory();
                    SetPermissions();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 public int Add(MaterialCategoryObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaterialCategoryObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by MaterialCategoryObject when it changes
 internal void MaterialCategoryObjectChanged(MaterialCategoryObject MaterialCategory)
 {
     try
     {
         int index = List.IndexOf(MaterialCategory);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         MaterialCategoryObject MaterialCategory = (MaterialCategoryObject)value;
         MaterialCategory.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialCategoryObject MaterialCategory = new MaterialCategoryObject();
         List.Add(MaterialCategory);
         return(MaterialCategory);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 9
0
 public RevisionObjectCollection GetByMaterialCategory(MaterialCategoryObject materialCategory)
 {
     RevisionObjectCollection revisions;
     try
     {
         revisions = new RevisionDataService().GetByMaterialCateogry(materialCategory);
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return revisions;
 }
Exemplo n.º 10
0
 public RevisionObjectCollection GetByMaterialCateogry(MaterialCategoryObject materialCategory)
 {
     RevisionObjectCollection revisions = new RevisionObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(RevisionObject.MATCAT_ID, materialCategory.MatcatID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + RevisionObject.MATCAT_ID + " is not null ");
         revisions = RevisionConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return revisions;
 }
Exemplo n.º 11
0
 public MaterialTypeObjectCollection GetTypesByCategorie(MaterialCategoryObject category)
 {
     MaterialTypeObjectCollection materialTypes = new MaterialTypeObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(MaterialTypeObject.MATCAT_ID, category.MatcatID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + MaterialTypeObject.MATCAT_ID + " is not null ");
         builder.AppendOrderBy(MaterialTypeObject.TYPE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
         materialTypes = MaterialTypeConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return materialTypes;
 }
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    MaterialCategoryObject oldMaterialCategory = (MaterialCategoryObject)oldValue;
                    MaterialCategoryObject newMaterialCategory = (MaterialCategoryObject)newValue;
                    oldMaterialCategory.Parent = null;
                    newMaterialCategory.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Exemplo n.º 13
0
 public static MaterialCategoryObject MaterialCategoryRowToObject(DataRow MaterialCategory, string alias)
 {
     MaterialCategoryObject obj = new MaterialCategoryObject();
     try
     {
         if (MaterialCategory != null)
         {
             if (RowFunctions.GetValueFromRowToGuid(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.MATCAT_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
             {
                 obj.MatcatID = RowFunctions.GetValueFromRowToGuid(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.MATCAT_ID, alias), true, DataRowVersion.Current);
                 obj.Category = RowFunctions.GetValueFromRowToString(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.CATEGORY, alias), false, DataRowVersion.Current);
             }
             return obj;
         }
         obj = null;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return obj;
 }
Exemplo n.º 14
0
        public static MaterialCategoryObject MaterialCategoryRowToObject(DataRow MaterialCategory, string alias)
        {
            MaterialCategoryObject obj = new MaterialCategoryObject();

            try
            {
                if (MaterialCategory != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.MATCAT_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatcatID = RowFunctions.GetValueFromRowToGuid(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.MATCAT_ID, alias), true, DataRowVersion.Current);
                        obj.Category = RowFunctions.GetValueFromRowToString(MaterialCategory, MaterialCategoryObject.ConvertColumnToAlias(MaterialCategoryObject.CATEGORY, alias), false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
 public bool Remove(MaterialCategoryObject materialCategory)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialCategory_DELETE",
             CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, materialCategory.MatcatID, ParameterDirection.Input)
             );
         return true;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
 public int Add(MaterialCategoryObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialCategoryObject MaterialCategory = new MaterialCategoryObject();
         List.Add(MaterialCategory);
         return MaterialCategory;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaterialCategoryObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by MaterialCategoryObject when it changes
 internal void MaterialCategoryObjectChanged(MaterialCategoryObject MaterialCategory)
 {
     try
     {
         int index = List.IndexOf(MaterialCategory);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Save(MaterialCategoryObject materialCategory)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialCategory_SAVE",
             CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, materialCategory.MatcatID, ParameterDirection.InputOutput),
             CreateParameter("@Category", SqlDbType.VarChar, materialCategory.Category)
             );
         materialCategory.MatcatID = (Guid)cmd.Parameters["@matcatID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Exemplo n.º 21
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedMaterialCategory = MaterialCategory;
             _loadedType = Type;
             //Child members
             _loadedSubTypes = SubTypes;
             _loadedRevisions = Revisions;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 22
0
 public void Save(MaterialCategoryObject materialCategory)
 {
     try
     {
         CheckTransaction();
         new MaterialCategoryDataService(Transaction).Save(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();
     }
 }
Exemplo n.º 23
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedMaterialCategory = MaterialCategory;
             _loadedMaterialType = MaterialType;
             _loadedMaterialSubType = MaterialSubType;
             _loadedEmployeeCreator = EmployeeCreator;
             _loadedEmployeeResponsable = EmployeeResponsable;
             _loadedVehicle = Vehicle;
             _loadedSupplier = Supplier;
             _loadedName = Name;
             _loadedDescription = Description;
             _loadedType = Type;
             _loadedSerieNumber = SerieNumber;
             _loadedInternalNumber = InternalNumber;
             _loadedPurchasedOn = PurchasedOn;
             _loadedPrice = Price;
             _loadedNextMaintenance = NextMaintenance;
             _loadedMaintenanceFrequency = MaintenanceFrequency;
             _loadedActive = Active;
             _loadedBroken = Broken;
             //Child members
             _loadedMemos = Memos;
             _loadedMaintenances = Maintenances;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }