public static MaintenanceObjectCollection DataTableToCollection(DataTable Maintenances)
        {
            MaintenanceObjectCollection objectsTotal;
            MaintenanceObjectCollection objects = new MaintenanceObjectCollection();

            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = Maintenances.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow current = (DataRow)enumerator.Current;
                        objects.Add(MaintenanceRowToObject(current));
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                objectsTotal = objects;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(objectsTotal);
        }
 public static MaintenanceObjectCollection DataTableToCollection(DataTable Maintenances)
 {
     MaintenanceObjectCollection objectsTotal;
     MaintenanceObjectCollection objects = new MaintenanceObjectCollection();
     try
     {
         IEnumerator enumerator = null;
         try
         {
             enumerator = Maintenances.Rows.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 DataRow current = (DataRow)enumerator.Current;
                 objects.Add(MaintenanceRowToObject(current));
             }
         }
         finally
         {
             if (enumerator is IDisposable)
             {
                 (enumerator as IDisposable).Dispose();
             }
         }
         objectsTotal = objects;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return objectsTotal;
 }
示例#3
0
 public void RemoveAll(MaintenanceObjectCollection maintenances)
 {
     try
     {
         foreach (MaintenanceObject maintenance in maintenances)
         {
             Remove(maintenance);
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public MaintenanceObjectCollection GetAll()
 {
     MaintenanceObjectCollection maintenances = new MaintenanceObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendOrderBy(MaintenanceObject.START_MAINTENANCE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
         maintenances = MaintenanceConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return maintenances;
 }
示例#5
0
 public MaintenanceObjectCollection GetActive()
 {
     try
     {
         MaintenanceObjectCollection maintenances = new MaintenanceObjectCollection();
         foreach (MaintenanceObject maintenance in this)
         {
             if (maintenance.State != PROF_IT.Common.Enumerations.ObjectState.Deleted)
             {
                 maintenances.Add(maintenance);
             }
         }
         return(maintenances);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public MaintenanceObjectCollection GetMemosByMaintenanceID(MaterialObject material)
 {
     MaintenanceObjectCollection maintenances = new MaintenanceObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(MaintenanceObject.MAT_ID, material.MatID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + MaintenanceObject.MAT_ID + " is not null ");
         maintenances = MaintenanceConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return maintenances;
 }
 public MaintenanceObjectCollection GetActive()
 {
     try
     {
         MaintenanceObjectCollection maintenances = new MaintenanceObjectCollection();
         foreach (MaintenanceObject maintenance in this)
         {
             if (maintenance.State != PROF_IT.Common.Enumerations.ObjectState.Deleted)
                 maintenances.Add(maintenance);
         }
         return maintenances;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
示例#8
0
        public void Save(MaintenanceObjectCollection maintenances)
        {
            try
            {
                foreach (MaintenanceObject maintenance in maintenances)
                {
                    if (maintenance.State == PROF_IT.Common.Enumerations.ObjectState.Deleted)
                        Remove(maintenance);
                    if (maintenance.State == PROF_IT.Common.Enumerations.ObjectState.Modified |
                            maintenance.State == PROF_IT.Common.Enumerations.ObjectState.Created)
                        Save(maintenance);
                }

            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }