/// <summary> /// 构造函数 /// </summary> /// <param name="connection">数据连接</param> public BProductCheckDetailBC(SqlConnection connection) { this.connection = connection; this.productCheckDetailBB = new BProductCheckDetailBB(this.connection); this.errorDiaryBB = new SErrorDiaryBB(this.connection); this.operatDiaryBB = new SOperatDiaryBB(this.connection); }
/// <summary> /// 构造函数 /// </summary> public BProductCheckDetailBC() { this.selfConn = true; this.connection = new SqlConnection(HS.Config.SqlDataObject.GetSqlConnectionString); this.connection.Open(); this.productCheckDetailBB = new BProductCheckDetailBB(this.connection); this.errorDiaryBB = new SErrorDiaryBB(this.connection); this.operatDiaryBB = new SOperatDiaryBB(this.connection); }
/// <summary> /// 批量导入"物料检验单明细"信息,更新数据库 /// </summary> /// <param name="keyValues">主键值数组</param> public bool SaveCheckDetailList(List<BProductCheckDetailData> list) { bool ret = false; SqlTransaction trans = null; BProductCheckDetailBB bProductCheckDetailBB = new BProductCheckDetailBB(this.connection); try { if (this.transaction == null) { trans = this.connection.BeginTransaction("TransDelete"); bProductCheckDetailBB.Transaction = trans; } else { bProductCheckDetailBB.Transaction = this.transaction; } foreach (BProductCheckDetailData data in list) { BProductCheckDetailData model = bProductCheckDetailBB.GetModel(data.id); model.checkGunId = data.checkGunId; model.checkGunIndex = data.checkGunIndex; model.checkDt = data.checkDt; model.Cr = data.Cr; model.CrAdd = data.CrAdd; model.Ni = data.Ni; model.NiAdd = data.NiAdd; model.Mo = data.Mo; model.MoAdd = data.MoAdd; model.Cu = data.Cu; model.CuAdd = data.CuAdd; model.Mn = data.Mn; model.MnAdd = data.MnAdd; model.Fe = data.Fe; model.FeAdd = data.FeAdd; model.Co = data.Co; model.CoAdd = data.CoAdd; model.Nb = data.Nb; model.NbAdd = data.NbAdd; model.Zr = data.Zr; model.ZrAdd = data.ZrAdd; model.Ti = data.Ti; model.TiAdd = data.TiAdd; bProductCheckDetailBB.ModifyRecord(model); } if (this.transaction == null) trans.Commit(); ret = true; } catch (Exception ex) { if (this.transaction == null) trans.Rollback("TransSave"); throw ex; } finally { bProductCheckDetailBB.Dispose(); } return ret; }