public static bool Delete(String countryCode)
        {
            UpsOrigin upsOrigin = new UpsOrigin();

            if (upsOrigin.Load(countryCode))
            {
                return(upsOrigin.Delete());
            }
            return(false);
        }
        public static UpsOrigin Load(String countryCode)
        {
            UpsOrigin upsOrigin = new UpsOrigin();

            if (upsOrigin.Load(countryCode))
            {
                return(upsOrigin);
            }
            return(null);
        }
示例#3
0
 /// <summary>
 /// Loads the given UpsOrigin object from the given database data reader.
 /// </summary>
 /// <param name="upsOrigin">The UpsOrigin object to load.</param>
 /// <param name="dr">The database data reader to read data from.</param>
 public static void LoadDataReader(UpsOrigin upsOrigin, IDataReader dr)
 {
     //SET FIELDS FROM ROW DATA
     upsOrigin.CountryCode     = dr.GetString(0);
     upsOrigin.CountryName     = NullableData.GetString(dr, 1);
     upsOrigin.CurrencyName    = NullableData.GetString(dr, 2);
     upsOrigin.CurrencyCode    = NullableData.GetString(dr, 3);
     upsOrigin.EuroAllowed     = NullableData.GetInt16(dr, 4);
     upsOrigin.MIVDollar       = NullableData.GetDecimal(dr, 5);
     upsOrigin.MIVEuro         = NullableData.GetDecimal(dr, 6);
     upsOrigin.UOM             = NullableData.GetInt16(dr, 7);
     upsOrigin.MaxWeight       = NullableData.GetDecimal(dr, 8);
     upsOrigin.MaxMetricWeight = NullableData.GetDecimal(dr, 9);
     upsOrigin.EUMember        = NullableData.GetInt16(dr, 10);
     upsOrigin.IsDirty         = false;
 }
        public static UpsOriginCollection  LoadForCriteria(string sqlCriteria, int maximumRows, int startRowIndex, string sortExpression)
        {
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT");
            if (maximumRows > 0)
            {
                selectQuery.Append(" TOP " + (startRowIndex + maximumRows).ToString());
            }
            selectQuery.Append(" " + UpsOrigin.GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_UpsOrigin");
            string whereClause = string.IsNullOrEmpty(sqlCriteria) ? string.Empty : " WHERE " + sqlCriteria;

            selectQuery.Append(whereClause);
            if (!string.IsNullOrEmpty(sortExpression))
            {
                selectQuery.Append(" ORDER BY " + sortExpression);
            }
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());
            //EXECUTE THE COMMAND
            UpsOriginCollection results = new UpsOriginCollection();
            int thisIndex = 0;
            int rowCount  = 0;

            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows)))
                {
                    if (thisIndex >= startRowIndex)
                    {
                        UpsOrigin upsOrigin = new UpsOrigin();
                        UpsOrigin.LoadDataReader(upsOrigin, dr);
                        results.Add(upsOrigin);
                        rowCount++;
                    }
                    thisIndex++;
                }
                dr.Close();
            }
            return(results);
        }
 public static SaveResult Insert(UpsOrigin upsOrigin)
 {
     return(upsOrigin.Save());
 }
 public static bool Delete(UpsOrigin upsOrigin)
 {
     return(upsOrigin.Delete());
 }
 public static SaveResult Update(UpsOrigin upsOrigin)
 {
     return(upsOrigin.Save());
 }