Smärre korrigeringar

This commit is contained in:
2021-02-16 07:27:58 +01:00
parent 390bc6eeeb
commit c406e94eda
5 changed files with 107 additions and 10 deletions

View File

@ -61,7 +61,7 @@ namespace StockDal
", new { val = price, date = DateTime.Today, id = Id });
}
IEnumerable<StockMember> IStockMemberRepository.GetStocks()
public IEnumerable<StockMember> GetStocks()
{
using IDbConnection db = new SqlConnection(StockDBConnection.ConnectionString);
if (db.State == ConnectionState.Closed)
@ -77,7 +77,28 @@ namespace StockDal
,SoldDate
,Comment
,PostAmount
FROM dbo.StockMember", commandType: CommandType.Text);
FROM dbo.StockMember
Where SoldDate is null
ORDER BY PostAmount * (actvalue - BuyValue) desc", commandType: CommandType.Text);
}
public IEnumerable<StockMember> GetAllStocks()
{
using IDbConnection db = new SqlConnection(StockDBConnection.ConnectionString);
if (db.State == ConnectionState.Closed)
db.Open();
return db.Query<StockMember>(@"SELECT Id
,StockId
,StockExtId
,BuyValue
,BuyDate
,ActValue
,ActDate
,SoldValue
,SoldDate
,Comment
,PostAmount
FROM dbo.StockMember
ORDER BY PostAmount * (actvalue - BuyValue) desc", commandType: CommandType.Text);
}
}
}