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.
80 lines
2.7 KiB
80 lines
2.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSITEMROUTE2OPDAL
|
|
{
|
|
#region 删除
|
|
public static void deleteInfo(List<string> codeList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.ICSITEMROUTE2OP.Where(a => codeList.Contains(a.OPCODE));
|
|
db.ICSITEMROUTE2OP.DeleteAllOnSubmit(lines);
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
#region 新增和修改
|
|
|
|
public static void Add(List<FormICSITEMROUTE2OPUIModel> InfoList, string dsconn)
|
|
{
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (FormICSITEMROUTE2OPUIModel info in InfoList)
|
|
{
|
|
//bool isNew = false;
|
|
//var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.OPCODE == tbinfo.OPCODE);
|
|
//if (line == null)
|
|
//{
|
|
// isNew = true;
|
|
// line = new ICSOP();
|
|
// line.ID = AppConfig.GetGuid();
|
|
// line.OPCODE = tbinfo.OPCODE;
|
|
|
|
//}
|
|
var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.ITEMCODE == info.ITEMCODE && a.ROUTECODE == info.ROUTECODE && a.OPCODE == info.OPCODE);
|
|
line.OPCONTROL = info.ro.OPCONTROL;
|
|
line.OPTIONALOP = info.OPTIONALOP;
|
|
line.IDMERGETYPE = info.IDMERGETYPE;
|
|
line.IDMERGERULE = Convert.ToInt32(info.IDMERGERULE);
|
|
|
|
line.MUSER = AppConfig.UserId;
|
|
line.MUSERName = AppConfig.UserName;
|
|
line.MTIME = DateTime.Now;
|
|
line.WorkPoint = AppConfig.WorkPointCode;
|
|
//if (isNew)
|
|
// db.ICSOP.InsertOnSubmit(line);
|
|
db.SubmitChanges();
|
|
|
|
}
|
|
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|