public static MaterialSubTypeObject MaterialSubTypeRowToObject(DataRow MaterialSubType, string alias)
        {
            MaterialSubTypeObject obj = new MaterialSubTypeObject();

            try
            {
                if (MaterialSubType != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.MATSTYP_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatStypID    = RowFunctions.GetValueFromRowToGuid(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.MATSTYP_ID, alias), true, DataRowVersion.Current);
                        obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(MaterialSubType, alias);
                        obj.SubType      = RowFunctions.GetValueFromRowToString(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.SUBTYPE, 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(MaterialSubTypeObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(MaterialSubTypeObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by MaterialSubTypeObject when it changes
 internal void MaterialSubTypeObjectChanged(MaterialSubTypeObject MaterialSubType)
 {
     try
     {
         int index = List.IndexOf(MaterialSubType);
         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
     {
         MaterialSubTypeObject MaterialSubType = new MaterialSubTypeObject();
         List.Add(MaterialSubType);
         return(MaterialSubType);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         MaterialSubTypeObject MaterialSubType = (MaterialSubTypeObject)value;
         MaterialSubType.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    MaterialSubTypeObject oldMaterialSubType = (MaterialSubTypeObject)oldValue;
                    MaterialSubTypeObject newMaterialSubType = (MaterialSubTypeObject)newValue;
                    oldMaterialSubType.Parent = null;
                    newMaterialSubType.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }