public int Insert(DOInfo oParam) { string sql = @"INSERT INTO DO_master ( SOSysNo, DONo ) VALUES ( @SOSysNo, @DONo )"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4); SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int,4); SqlParameter paramDONo = new SqlParameter("@DONo", SqlDbType.NVarChar,50); if ( oParam.SysNo != AppConst.IntNull) paramSysNo.Value = oParam.SysNo; else paramSysNo.Value = System.DBNull.Value; if ( oParam.SOSysNo != AppConst.IntNull) paramSOSysNo.Value = oParam.SOSysNo; else paramSOSysNo.Value = System.DBNull.Value; if ( oParam.DONo != AppConst.StringNull) paramDONo.Value = oParam.DONo; else paramDONo.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramSOSysNo); cmd.Parameters.Add(paramDONo); return SqlHelper.ExecuteNonQuery(cmd); }
public void AddDO(DOInfo oInfo) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { new DODac().Insert(oInfo); scope.Complete(); } }
public int Update(DOInfo oParam) { string sql = @"UPDATE DO_master SET DONo=@DONo WHERE SysNo=@SysNo"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4); SqlParameter paramDONo = new SqlParameter("@DONo", SqlDbType.NVarChar,50); if ( oParam.SysNo != AppConst.IntNull) paramSysNo.Value = oParam.SysNo; else paramSysNo.Value = System.DBNull.Value; if ( oParam.DONo != AppConst.StringNull) paramDONo.Value = oParam.DONo; else paramDONo.Value = System.DBNull.Value; cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramDONo); return SqlHelper.ExecuteNonQuery(cmd); }
private void map(DOInfo oInfo,DataRow tempdr) { oInfo.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oInfo.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]); oInfo.DONo = Util.TrimNull(tempdr["DONo"]); oInfo.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); }
public DOInfo LoadDOBySO(int SOSysNo) { string sql = "select * from do_master where sosysno = @SOSysNo"; sql = sql.Replace("@SOSysNo",SOSysNo.ToString()); DataSet ds = SqlHelper.ExecuteDataSet(sql); if (!Util.HasMoreRow(ds)) return null; DataRow tempdr = ds.Tables[0].Rows[0]; DOInfo oInfo = new DOInfo(); this.map(oInfo, tempdr); return oInfo; }