private void mapSlnItemC3(SlnItemC3Info oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.SlnItemSysNo = Util.TrimIntNull(tempdr["SlnItemSysNo"]); oParam.C3SysNo = Util.TrimIntNull(tempdr["C3SysNo"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); }
public void UpdateSlnItemC3(SlnItemC3Info oParam) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { new SlnDac().Update(oParam); scope.Complete(); } }
public SlnItemC3Info LoadSlnItemC3(int SysNo) { string sql = "select * from sln_item_c3 where sysno=" + SysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); SlnItemC3Info oParam = new SlnItemC3Info(); if (Util.HasMoreRow(ds)) mapSlnItemC3(oParam, ds.Tables[0].Rows[0]); else oParam = null; return oParam; }
public int InsertSlnItemC3(SlnItemC3Info oParam) { string sql = "select * from sln_item_c3 where slnitemsysno = " + oParam.SlnItemSysNo + " and c3sysno = " + oParam.C3SysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) throw new BizException("the same c3 exists already"); return new SlnDac().Insert(oParam); }
public int Update(SlnItemC3Info oParam) { string sql = @"UPDATE sln_item_c3 SET SlnItemSysNo=@SlnItemSysNo, C3SysNo=@C3SysNo, Status=@Status WHERE SysNo=@SysNo"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramSlnItemSysNo = new SqlParameter("@SlnItemSysNo", SqlDbType.Int, 4); SqlParameter paramC3SysNo = new SqlParameter("@C3SysNo", SqlDbType.Int, 4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); if (oParam.SysNo != AppConst.IntNull) paramSysNo.Value = oParam.SysNo; else paramSysNo.Value = System.DBNull.Value; if (oParam.SlnItemSysNo != AppConst.IntNull) paramSlnItemSysNo.Value = oParam.SlnItemSysNo; else paramSlnItemSysNo.Value = System.DBNull.Value; if (oParam.C3SysNo != AppConst.IntNull) paramC3SysNo.Value = oParam.C3SysNo; else paramC3SysNo.Value = System.DBNull.Value; if (oParam.Status != AppConst.IntNull) paramStatus.Value = oParam.Status; else paramStatus.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramSlnItemSysNo); cmd.Parameters.Add(paramC3SysNo); cmd.Parameters.Add(paramStatus); return SqlHelper.ExecuteNonQuery(cmd); }
public int Insert(SlnItemC3Info oParam) { string sql = @"INSERT INTO sln_item_c3 ( SlnItemSysNo, C3SysNo, Status ) VALUES ( @SlnItemSysNo, @C3SysNo, @Status );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramSlnItemSysNo = new SqlParameter("@SlnItemSysNo", SqlDbType.Int, 4); SqlParameter paramC3SysNo = new SqlParameter("@C3SysNo", SqlDbType.Int, 4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.SlnItemSysNo != AppConst.IntNull) paramSlnItemSysNo.Value = oParam.SlnItemSysNo; else paramSlnItemSysNo.Value = System.DBNull.Value; if (oParam.C3SysNo != AppConst.IntNull) paramC3SysNo.Value = oParam.C3SysNo; else paramC3SysNo.Value = System.DBNull.Value; if (oParam.Status != AppConst.IntNull) paramStatus.Value = oParam.Status; else paramStatus.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramSlnItemSysNo); cmd.Parameters.Add(paramC3SysNo); cmd.Parameters.Add(paramStatus); return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo); }