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.
|
|
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 ICSLOTONWIPCheckDetailDAL { public static void Add(List<ICSLOTONWIPCheckDetail> list, string conn) { FramDataContext db = new FramDataContext(conn); db.Connection.Open(); db.Transaction = db.Connection.BeginTransaction(); try { string StrMaxFlow = ""; int maxFlow = 0; var x = db.ICSLOTONWIPCheckDetail.Where(a => a.FORTRANID == list[0].FORTRANID); if (x.Count() != 0) { StrMaxFlow = x.Max(a => a.EATTRIBUTE2); } if (!Int32.TryParse(StrMaxFlow, out maxFlow)) { maxFlow = 0; } maxFlow++; list.ForEach(a => { a.EATTRIBUTE2 = maxFlow.ToString(); db.ICSLOTONWIPCheckDetail.InsertOnSubmit(a); db.SubmitChanges(); }); db.Transaction.Commit(); } catch (Exception ex) { db.Transaction.Rollback(); throw ex; } } } }
|