public static MaintenanceVehicleObjectCollection DataTableToCollection(DataTable MaintenanceVehicles)
 {
     MaintenanceVehicleObjectCollection objectsTotal;
     MaintenanceVehicleObjectCollection objects = new MaintenanceVehicleObjectCollection();
     try
     {
         IEnumerator enumerator = null;
         try
         {
             enumerator = MaintenanceVehicles.Rows.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 DataRow current = (DataRow)enumerator.Current;
                 objects.Add(MaintenanceVehicleRowToObject(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;
 }
Esempio n. 2
0
        public static MaintenanceVehicleObjectCollection DataTableToCollection(DataTable MaintenanceVehicles)
        {
            MaintenanceVehicleObjectCollection objectsTotal;
            MaintenanceVehicleObjectCollection objects = new MaintenanceVehicleObjectCollection();

            try
            {
                IEnumerator enumerator = null;
                try
                {
                    enumerator = MaintenanceVehicles.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataRow current = (DataRow)enumerator.Current;
                        objects.Add(MaintenanceVehicleRowToObject(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);
        }
Esempio n. 3
0
 public void RemoveAll(MaintenanceVehicleObjectCollection maintenanceVehicles)
 {
     try
     {
         foreach (MaintenanceVehicleObject maintenanceVehicle in maintenanceVehicles)
         {
             Remove(maintenanceVehicle);
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public MaintenanceVehicleObjectCollection GetAll()
 {
     MaintenanceVehicleObjectCollection maintenanceVehicles = new MaintenanceVehicleObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendOrderBy(MaintenanceVehicleObject.START_MAINTENANCE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
         maintenanceVehicles = MaintenanceVehicleConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return maintenanceVehicles;
 }
 public MaintenanceVehicleObjectCollection GetByVehicleID(VehicleObject vehicle)
 {
     MaintenanceVehicleObjectCollection maintenanceVehicles = new MaintenanceVehicleObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(MaintenanceVehicleObject.VEH_ID, vehicle.VehID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + MaintenanceVehicleObject.VEH_ID + " is not null ");
         maintenanceVehicles = MaintenanceVehicleConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return maintenanceVehicles;
 }
Esempio n. 6
0
        public void Save(MaintenanceVehicleObjectCollection maintenanceVehicles)
        {
            try
            {
                foreach (MaintenanceVehicleObject maintenanceVehicle in maintenanceVehicles)
                {
                    if (maintenanceVehicle.State == PROF_IT.Common.Enumerations.ObjectState.Deleted)
                        Remove(maintenanceVehicle);
                    if (maintenanceVehicle.State == PROF_IT.Common.Enumerations.ObjectState.Modified |
                            maintenanceVehicle.State == PROF_IT.Common.Enumerations.ObjectState.Created)
                        Save(maintenanceVehicle);
                }

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