using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using FireBirdUtil.SqlUtils;
|
|
using WeighBusiness.BO;
|
|
using WeighBusiness.Utils;
|
|
using WeighBusiness.Utils.SqlUtils;
|
|
|
|
namespace WeighBusiness.BL
|
|
{
|
|
public static class CarBL
|
|
{
|
|
public static bool Save(Car car)
|
|
{
|
|
return Insert(car);
|
|
}
|
|
|
|
private static bool Insert(Car car)
|
|
{
|
|
string insertSql = InsertUtil.GetInsertSql(TableNames.车辆表,
|
|
new string[] { "Car_Number", "Car_Weight"},
|
|
new string[] { car.Car_Number, car.Car_Weight});
|
|
|
|
bool success;
|
|
using (var she = new SqlHelperEx()) {
|
|
she.CreateTransaction();
|
|
she.ExecuteNonQuery(insertSql, out success);
|
|
if (!success)
|
|
she.Rollback();
|
|
else
|
|
she.Commit();
|
|
}
|
|
return success;
|
|
}
|
|
|
|
public static void Delete(long ID)
|
|
{
|
|
var sql = SqlUtil.GetDeleteSql(TableNames.车辆表, "where ID=" + ID.ToString());
|
|
using (var she = new SqlHelperEx()) {
|
|
bool success;
|
|
she.CreateTransaction();
|
|
she.ExecuteNonQuery(sql, out success);
|
|
if (!success)
|
|
she.Rollback();
|
|
else
|
|
she.Commit();
|
|
}
|
|
}
|
|
|
|
public static IList<Car> LoadAll()
|
|
{
|
|
return LocalQueryUtil.GetLocalCars();
|
|
}
|
|
|
|
public static Car Load(string carNumber)
|
|
{
|
|
return LocalQueryUtil.GetLocalCar(carNumber);
|
|
}
|
|
}
|
|
}
|