Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 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();
         }
     }
 }
Ejemplo n.º 4
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);
            }
        }