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.
91 lines
3.1 KiB
91 lines
3.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using System.Data;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSROUTE2OPDAL
|
|
{
|
|
public static void AddAndEdit(List<ICSROUTE2OP> mandayInfoList, string dsconn)
|
|
{
|
|
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
foreach (ICSROUTE2OP mandayInfo in mandayInfoList)
|
|
{
|
|
///jia pan duan
|
|
|
|
bool isNew = false;
|
|
var line = db.ICSROUTE2OP.SingleOrDefault(a => a.ROUTEID == mandayInfo.ROUTEID && a.OPID==mandayInfo.OPID);
|
|
if (line == null)
|
|
{
|
|
isNew = true;
|
|
line = new ICSROUTE2OP();
|
|
line.ROUTEID = mandayInfo.ROUTEID;
|
|
line.OPID = mandayInfo.OPID;
|
|
}
|
|
line.ROUTECODE = mandayInfo.ROUTECODE;
|
|
line.OPCODE = mandayInfo.OPCODE;
|
|
line.OPSEQ = mandayInfo.OPSEQ;
|
|
line.OPCONTROL = mandayInfo.OPCONTROL;
|
|
line.MUSER = mandayInfo.MUSER;
|
|
line.MUSERName = mandayInfo.MUSERName;
|
|
line.MTIME = mandayInfo.MTIME;
|
|
line.WORKPOINT = mandayInfo.WORKPOINT;
|
|
if (isNew)
|
|
db.ICSROUTE2OP.InsertOnSubmit(line);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public static DataTable SearchPersonInfoByCode(string routeid, string dsconn)
|
|
{
|
|
List<ICSROUTE2OP> returnperson = new List<ICSROUTE2OP>();
|
|
string sql = @"select OPSEQ,OPID
|
|
from ICSROUTE2OP
|
|
where ROUTEID='{0}' and WorkPoint='" + AppConfig.WorkPointCode + "'";
|
|
sql = string.Format(sql, routeid);
|
|
DataTable dt = DBHelper.ExecuteDataset(dsconn, CommandType.Text, sql).Tables[0];
|
|
return dt;
|
|
}
|
|
|
|
public static void deleteInfo(string dsconn, List<string> codeList)
|
|
{
|
|
|
|
FramDataContext db = new FramDataContext(dsconn);
|
|
db.Connection.Open();
|
|
db.Transaction = db.Connection.BeginTransaction();
|
|
try
|
|
{
|
|
var lines = db.ICSROUTE2OP.Where(a => codeList.Contains(a.ROUTEID) && codeList.Contains(a.OPID));
|
|
db.ICSROUTE2OP.DeleteAllOnSubmit(lines);
|
|
|
|
db.SubmitChanges();
|
|
db.Transaction.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
db.Transaction.Rollback();
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|