Exemple #1
0
 public static void PopulatePurchaseTypeItemList(IDataReader dr, PurchaseTypeItem _purchaseTypeItem)
 {
     _purchaseTypeItem.PurchaseTypeID          = (int)dr["purchasetypeid"];
     _purchaseTypeItem.PurchaseTypeCode        = dr["purchasetypecode"] as string;
     _purchaseTypeItem.PurchaseTypeDescription = dr["purchasetypedescription"] as string;
     _purchaseTypeItem.IsDisplayed             = (bool)dr["isdisplayed"];
 }
        public override List <PurchaseTypeItem> GetPurchaseTypeItemList()
        {
            List <PurchaseTypeItem> list = new List <PurchaseTypeItem>();

            using (SqlConnection connection = this.GetSqlConnection())
            {
                string     cmdText = "select * from SuCommerce_PurchaseTypes where IsDisplayed = 1";
                SqlCommand command = new SqlCommand(cmdText, connection)
                {
                    CommandType = CommandType.Text
                };
                connection.Open();
                using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    PurchaseTypeItem item = null;
                    while (reader.Read())
                    {
                        item = new PurchaseTypeItem();
                        CommerceDataProvider.PopulatePurchaseTypeItemList(reader, item);
                        list.Add(item);
                    }
                    reader.Close();
                    connection.Close();
                }
            }
            return(list);
        }