public static MaterialRevisionObject MaterialRevisionRowToObject(DataRow MaterialRevision)
 {
     MaterialRevisionObject obj = new MaterialRevisionObject();
     try
     {
         if (MaterialRevision != null)
         {
             if (RowFunctions.GetValueFromRowToGuid(MaterialRevision, MaterialRevisionObject.MATREV_ID, false, DataRowVersion.Current) != Guid.Empty)
             {
                 obj.MatRevID = RowFunctions.GetValueFromRowToGuid(MaterialRevision, MaterialRevisionObject.MATREV_ID, true, DataRowVersion.Current);
                 obj.Maintenance = MaintenanceConvertor.MaintenanceRowToObject(MaterialRevision);
                 obj.Revision = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.REVISION, false, DataRowVersion.Current);
                 obj.Answer = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.ANSWER, false, DataRowVersion.Current);
                 obj.Category = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.CATEGORY, false, DataRowVersion.Current);
             }
             return obj;
         }
         obj = null;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return obj;
 }
        public static MaterialRevisionObject MaterialRevisionRowToObject(DataRow MaterialRevision)
        {
            MaterialRevisionObject obj = new MaterialRevisionObject();

            try
            {
                if (MaterialRevision != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialRevision, MaterialRevisionObject.MATREV_ID, false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatRevID    = RowFunctions.GetValueFromRowToGuid(MaterialRevision, MaterialRevisionObject.MATREV_ID, true, DataRowVersion.Current);
                        obj.Maintenance = MaintenanceConvertor.MaintenanceRowToObject(MaterialRevision);
                        obj.Revision    = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.REVISION, false, DataRowVersion.Current);
                        obj.Answer      = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.ANSWER, false, DataRowVersion.Current);
                        obj.Category    = RowFunctions.GetValueFromRowToString(MaterialRevision, MaterialRevisionObject.CATEGORY, false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Exemple #3
0
 public int Add(MaterialRevisionObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemple #4
0
 public void Remove(MaterialRevisionObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemple #5
0
 // Called by MaterialRevisionObject when it changes
 internal void MaterialRevisionObjectChanged(MaterialRevisionObject MaterialRevision)
 {
     try
     {
         int index = List.IndexOf(MaterialRevision);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemple #6
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialRevisionObject MaterialRevision = new MaterialRevisionObject();
         List.Add(MaterialRevision);
         return(MaterialRevision);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemple #7
0
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         MaterialRevisionObject MaterialRevision = (MaterialRevisionObject)value;
         MaterialRevision.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaterialRevisionObject materialRevision)
 {
     try
     {
         CheckTransaction();
         new MaterialRevisionDataService(Transaction).Remove(materialRevision);
         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();
     }
 }
Exemple #9
0
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    MaterialRevisionObject oldMaterialRevision = (MaterialRevisionObject)oldValue;
                    MaterialRevisionObject newMaterialRevision = (MaterialRevisionObject)newValue;
                    oldMaterialRevision.Parent = null;
                    newMaterialRevision.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 public bool Remove(MaterialRevisionObject materialRevision)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialRevision_DELETE",
             CreateParameter("@matrevID", SqlDbType.UniqueIdentifier, materialRevision.MatRevID, 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(MaterialRevisionObject materialRevision)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialRevision_SAVE",
             CreateParameter("@matrevID", SqlDbType.UniqueIdentifier, materialRevision.MatRevID, ParameterDirection.InputOutput),
             CreateParameter("@maintID", SqlDbType.UniqueIdentifier, materialRevision.Maintenance == null ? Guid.Empty : materialRevision.Maintenance.MaintID),
             CreateParameter("@Revision", SqlDbType.VarChar, materialRevision.Revision),
             CreateParameter("@Answer", SqlDbType.VarChar, materialRevision.Answer),
             CreateParameter("@Category", SqlDbType.VarChar, materialRevision.Category)
             );
         materialRevision.MatRevID = (Guid)cmd.Parameters["@matrevID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Exemple #12
0
        public void CreateNewMaterialRevisions()
        {
            try
            {
                MaterialRevisionObjectCollection materialRevisions = new MaterialRevisionObjectCollection();
                RevisionObjectCollection revisions;
                if (Material.MaterialCategory != null)
                {
                    revisions = new BL.Internal.Revision().GetByMaterialCategory(Material.MaterialCategory);
                    foreach (RevisionObject revision in revisions)
                    {
                        MaterialRevisionObject materialRevision = new MaterialRevisionObject();
                        materialRevision.Revision = revision.Revision;
                        materialRevision.Maintenance = MaintenanceMember;
                        materialRevision.Category = revision.MaterialCategory.Category;
                        materialRevision.State = PROF_IT.Common.Enumerations.ObjectState.Created;
                        materialRevisions.Add(materialRevision);
                    }
                }
                if (Material.MaterialType != null)
                {
                    revisions = new BL.Internal.Revision().GetByMaterialType(Material.MaterialType);
                    foreach (RevisionObject revision in revisions)
                    {
                        MaterialRevisionObject materialRevision = new MaterialRevisionObject();
                        materialRevision.Revision = revision.Revision;
                        materialRevision.Maintenance = MaintenanceMember;
                        materialRevision.Category = revision.MaterialType.Type;
                        materialRevision.State = PROF_IT.Common.Enumerations.ObjectState.Created;
                        materialRevisions.Add(materialRevision);
                    }
                }
                if (Material.MaterialSubType != null)
                {
                    revisions = new BL.Internal.Revision().GetByMaterialSubType(Material.MaterialSubType);
                    foreach (RevisionObject revision in revisions)
                    {
                        MaterialRevisionObject materialRevision = new MaterialRevisionObject();
                        materialRevision.Revision = revision.Revision;
                        materialRevision.Maintenance = MaintenanceMember;
                        materialRevision.Category = revision.MaterialSubType.SubType;
                        materialRevision.State = PROF_IT.Common.Enumerations.ObjectState.Created;
                        materialRevisions.Add(materialRevision);
                    }
                }

                MaterialRevisions = materialRevisions;
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 // Called by MaterialRevisionObject when it changes
 internal void MaterialRevisionObjectChanged(MaterialRevisionObject MaterialRevision)
 {
     try
     {
         int index = List.IndexOf(MaterialRevision);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaterialRevisionObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialRevisionObject MaterialRevision = new MaterialRevisionObject();
         List.Add(MaterialRevision);
         return MaterialRevision;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(MaterialRevisionObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }