public MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialTypeObject materialType)
        {
            try
            {
                InitializeComponent();

                MaterialTypeMember = materialType;
                _typeForm = typeForm;
                if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    Initialize();
                    InitializePropertyFormMaterialType();
                    SetPermissions();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
        public static MaterialTypeObject MaterialTypeRowToObject(DataRow MaterialType, string alias)
        {
            MaterialTypeObject obj = new MaterialTypeObject();

            try
            {
                if (MaterialType != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.MATTYP_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatTypID         = RowFunctions.GetValueFromRowToGuid(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.MATTYP_ID, alias), true, DataRowVersion.Current);
                        obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(MaterialType, alias);
                        obj.Type             = RowFunctions.GetValueFromRowToString(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.TYPE, alias), false, DataRowVersion.Current);
                        return(obj);
                    }
                    else
                    {
                        return(null);
                    }
                }
                return(null);
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
        public static MaterialTypeObject MaterialTypeRowToObject(DataRow MaterialType, string alias)
        {
            MaterialTypeObject obj = new MaterialTypeObject();
            try
            {
                if (MaterialType != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.MATTYP_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatTypID = RowFunctions.GetValueFromRowToGuid(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.MATTYP_ID, alias), true, DataRowVersion.Current);
                        obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(MaterialType, alias);
                        obj.Type = RowFunctions.GetValueFromRowToString(MaterialType, MaterialTypeObject.ConvertColumnToAlias(MaterialTypeObject.TYPE, alias), false, DataRowVersion.Current);
                        return obj;
                    }
                    else
                        return null;

                }
                return null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 public void Remove(MaterialTypeObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(MaterialTypeObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by MaterialTypeObject when it changes
 internal void MaterialTypeObjectChanged(MaterialTypeObject MaterialType)
 {
     try
     {
         int index = List.IndexOf(MaterialType);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialTypeObject MaterialType = new MaterialTypeObject();
         List.Add(MaterialType);
         return(MaterialType);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         MaterialTypeObject MaterialType = (MaterialTypeObject)value;
         MaterialType.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemple #9
0
 public RevisionObjectCollection GetByMaterialType(MaterialTypeObject materialType)
 {
     RevisionObjectCollection revisions;
     try
     {
         revisions = new RevisionDataService().GetByMaterialType(materialType);
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return revisions;
 }
Exemple #10
0
 public MaterialSubTypeObjectCollection GetSubTypesByType(MaterialTypeObject type)
 {
     MaterialSubTypeObjectCollection materialSubTypes;
     try
     {
         materialSubTypes = new MaterialSubTypeDataService().GetSubTypeByType(type);
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return materialSubTypes;
 }
 public MaterialSubTypeObjectCollection GetSubTypeByType(MaterialTypeObject type)
 {
     MaterialSubTypeObjectCollection materialSubTypes = new MaterialSubTypeObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(MaterialSubTypeObject.MATTYP_ID, type.MatTypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + MaterialSubTypeObject.MATTYP_ID + " is not null ");
         builder.AppendOrderBy(MaterialSubTypeObject.SUBTYPE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
         materialSubTypes = MaterialSubTypeConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return materialSubTypes;
 }
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    MaterialTypeObject oldMaterialType = (MaterialTypeObject)oldValue;
                    MaterialTypeObject newMaterialType = (MaterialTypeObject)newValue;
                    oldMaterialType.Parent = null;
                    newMaterialType.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 public RevisionObjectCollection GetByMaterialType(MaterialTypeObject materialType)
 {
     RevisionObjectCollection revisions = new RevisionObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(RevisionObject.MATTYP_ID, materialType.MatTypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + RevisionObject.MATTYP_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;
 }
Exemple #14
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);
     }
 }
 public bool Remove(MaterialTypeObject materialType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialType_DELETE",
             CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialType.MatTypID, 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 void Save(MaterialTypeObject materialType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialType_SAVE",
             CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialType.MatTypID, ParameterDirection.InputOutput),
             CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, materialType.MaterialCategory.MatcatID),
             CreateParameter("@Type", SqlDbType.VarChar, materialType.Type)
             );
         materialType.MatTypID = (Guid)cmd.Parameters["@mattypID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }