Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public void Remove(VehicleTypeObject vehicleType)
 {
     try
     {
         CheckTransaction();
         new VehicleTypeDataService(Transaction).Remove(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();
         }
     }
 }
Exemplo n.º 3
0
        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;
            }
        }