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.
155 lines
5.3 KiB
155 lines
5.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using System.Data;
|
|
using System.Data.Sql;
|
|
using System.Data.Linq;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSIQCTESTDATADal
|
|
{
|
|
#region AddandEdit
|
|
public static void AddandEdit(ICSIQCTESTDATA ItemLot, string Appconstr)
|
|
{
|
|
FramDataContext db = new FramDataContext(Appconstr);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
bool isNew = false;
|
|
var line = db.ICSIQCTESTDATA.SingleOrDefault(a => a.ID == ItemLot.ID);
|
|
|
|
if (line == null)
|
|
{
|
|
isNew = true;
|
|
line = new ICSIQCTESTDATA();
|
|
line.ID = AppConfig.GetGuid();
|
|
}
|
|
|
|
line.IQCNO = ItemLot.IQCNO;
|
|
line.STNO = ItemLot.STNO;
|
|
line.STLine = ItemLot.STLine;
|
|
line.CKGROUP = ItemLot.CKGROUP;
|
|
line.CKITEMCODE = ItemLot.CKITEMCODE;
|
|
line.IQCNO = ItemLot.IQCNO;
|
|
line.ITEMCODE = ItemLot.ITEMCODE;
|
|
line.LSL = ItemLot.LSL;
|
|
line.USL = ItemLot.USL;
|
|
line.TESTINGRESULT = ItemLot.TESTINGRESULT;
|
|
line.TESTINGRESULT = ItemLot.TESTINGRESULT;
|
|
line.MUSER = ItemLot.MUSER;
|
|
line.MUSERName = ItemLot.MUSERName;
|
|
line.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
line.WorkPoint = AppConfig.WorkPointCode;
|
|
|
|
if (isNew) db.ICSIQCTESTDATA.InsertOnSubmit(line);
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw new Exception(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region AddList
|
|
public static void AddIQCTestData(List<ICSIQCTESTDATA> ItemLotList, string Appconstr)
|
|
{
|
|
FramDataContext db = new FramDataContext(Appconstr);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
|
|
foreach (ICSIQCTESTDATA ItemLot in ItemLotList)
|
|
{
|
|
bool isNew = false;
|
|
var line = db.ICSIQCTESTDATA.SingleOrDefault(a => a.ID == ItemLot.ID);
|
|
if (line == null)
|
|
{
|
|
isNew = true;
|
|
line = new ICSIQCTESTDATA();
|
|
line.ID = AppConfig.GetGuid();
|
|
}
|
|
line.IQCNO = ItemLot.IQCNO;
|
|
line.STNO = ItemLot.STNO;
|
|
line.STLine = ItemLot.STLine;
|
|
line.CKGROUP = ItemLot.CKGROUP;
|
|
line.CKITEMCODE = ItemLot.CKITEMCODE;
|
|
line.IQCNO = ItemLot.IQCNO;
|
|
line.ITEMCODE = ItemLot.ITEMCODE;
|
|
line.LSL = ItemLot.LSL;
|
|
line.USL = ItemLot.USL;
|
|
line.TESTINGRESULT = ItemLot.TESTINGRESULT;
|
|
line.TESTINGVALUE = ItemLot.TESTINGVALUE;
|
|
line.MUSER = ItemLot.MUSER;
|
|
line.MUSERName = ItemLot.MUSERName;
|
|
line.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
line.WorkPoint = AppConfig.WorkPointCode;
|
|
|
|
if (isNew)
|
|
db.ICSIQCTESTDATA.InsertOnSubmit(line);
|
|
db.SubmitChanges();
|
|
}
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw new Exception(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
#region select
|
|
public static ICSIQCTESTDATA select(String guid, String Appconstr)
|
|
{
|
|
FramDataContext db = new FramDataContext(Appconstr);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
ICSIQCTESTDATA entity = new ICSIQCTESTDATA();
|
|
try
|
|
{
|
|
var line = db.ICSIQCTESTDATA.SingleOrDefault(a => a.ID == guid);
|
|
return (ICSIQCTESTDATA)line;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region delete
|
|
public static void delete(List<String> guidList,List<string> codeList)
|
|
{
|
|
FramDataContext db = new FramDataContext(AppConfig.AppConnectString);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.ICSIQCTESTDATA.Where(a => guidList.Contains(a.ID));
|
|
db.ICSIQCTESTDATA.DeleteAllOnSubmit(lines);
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
}
|