コード例 #1
0
ファイル: ProductCode.cs プロジェクト: paulusyeung/RT2020
        /// <summary>
        /// Loads a collection of ProductCode objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the ProductCode objects in the database.</returns>
        public static ProductCodeCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            ProductCodeCollection result = new ProductCodeCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    ProductCode tmp = new ProductCode();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: ProductCode.cs プロジェクト: paulusyeung/RT2020
 /// <summary>
 /// Loads a ProductCode object from the database using the given where clause
 /// </summary>
 /// <param name="whereClause">The filter expression for the query</param>
 /// <returns>A ProductCode object</returns>
 public static ProductCode LoadWhere(string whereClause)
 {
     SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@WhereClause", whereClause) };
     using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spProductCode_SelAll", parameterValues))
     {
         if (reader.Read())
         {
             ProductCode result = new ProductCode();
             result.LoadFromReader(reader);
             return(result);
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #3
0
ファイル: ProductCode.cs プロジェクト: paulusyeung/RT2020
 /// <summary>
 /// Loads a ProductCode object from the database using the given CodeId
 /// </summary>
 /// <param name="codeId">The primary key value</param>
 /// <returns>A ProductCode object</returns>
 public static ProductCode Load(Guid codeId)
 {
     SqlParameter[] parameterValues = new SqlParameter[] { new SqlParameter("@CodeId", codeId) };
     using (SqlDataReader reader = SqlHelper.Default.ExecuteReader("spProductCode_SelRec", parameterValues))
     {
         if (reader.Read())
         {
             ProductCode result = new ProductCode();
             result.LoadFromReader(reader);
             return(result);
         }
         else
         {
             return(null);
         }
     }
 }