It is now possible to register owned stocks for keeping track on them

This commit is contained in:
2021-01-28 20:20:33 +01:00
parent ec71d60a2a
commit 3f737a8010
10 changed files with 174 additions and 24 deletions

View File

@ -16,9 +16,35 @@ namespace StockDal
throw new NotImplementedException();
}
public bool Insert(StockMember stockMember)
public void InsertMany(List<StockMember> stockMembers)
{
throw new NotImplementedException();
using IDbConnection db = new SqlConnection(StockDBConnection.ConnectionString);
if (db.State == ConnectionState.Closed)
db.Open();
db.Execute(
@"INSERT INTO [dbo].[StockMember]
(StockId
,StockExtId
,BuyValue
,BuyDate
,ActValue
,ActDate
,SoldValue
,SoldDate
,Comment
,PostAmount)
VALUES
(@StockId
,@StockExtId
,@BuyValue
,@BuyDate
,@ActValue
,@ActDate
,@SoldValue
,@SoldDate
,@Comment
,@PostAmount)
", stockMembers);
}
public bool Update(StockMember stockMember)
@ -28,7 +54,7 @@ namespace StockDal
IEnumerable<StockMember> IStockMemberRepository.GetStocks()
{
using System.Data.IDbConnection db = new SqlConnection(StockDBConnection.ConnectionString);
using IDbConnection db = new SqlConnection(StockDBConnection.ConnectionString);
if (db.State == ConnectionState.Closed)
db.Open();
return db.Query<StockMember>(@"SELECT Id