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.

63 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Data;
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 UnfinishedBatchBL
{
private static bool Insert(UnfinishedBatch batch)
{
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "ProductBatch", "LegType" },
new string[] { batch.ProductBatch, batch.LegType.ToString()});
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(string batch)
{
var sql = SqlUtil.GetDeleteSql(TableNames., "where ProductBatch=" + batch);
using (var she = new SqlHelperEx()) {
bool success;
she.CreateTransaction();
she.ExecuteNonQuery(sql, out success);
if (!success)
she.Rollback();
else
she.Commit();
}
}
public static List<UnfinishedBatch> GetUnfinishedBatchs()
{
var sql = "select ProductBatch,LegType from {0}".FormatWith(TableNames.);
var table = SqlHelperEx.DoQuery(sql);
if (table.Rows.Count == 0)
return null;
var batchs = new List<UnfinishedBatch>();
foreach(DataRow row in table.Rows) {
var batch = new UnfinishedBatch();
batch.ProductBatch = (string)row[0];
batch.LegType = row[0].ToString() == "前腿" ? LegType. : LegType.;
batchs.Add(batch);
}
return batchs;
}
}
}