You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.6 KiB

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 BatchNumberInfoBL
{
public static bool Insert(BatchNumberInfo info)
{
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "BatchNumber_ID", "Routing_ID", "ProductShift_ID", "ProductLink", "OutGoods_ID", "OutGoodsNum" },
new string[] { info.BatchNumber_ID == null ? "null" : info.BatchNumber_ID.ToString(), info.Routing_ID == null ? "null" : info.Routing_ID.ToString(), info.ProductShift_ID == null ? "null":info.ProductShift_ID.ToString(), info.ProductLink,info.OutGoods_ID == null?"null":info.OutGoods_ID.ToString(),info.OutGoodsNum == null?"null":info.OutGoodsNum.ToString() });
return ExcuteSql(insertSql);
}
private static bool ExcuteSql(string sql)
{
bool success;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
she.ExecuteNonQuery(sql, out success);
if (!success)
she.Rollback();
else
she.Commit();
}
return success;
}
public static void Delete(BatchNumberInfo info)
{
var sql2 = SqlUtil.GetDeleteSql(TableNames., string.Format("where BatchNumber_ID={0} and Routing_ID={1} and ProductShift_ID={2} and ProductLink='{3}'", info.BatchNumber_ID.ToString(),info.Routing_ID.ToString(),info.ProductShift_ID.ToString(),info.ProductLink));
ExcuteSql(sql2);
}
}
}