public int Update(SOWeightInfo oParam) { string sql = @"UPDATE SO_Weight SET SOSysNo=@SOSysNo, Weight=@Weight, ShipPriceCustomer=@ShipPriceCustomer, ShipPriceVendor=@ShipPriceVendor, CreateUserSysNo=@CreateUserSysNo, CreateTime=@CreateTime, Status=@Status WHERE SysNo=@SysNo"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4); SqlParameter paramWeight = new SqlParameter("@Weight", SqlDbType.Decimal, 9); SqlParameter paramShipPriceCustomer = new SqlParameter("@ShipPriceCustomer", SqlDbType.Decimal, 9); SqlParameter paramShipPriceVendor = new SqlParameter("@ShipPriceVendor", SqlDbType.Decimal, 9); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); 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.SOSysNo != AppConst.IntNull) paramSOSysNo.Value = oParam.SOSysNo; else paramSOSysNo.Value = System.DBNull.Value; if (oParam.Weight != AppConst.DecimalNull) paramWeight.Value = oParam.Weight; else paramWeight.Value = System.DBNull.Value; if (oParam.ShipPriceCustomer != AppConst.DecimalNull) paramShipPriceCustomer.Value = oParam.ShipPriceCustomer; else paramShipPriceCustomer.Value = System.DBNull.Value; if (oParam.ShipPriceVendor != AppConst.DecimalNull) paramShipPriceVendor.Value = oParam.ShipPriceVendor; else paramShipPriceVendor.Value = System.DBNull.Value; if (oParam.CreateUserSysNo != AppConst.IntNull) paramCreateUserSysNo.Value = oParam.CreateUserSysNo; else paramCreateUserSysNo.Value = System.DBNull.Value; if (oParam.CreateTime != AppConst.DateTimeNull) paramCreateTime.Value = oParam.CreateTime; else paramCreateTime.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(paramSOSysNo); cmd.Parameters.Add(paramWeight); cmd.Parameters.Add(paramShipPriceCustomer); cmd.Parameters.Add(paramShipPriceVendor); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramStatus); return SqlHelper.ExecuteNonQuery(cmd); }
private void map(SOWeightInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]); oParam.Weight = Util.TrimDecimalNull(tempdr["Weight"]); oParam.ShipPriceCustomer = Util.TrimDecimalNull(tempdr["ShipPriceCustomer"]); oParam.ShipPriceVendor = Util.TrimDecimalNull(tempdr["ShipPriceVendor"]); oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); }
public int Insert(SOWeightInfo oParam) { string sql = @"INSERT INTO SO_Weight ( SOSysNo, Weight, ShipPriceCustomer, ShipPriceVendor, CreateUserSysNo, CreateTime, Status ) VALUES ( @SOSysNo, @Weight, @ShipPriceCustomer, @ShipPriceVendor, @CreateUserSysNo, @CreateTime, @Status );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4); SqlParameter paramWeight = new SqlParameter("@Weight", SqlDbType.Decimal, 9); SqlParameter paramShipPriceCustomer = new SqlParameter("@ShipPriceCustomer", SqlDbType.Decimal, 9); SqlParameter paramShipPriceVendor = new SqlParameter("@ShipPriceVendor", SqlDbType.Decimal, 9); SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.SOSysNo != AppConst.IntNull) paramSOSysNo.Value = oParam.SOSysNo; else paramSOSysNo.Value = System.DBNull.Value; if (oParam.Weight != AppConst.DecimalNull) paramWeight.Value = oParam.Weight; else paramWeight.Value = System.DBNull.Value; if (oParam.ShipPriceCustomer != AppConst.DecimalNull) paramShipPriceCustomer.Value = oParam.ShipPriceCustomer; else paramShipPriceCustomer.Value = System.DBNull.Value; if (oParam.ShipPriceVendor != AppConst.DecimalNull) paramShipPriceVendor.Value = oParam.ShipPriceVendor; else paramShipPriceVendor.Value = System.DBNull.Value; if (oParam.CreateUserSysNo != AppConst.IntNull) paramCreateUserSysNo.Value = oParam.CreateUserSysNo; else paramCreateUserSysNo.Value = System.DBNull.Value; if (oParam.CreateTime != AppConst.DateTimeNull) paramCreateTime.Value = oParam.CreateTime; else paramCreateTime.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(paramSOSysNo); cmd.Parameters.Add(paramWeight); cmd.Parameters.Add(paramShipPriceCustomer); cmd.Parameters.Add(paramShipPriceVendor); cmd.Parameters.Add(paramCreateUserSysNo); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramStatus); return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo); }
public SOWeightInfo LoadSOWeight(int SOSysNo) { string sql = "select * from so_weight where sosysno=" + SOSysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { SOWeightInfo oInfo = new SOWeightInfo(); map(oInfo, ds.Tables[0].Rows[0]); return oInfo; } else return null; }