public bool CreateSale(string name, decimal price, string description, string size) { bool result = false; try { ISale thisSale = new Sale(0, name, price, description, size, true); thisSale = SalePersistence.CreateSale(thisSale); if (thisSale != null) { saleList.Add(thisSale); return true; } return false; } catch (Exception) { return result; } }
public static List<ISale> RetrieveSale() { List<ISale> saleList = new List<ISale>(); if (Connect()) { try { SqlCommand Command = Connection.CreateCommand(); Command.CommandType = CommandType.StoredProcedure; Command.CommandText = "fif_sale_retrieve"; SqlDataReader dataReader = Command.ExecuteReader(); while (dataReader.Read()) { int activityId = int.Parse(dataReader["activity_id"].ToString()); string name = dataReader["name"].ToString(); decimal price = decimal.Parse(dataReader["price"].ToString()); string description = dataReader["description"].ToString(); string size = dataReader["size"].ToString(); ISale thisSale = new Sale(activityId, name, price, description, size); saleList.Add(thisSale); } Disconnect(); return saleList; } catch (Exception) { Disconnect(); return null; } } return null; }