Example #1
0
        public static VehicleTypeObject VehicleTypeRowToObject(DataRow VehicleType)
        {
            VehicleTypeObject obj = new VehicleTypeObject();

            try
            {
                if (VehicleType != null)
                {
                    if (RowFunctions.GetValueFromRowToInt64(VehicleType, VehicleTypeObject.VEHTID, false, DataRowVersion.Current) != Constants.NullInt)
                    {
                        obj.VehtID             = RowFunctions.GetValueFromRowToInteger(VehicleType, VehicleTypeObject.VEHTID, true, DataRowVersion.Current);
                        obj.Transc_VehicleType = RowFunctions.GetValueFromRowToInteger(VehicleType, VehicleTypeObject.TRANSC_VEHICLETYPE, false, DataRowVersion.Current);
                        obj.Type = RowFunctions.GetValueFromRowToString(VehicleType, VehicleTypeObject.TYPE, false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Example #2
0
 public void Remove(VehicleTypeObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #3
0
 public int Add(VehicleTypeObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #4
0
 // Called by VehicleTypeObject when it changes
 internal void VehicleTypeObjectChanged(VehicleTypeObject VehicleType)
 {
     try
     {
         int index = List.IndexOf(VehicleType);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #5
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         VehicleTypeObject VehicleType = new VehicleTypeObject();
         List.Add(VehicleType);
         return(VehicleType);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #6
0
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         VehicleTypeObject VehicleType = (VehicleTypeObject)value;
         VehicleType.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Example #7
0
 public void Save(VehicleTypeObject vehicleType)
 {
     try
     {
         CheckTransaction();
         new VehicleTypeDataService(Transaction).Save(vehicleType);
         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();
     }
 }
Example #8
0
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    VehicleTypeObject oldVehicleType = (VehicleTypeObject)oldValue;
                    VehicleTypeObject newVehicleType = (VehicleTypeObject)newValue;
                    oldVehicleType.Parent = null;
                    newVehicleType.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(VehicleTypeObject vehicleType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "VehicleType_DELETE",
             CreateParameter("@vehtID", SqlDbType.Int, vehicleType.VehtID, 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;
     }
 }
 // Called by VehicleTypeObject when it changes
 internal void VehicleTypeObjectChanged(VehicleTypeObject VehicleType)
 {
     try
     {
         int index = List.IndexOf(VehicleType);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(VehicleTypeObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         VehicleTypeObject VehicleType = new VehicleTypeObject();
         List.Add(VehicleType);
         return VehicleType;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(VehicleTypeObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Save(VehicleTypeObject vehicleType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "VehicleType_SAVE",
             CreateParameter("@vehtID", SqlDbType.Int, vehicleType.VehtID, ParameterDirection.InputOutput),
             CreateParameter("@transc_VehicleType", SqlDbType.Int, vehicleType.Transc_VehicleType),
             CreateParameter("@Type", SqlDbType.VarChar, vehicleType.Type)
             );
         vehicleType.VehtID = (int)cmd.Parameters["@vehtID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }